splash screen

BlitzMax Modules Forums/MiniB3D/splash screen

hi all, lookin at creating a simple sample using minib3d with a splash screen that fades between 2 image, cant figure the best way to do it, is it to create a quad and texture it (do same for both images) then fade one out and fade other in? or is there better way?

EDIT: Modified to fill the screen
You could use a sprite and adjust the alpha.

grab these images (save link as):
www.bmaxbook.com/splash1-1024.jpg
www.bmaxbook.com/splash2-1024.jpg

and run this file:
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 cam:Tentity = CreateCamera() ; CameraRange(Tcamera(cam), 0.001 , 300)
Local title1:Tentity = LoadSprite(Splash1file)
	PositionEntity title1,0,0,1
	ScaleSprite Tsprite(title1),1,0.75

Local title2:Tentity = LoadSprite(Splash2file)
	EntityAlpha title2,0.1
	PositionEntity title2,2000,0,1
	ScaleSprite Tsprite(title2),1,0.75

Local alpha1# = 1.0
Local alpha2# = 0.001

Local duration:Int = 100
Local splashover :Int
' Main Loopski
Repeat
			duration:-1
			If duration<0
				alpha1:*0.99
				EntityAlpha title1,alpha1	
					If alpha1<0.55
							alpha2:*1.03
								PositionEntity title2,0,0,1
								EntityAlpha title2,alpha2	
					EndIf
			EndIf
			
			RenderWorld

			Flip 			
			
			If KeyHit(KEY_ESCAPE) Then splashover = 1
			If duration<-500 Then splashover = 1

			
Until splashover 







Cheers bradford6,

Images in post dont seem to exist but i can knock up some images to test when i get home, does this fill the screen up tho??

just do a 'save as' on the 2 images.

they are 512x512 but you can either scale them to fit the screen or load a screensized image.

OK,
I just changed it to fill the screen. both images are 1024x768. this will load that size sprite and display it unaltered in the full frame.

I am not 100% sure but I think some videocards can't handle textures that big.

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







thx man, ure a diamond, have a virtual pint on me :-)

*EDIT: just wondering if it'd be easierto do title screen with max2d commands then switch over to minib3d? althought he first method above looks very simple

you could do it either way. MAX2D would probably be easier but with miniB3D you could do some 3D stuff in there as well. like have the image wave like a flag or spin around.

the other thing to note is that you might not need to make the image full-frame to get the desired result. you could center a smaller image

Yes, i think i'll go withminib3d seems as it saves swapping between modules etc. thru out the project.

Shall see how well it works when i get out of hell and home tonight