Here I converted your code over to use Framewerk just make sure you point the Abstract path to your SDK folder and have the DLL's , shader.pak and scripts folder in your app folder:
#include "engine.h"
int main(int argc, char** argv)
{
Initialize();
RegisterAbstractPath("PATH TO YOUR SDK FOLDER");
Graphics(800,600);
AFilter(4) ;
TFilter(1) ;
TWorld world = CreateWorld() ;
if (!world) {
MessageBoxA(0,"Error","Failed to create world.",0);
return Terminate();
}
TFramework framework=CreateFramework();
TLayer layer = GetFrameworkLayer(0);
TCamera cam=GetLayerCamera(layer);
//Set Lua variable
BP L=GetLuaState();
lua_pushobject(L,framework);
lua_setglobal(L,"fw");
lua_pop(L,1);
// Setup Initial Post Processing FX
SetGodRays(0);
SetHDR(1);
SetSSAO(1);
SetBloom(1);
SetAntialias(1);
SetStats(2);
LoadScene("abstract::tunnels.sbx");
TController player=CreateController();
EntityType(player, 1);
SetBodyMass(player, 1);
SetBodyDamping(player,0.0);
SetWorldGravity(Vec3(0,-20,0));
PositionEntity(player, Vec3(38.9101448,6.67733288,1.72972393));
float move=0.0, strafe=0.0;
TVec3 camrotation=Vec3(0);
float mx=0, my=0;
HideMouse();
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
// Game loop
while( !KeyHit() && !AppTerminate() )
{
if( !AppSuspended() ) // We are not in focus!
{
mx=Curve(MouseX()-GraphicsWidth()/2,mx,6);
my=Curve(MouseY()-GraphicsHeight()/2,my,6);
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
camrotation.X=camrotation.X+my/10.0;
camrotation.Y=camrotation.Y-mx/10.0;
RotateEntity(cam,camrotation);
move = 3 * (KeyDown(KEY_W) - KeyDown(KEY_S));
strafe = 3 * (KeyDown(KEY_D) - KeyDown(KEY_A));
//Jumping
float jump=0.0;
if (KeyHit(KEY_SPACE)) {
if (!ControllerAirborne(player)) {
jump=4.0;
}
}
//Run
if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) {
if (!ControllerAirborne(player)) {
move*=2.0;
strafe*=2.0;
}
}
UpdateController(player, camrotation.Y, move, strafe, jump, 500.0f);
//Position the camera
TVec3 playerpos=EntityPosition(player);
TVec3 camerapos=EntityPosition(cam);
camerapos.Y=Curve(playerpos.Y+1.75,camerapos.Y,2.0);
camerapos=Vec3(playerpos.X,camerapos.Y,playerpos.Z);
camerapos=Vec3(playerpos.X,camerapos.Y,playerpos.Z);
PositionEntity(cam,camerapos);
UpdateFramework();
RenderFramework();
// Send to screen
Flip(0) ;
}
}
}