splash screen

BlitzMax Modules Forums/MiniB3D/splash screen

here's another one. a little different

Import sidesign.MiniB3D
Strict

Global Splash1file:String = "splash1-1024.jpg"
Global Splash2file:String = "splash2-1024.jpg"

Global width:Int = 1024 , height# = 768
Global midw:Int = width / 2
Global Midh:Int = height / 2

Graphics3D width,height,32,0
ClearTextureFilters


Local plaintex:TTexture = LoadTexture("splash1-1024.jpg")
Local plain:Tentity = Createplain()	' 	'plain' = homage to DB :)
EntityTexture plain , plaintex
MoveEntity plain,0,0,20
ScaleEntity plain,1,0.75,1

Local cam:Tentity = CreateCamera() ; CameraRange(Tcamera(cam), 0.001 , 300)
' Main Loopski
Local spin:Float = 0.0
Repeat
			If EntityZ(plain)>1.0
				spin:+0.01
				TurnEntity plain,0,spin,0
				TranslateEntity plain,0,0,-spin*0.03
			EndIf
			If EntityZ(plain)<1.0 
				PositionEntity plain,0,0,1
			EndIf
			
			If EntityZ(plain)=1.0 
				spin:*0.99
				TurnEntity plain,0,spin,0
				If Abs(EntityYaw(plain,True)) < 1.25
					spin=0
					RotateEntity plain,0,0,0
				EndIf 
			
			EndIf
				
			
			RenderWorld
			text 0,0,Abs(EntityYaw(plain,True))
			Flip 			
			
Until KeyHit(KEY_ESCAPE)

Function Createplain:TMesh(parent_ent:TEntity=Null)
		' this creates a 2-sided plane (the back texture is reversed)
		Local mesh:TMesh=TMesh.CreateMesh(parent_ent)
	
		Local surf:TSurface=mesh.CreateSurface()
		
			
			surf.AddVertex(-1.0,-1.0,0)
			surf.AddVertex(-1.0, 1.0,0)
			surf.AddVertex( 1.0, 1.0,0)
			surf.AddVertex( 1.0,-1.0,0)
			
			surf.VertexNormal(0,0.0,0.0,-1.0)
			surf.VertexNormal(1,0.0,0.0,-1.0)
			surf.VertexNormal(2,0.0,0.0,-1.0)
			surf.VertexNormal(3,0.0,0.0,-1.0)
				
			surf.VertexTexCoords(0,0.0,1.0)
			surf.VertexTexCoords(1,0.0,0.0)
			surf.VertexTexCoords(2,1.0,0.0)
			surf.VertexTexCoords(3,1.0,1.0)
					
			surf.AddTriangle(0,1,2) ' front
			surf.AddTriangle(0,2,3)
			surf.AddTriangle(2,1,0) ' back
			surf.AddTriangle(3,2,0)
			
		
		Return mesh
	
End Function