#Include "Ninfa3d.bi"

dim Shared camera As nCAMERA

Dim music01 As nSOUND
Dim tex As nTEXTURE
Dim mesh01 As nMESH
dim light01 As nLIGHT
Dim font01 As nFONT

'Enable vertical synch.
EnableVsync()

'Starts the Ninfa3D Engine
InitEngine(640,480,32,0)
	BackGroundColor(16,16,16)'Background color
	AmbientLight(0,0,0)'Ambient color

'Include the file "SampleFuntions.bi.
'It contains useful features, such as drawing the interface and create the test area.
#Include "SampleFunctions.bi"

'Create a camera
camera = CreateCamera()

tex = LoadTexture("media\s01.png")

mesh01 = CreateMeshCube()
	PositionEntity(mesh01,0,0,3)
	EntityTexture(mesh01,tex,0)
	EntityFlag(mesh01,MF_FULLBRITGH,0)

'Load the music.
music01 = LoadSound("media\music.ogg")
	SoundType(music01,1)
	LoopSound(music01)'Loop

font01 = LoadFOnt("media\courier.xml")'Load the font, in format XML

While(EngineRun)'Returns 1 if the engine is running.

	'Begins scene
	BeginScene()
	
	'By pressing the "ESCAPE" closes the engine.
	If KeyHit(KEY_ESCAPE) Then CloseEngine()
	
	'Update the Engine.
	'Changing the value (only affects the physics) that will update the
	'Physical faster or slower.
	UpdateEngine(0)

	TurnEntity(mesh01,1,1,1)
	
	Font(font01)'assign the font to use
	Text(200,350,"(1) Play",1,1)
	If KeyHit(KEY_1) Then PlaySound(music01)

	Text(300,350,"(2) Stop",1,1)
	If KeyHit(KEY_2) Then StopSound(music01)

	Text(400,350,"(3) Pause",1,1)
	If KeyHit(KEY_3) Then PauseSound(music01)
    
    Text(300,400,"(4,5) Volume",1,1)
    If KeyHit(KEY_4) Then VOLUMESOUND(music01,0.5)
    If KeyHit(KEY_5) Then VOLUMESOUND(music01,1.0)
    
    Text(500,400,"(6,7,8) Pitch",1,1)
    If KeyHit(KEY_6) Then PitchSound(music01,0.5)
    If KeyHit(KEY_7) Then PitchSound(music01,2.0)
    If KeyHit(KEY_8) Then PitchSound(music01,1.0)
	'Displays the interface (FPS and triangles)
	Interface()
	
	'End the scene
	EndScene()
	
Wend

'Ends Ninfa3D Engine
EndEngine()