;; ----------------------------------------------------------------------------
;; Irrlicht Wrapper For Imperative Languages - Purebasic Examples
;; IrrlichtWrapper and FreeBasic-Example by Frank Dodd (2006)
;; Improved IrrlichtWrapper - Michael Taupitz (2007)
;; PureBasic-Examples by Michael Taupitz (neotoma) & Marius Eckardt (Thalius) 
;; ----------------------------------------------------------------------------
;; Example 25: Load IrrlichtScene
;; This simple example loads an IrrlichtScene (*.irr)
;; ----------------------------------------------------------------------------

;; ////////////////////////////////////////////////////////////////////////////
;; Include the Irr3D-Requester
XIncludeFile "Irr3DRequester.pb"


; -----------------------------------------------------------------------------
; To Start the Irrlicht-Device we use the Irr3DRequester, to make it more comfortable
; for the Users, and also easier to test different resolutions and devices.
If Irr3DRequester()

  ; Set the title of the display
  IrrSetWindowCaption( "Example 25: Load Irrlicht-Scene" )
  
  ; add a static text object to the graphical user interface, at the moment
  ; this is the only interface object we support. The text will be drawn inside
  ; the defined rectangle, the box will not have a border and the text will not
  ; be wrapped around if it runs off the end
  IrrGuiAddStaticText( "Loaded Irrlicht-Scene", 4,0,200,16, #IRR_GUI_NO_BORDER, #IRR_GUI_NO_WRAP )
  
  
  ; load the Scene, which was created with IrrEdit. So we have a complete Scene, with
  ; Objects, Animator and Lights. 
  IrrLoadScene("media\example.irr");
  
  ; add a first person perspective camera into the scene that is controlled with
  ; the mouse and the cursor keys. if however you capture events when starting
  ; irrlicht this will become a normal camera that can only be moved by code
  *camera = IrrAddFPSCamera()
  
  ; while the scene is still running
  While IrrRunning()
      ; begin the scene, erasing the canvas to white before rendering
      IrrBeginScene( 255,255,255 )
  
      ; draw the scene
      IrrDrawScene()      
  
      ; draw the Graphical User Interface
      IrrDrawGUI()
  
      ; end drawing the scene and render it
      IrrEndScene()
  Wend
  
  ; -----------------------------------------------------------------------------
  ; Stop the irrlicht engine and release resources
  IrrStop()
EndIf

End


; IDE Options = PureBasic 4.10 Beta 3 (Windows - x86)
; ExecutableFormat = Console
; Folding = -