#Include "Ninfa3d.bi"

dim Shared camera As nCAMERA

Dim As nSOUND sound02,sound03
Dim As nSPRITE sprite02,sprite03

dim light01 As nLIGHT

'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 = CreateCameraFPS(100,0.5)

'Creates the lights
light01 = CreateLight(LGT_POINT)
	PositionEntity(light01,0,128,0)' Position
	
sprite02 = LoadSprite("media\s01.png")
	ScaleSprite(sprite02,20,20)
	PositionEntity(sprite02,0,64,200)
	
sprite03 = LoadSprite("media\s01.png")
	ScaleSprite(sprite03,20,20)
	PositionEntity(sprite03,0,128,-200)

'Load the sounds.
sound02 = LoadSound("media\ring.wav")
	SoundType(sound02,2)'Type sound, in this case 3D.
	PositionEntity(sound02,00,64,200)
	LoopSound(sound02)
	PlaySound(sound02)
	
	'These commands are used only for 3D sound.
	SoundReferenceDistance(sound02,200)
	SoundRollOff(sound02,50)
	
sound03 = LoadSound("media\party.wav")
	SoundType(sound03,2)'Type sound, in this case 3D.
	PositionEntity(sound03,0,128,-200)
	LoopSound(sound03)
	PlaySound(sound03)

	'These commands are used only for 3D sound.
	SoundReferenceDistance(sound03,100)
	SoundRollOff(sound03,25)

CreateGround()'Creates the test area

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)

	'Displays the interface (FPS and triangles)
	Interface()
	
	'End the scene
	EndScene()
	
Wend

'Ends Ninfa3D Engine
EndEngine()