MiniB3D and wxMax

BlitzMax Modules Forums/MiniB3D/MiniB3D and wxMax

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

SuperStrict

Framework wx.wxApp
Import wx.wxFrame
Import wx.wxTimer
Import wx.wxPanel
Import wx.wxglmax2D
Import "MiniB3D.bmx"

Const Menu_Exit:Int = 100

SetGraphicsDriver wxGLGraphicsDriver(),GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER
New Window.run()

Type Window Extends wxApp
	Field Frame:WinFrame
	Method OnInit:Int()
		Frame = WinFrame(New WinFrame.Create(Null, -1, "Terrain Editor", , , 800, 600))
		Frame.show(True)
		SetTopWindow(Frame)
		Return True
	End Method
End Type

Type WinFrame Extends wxFrame
	Field Canvas:WinCanvas
	Method OnInit()
		Local FileMenu:wxMenu = wxMenu.CreateMenu()
		Local MenuBar:wxMenuBar = wxMenuBar.CreateMenuBar()
		Local Panel:wxPanel = New wxPanel.Create( Self )
		Canvas = WinCanvas(New WinCanvas.Create(Panel, -1, GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER,0,0,800,600))
		ConnectAny(wxEVT_CLOSE, OnClose)
		FileMenu.Append(Menu_Exit, "Exit~tAlt-X", "Quit this program")
		MenuBar.Append(FileMenu, "&File")
		SetMenuBar(MenuBar)
		CreateStatusBar(1)
		SetStatusText("Terrain Editor")
	End Method
	Function OnClose(event:wxEvent)
		WinFrame(event.parent).Canvas.timer.Stop()
		event.Skip()
	End Function
End Type

Type WinCanvas Extends wxGLCanvas
	Field Timer:wxTimer
	Method OnInit()
		SetBackgroundStyle(wxBG_STYLE_CUSTOM)
		Timer = New wxTimer.Create(Self)
		ConnectAny(wxEVT_TIMER, OnTick)
		Timer.Start(100)
	End Method
	Method OnPaint(event:wxPaintEvent)
		Render()
	End Method
	Method Render()
		SetGraphics CanvasGraphics2D( Self )
		SetClsColor(0, 0, 0)
		SetColor(0, 0, 0)
		Cls
		Draw()
		Flip
	End Method
	Function OnTick(event:wxEvent)
		wxWindow(event.parent).Refresh()
	End Function
	Method Draw()
		TGlobal.width = 400
		TGlobal.height = 300
		TGlobal.GraphicsInit()
		Local cam:TCamera=CreateCamera()
		Local light:TLight=CreateLight(1)
		Local cube:TMesh=CreateCube()
		Local sphere:TMesh=CreateSphere()
		Local cylinder:TMesh=CreateCylinder()
		Local cone:TMesh=CreateCone()
		PositionEntity cam,0,0,-10
		PositionEntity cube,-6,0,0
		PositionEntity sphere,-2,0,0
		PositionEntity cylinder,2,0,0
		PositionEntity cone,6,0,0
		TurnEntity cube,0,1,0
		RenderWorld
	End Method
End Type


I have that so far, still need help. I do not know what I should change it to instead of Max2D