This works fine:
// ====================================================================
// This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard
// Written by Rimfrost Software
// http://www.rimfrost.com
// ====================================================================
#include "engine.h"
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd )
{
Initialize() ;
RegisterAbstractPath("C:/Leadwerks Engine SDK");
SetAppTitle( "test" ) ;
Graphics( 800, 600 ) ;
AFilter() ;
TFilter() ;
TWorld world;
TBuffer gbuffer;
TCamera camera;
TMesh mesh;
TLight light;
TMesh ground;
TMaterial material;
world = CreateWorld() ;
if (!world) {
MessageBoxA(0,"Error","Failed to create world.",0);
return Terminate();
}
gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL);
camera=CreateCamera();
PositionEntity(camera,Vec3(0,0,-2));
material=LoadMaterial("abstract::cobblestones.mat");
CreateEmitter(50);
mesh=CreateCube();
PaintEntity(mesh,material);
ground=CreateCube();
ScaleEntity(ground,Vec3(10,1,10));
PositionEntity(ground,Vec3(0,-2,0));
PaintEntity(ground,material);
light=CreateDirectionalLight();
RotateEntity(light,Vec3(45,45,45));
// Game loop
while( !KeyHit() && !AppTerminate() )
{
if( !AppSuspended() ) // We are not in focus!
{
// Rotate cube
TurnEntity( mesh, Vec3( 0.5f*AppSpeed() ) ) ;
// Update timing and world
UpdateAppTime();
UpdateWorld(AppSpeed()) ;
// Render
SetBuffer(gbuffer);
RenderWorld();
SetBuffer(BackBuffer());
RenderLights(gbuffer);
// Send to screen
Flip(0) ;
}
}
// Done
return Terminate() ;
}