I put this together, the GUI was generated with LogicGUI and afew lines for the canvas rendering from the OpenSandbox project on the old forums.
SuperStrict
Framework leadwerks.ENGINE
Import koriolis.bufferedstream
Import koriolis.zipstream
Import leadwerks.logstream
Import leadwerks.audio
Import leadwerks.ENGINE
Import leadwerks.glewex
Import maxgui.maxgui
Import leadwerks.abstractstream
Import maxgui.win32maxguiex
Import maxgui.drivers
Import brl.event
Import brl.eventqueue
Local world:TWorld
Global gbuffer:TBuffer
Local camera:TCamera
Local mesh:TMesh
Global light:TLight
Local ground:TMesh
Local material:TMaterial
GCSetMode(2)
SetGraphicsDriver GLGraphicsDriver(), GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER
RegisterAbstractPath( "D:/Program Files (x86)/Leadwerks Engine SDK" )
Local Window1:TGadget = CreateWindow("Window1",383,112,1042,767,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_CLIENTCOORDS )
Local Canvas1:TGadget = CreateCanvas(0,0,1042,767,Window1,Null)
ActivateGadget( Canvas1 )
SetGadgetLayout( Canvas1,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED )
SetGraphics CanvasGraphics(Canvas1)
world=CreateWorld()
If Not world RuntimeError "Failed to create world."
gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_DEPTH|BUFFER_COLOR0|BUFFER_COLOR1|BUFFER_COLOR2)
camera=CreateCamera()
PositionEntity camera,[0.0,0.0,-2.0]
material=LoadMaterial("abstract::cobblestones.mat")
mesh=CreateCube()
PaintEntity mesh,material
ground=CreateCube()
ScaleEntity ground,[10.0,1.0,10.0]
PositionEntity ground,[0.0,-2.0,0.0]
PaintEntity ground,material
light=CreateDirectionalLight()
RotateEntity light,[45.0,45.0,45.0]
Repeat
PollEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
Select EventSource()
Case Window1 Window1_WC( Window1 )
End Select
End Select
TurnEntity mesh,[AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5]
If KeyHit(KEY_ESCAPE) Exit
If AppTerminate() Exit
UpdateAppTime()
UpdateWorld(AppSpeed())
SetBuffer(gbuffer)
RenderWorld()
SetBuffer(BackBuffer())
RenderLights(gbuffer)
Flip(0)
Forever
Function Window1_WC( Window:TGadget )
gbuffer=Null
FreeEntity light
GCCollect()
End
End Function