Irrlicht and Newton

BlitzMax Forums/BlitzMax Programming/Irrlicht and Newton

Here's my Irrlicht.Extended btw. Nothing impressive. Just a pair of convenience functions.

Module Irrlicht.Extended

Import Irrlicht.Core
Import BRL.System
Private
	OnEnd byebye
	Function byebye()
		Print "Goodbye."
	End Function
Public

Function DebugCreateIrrlicht(stencil,vsync,fullScn% Var,rAccel% Var,dvc:IrrlichtDevice Var,dvr:IVideoDriver Var,sne:ISceneManager Var)
	fsn=Confirm("Run in fullscreen?")
	rac=Confirm("Click OK to use HW Driven rendering acceleration.  If you~n~r"+..
	 "don't, a software renderer will be used instead.")
	If rAccel Then
		Select Confirm("Default driver is Direct3D (v8.x to v9.x).  Use OpenGL(1.x.x) instead?")
			Case True CreateIrrlicht EDT_OPENGL,800,600,32,fsn,stencil,vsync,dvc,dvr,sne
		Case False
			Select Confirm( ..
			 "Use Direct3D 9.0?  Cancel will default to older driver (Direct3D 8.1).~n~r"+..
			  "D3D 8.1 is not fully functional in the rendering techniques this program uses, so~n~r"+..
			   "rendering errors may occur.  Most commonly reported is the inexplicable failiure to~n~r"+..
			    "render seemingly random polygons on the sphere mesh primitives.  The physics~n~r"+..
			     "simulation is entirely independent of the renderer, so it should be the same regardless.")
				Case True CreateIrrlicht EDT_DIRECT3D9,800,600,16,fsn,stencil,vsync,dvc,dvr,sne
				Case False CreateIrrlicht EDT_DIRECT3D8,800,600,16,fsn,stencil,vsync,dvc,dvr,sne
			End Select
		End Select
	Else
		If Confirm("Use high quality software renderer?  WARNING: This will be VERY SLOW!") Then
			CreateIrrlicht EDT_SOFTWARE2,640,480,16,fsn,stencil,vsync,dvc,dvr,sne
		Else
			CreateIrrlicht EDT_SOFTWARE,640,480,16,fsn,stencil,vsync,dvc,dvr,sne
		End If
	End If
	fullScn=fsn
	rAccel=rac
End Function

Function CreateIrrlicht(renderer,rezx,rezy,bits,fullscrn,stencil,vsync,DVC:IrrlichtDevice Var,DVR:IVideoDriver Var,SCN:ISceneManager Var)
	DVC=IrrlichtDevice.create(..
	 renderer,_DIMENSION2DI(rezx,rezy),rezdepth,..
	  fullscrn,stencil,vsync)
	
	If DVC.handle=0 Then
		Print "Could not create 3D device!"
		Notify "Could not create 3D device!",True
		End
	Else
		Print "Created 3D device successfully!"
	End If
	
	DVR=DVC.getVideoDriver()
	SCN=DVC.getSceneManager()
End Function

Function ReleaseIrrlicht(DVC:IrrlichtDevice)
	DVC.drop()
	DVC=Null
	If DVC Then
		Print "3D device was not released successfully!"
		Notify "3D device was not released successfully!",True
		End
	Else
		Print "3D device was released successfully!"
	End If
End Function


EDIT:Added another function.