'' ----------------------------------------------------------------------------
'' Irrlicht Wrapper For Imperative Languages - Freebasic Examples
'' Frank Dodd (2006-2010)
'' ----------------------------------------------------------------------------
'' Converted To BlitzMax And Irrlicht 1.8.3 by Ed Musolino (AquaLung 2015)
'' ----------------------------------------------------------------------------
'' Example 112 : Example_Zip Password Protected
'' This example loads an MD2 model And adds it as a node To the scene
'' ----------------------------------------------------------------------------

'' ////////////////////////////////////////////////////////////////////////////
'' Includes For extension libraries
Framework usr.birrlicht

'' ////////////////////////////////////////////////////////////////////////////
'' Global variables

' irrlicht objects
Global MD2Mesh:Int = 0
Global MeshTexture:Int = 0
Global SceneNode:Int = 0
Global OurCamera:Int = 0

'' ////////////////////////////////////////////////////////////////////////////
' start the irrlicht interface
'IRR_EDT_OPENGL  Or  IRR_EDT_DIRECT3D9
iIrr3D( 1024, 768, 32, False )

' set the window caption
iAppTitle( "Example 112: Example_Zip Password Protected" )

' add a zip file that is passwor protected - If password is wrong, file contents will Not exist.
If Not iAddZipFile( "./112_Example_Zip Password.zip", IRR_IGNORE_CASE, IRR_IGNORE_PATHS, "12345678901234567890" )
	Notify( "File Not Found!", True ) ; End
End If

' add credits For the model as a static text GUI Object on the display
iStaticText( "Zumlin model by Rowan 'Sumaleth' Crawford", 4,0,200,16, IRR_GUI_NO_BORDER, IRR_GUI_NO_WRAP, 0 )

' Load a mesh this acts as a blue Print For the model
SceneNode = iLoadAnimMesh( "tris.md2", False )
' test if files are accessable and password is correct
If Not SceneNode Then Notify( "Can't Access Resources!", True ) ; End

' Load texture resources For texturing the scene nodes
MeshTexture = iLoadTexture( "zumlin.pcx" )

' apply a material To the node To give its surface color
iNodeTexture( SceneNode, MeshTexture, 0 )

' switch off lighting effects on this model, as there are no lights in this
' scene the model would otherwise render pule black
iNodeMaterialFlag( SceneNode, IRR_EMF_LIGHTING, False )

' play an animation sequence embeded in the mesh. MD2 models have a group of
' preset animations For various poses And actions. this animation sequence is
' the character standing idle
iPlayMD2Animation( SceneNode, IRR_EMAT_STAND )

' add a camera into the scene, the first co-ordinates represents the 3D
' location of our view point into the scene the second co-ordinates specify the
' target point that the camera is looking at
OurCamera = iCreateCamera( 0 )

iPositionNode( OurCamera, 50, 0, 0 )

' erase the canvas with sky-blue before rendering
iCameraCLSColor( 128, 255, 255 )

' -----------------------------------------------------------------------------
' While the irrlicht environment is still running
While iRun() And (Not iKeyHit( KEY_ESCAPE ))

	' begin the scene
    iBeginScene()

    ' draw the scene
    iDrawScene()
    
    ' draw the GUI
    iDrawGUI()

    ' End drawing the scene And render it
    iEndScene()
Wend 

' -----------------------------------------------------------------------------
' Stop the irrlicht engine And Release resources
iEndIrr3D()


End