#Include "Ninfa3d.bi"

dim Shared camera As nCAMERA
dim As nLIGHT light01,light02

'Enable vertical synch.
EnableVsync()

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

'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)
	PositionEntity(camera,0,128,-256)'Position

'Creates the lights
light01 = CreateLight(LGT_POINT)
	PositionEntity(light01,0,128,-128)' Position
	
    
light02 = CreateLight(LGT_POINT)
	PositionEntity(light02,0,128,128)
	
	
Dim As nFONT font01 = LoadFont("media\courier.xml")'Load the font, in format XML
	
'Creates the pyramids (to see the code, open the file functions SampleFunctions.bb)
CREATEPYRAMID(0,-110,-54,1)
CREATEPYRAMID(0,-70,-36,3)
CREATEPYRAMID(0,-30,-18,5)
CREATEPYRAMID(0,0,0,7)
CreatePyramid(0,-30,18,5)
CreatePyramid(0,-70,36,3)
CREATEPYRAMID(0,-110,54,1)

'Creates the towers (to see the code, open the file functions SampleFunctions.bb)
CreateTower(128,0,128)
CreateTower(128,0,-128)
CreateTower(-128,0,128)
CreateTower(-128,0,-128)

CreateGround()'Creates the test area

While(EngineRun)
	
	'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.05)
    WorldMousePick(MouseX(),MouseY(),MouseDown(MOUSE_LEFT))
	Font(font01)'assign the font to use
	Text(15,75,"Mouse Left - Shoot",0,0)

	'Pressing "MOUSE_LEFT" creates a bullet.
	'(To see the code, open the file functions SampleFunctions.bb)
	If MouseHit(MOUSE_LEFT) Then CreateBullet()
	
	'Displays the interface (FPS and triangles)
	'Interface()

	'End the scene
	EndScene()
	
Wend

'Ends Ninfa3D Engine
EndEngine()