Josh Posted November 25, 2009 Share Posted November 25, 2009 Make sure the "Scripts" folder is in the same directory as your program: // ==================================================================== // 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:/Program Files (x86)/Leadwerks Engine SDK"); SetAppTitle( "MyGame" ) ; 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,-20)); //================================================================ // Here is the code I added //================================================================ SetGlobalObject("world_main",world); LoadModel("abstract::windmill.gmf"); //================================================================ // //================================================================ material=LoadMaterial("abstract::cobblestones.mat"); 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() ; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ZeroByte Posted November 25, 2009 Share Posted November 25, 2009 Thank's Josh, it worked great. I converted it to use the Framewerk, but i can't get the blades to turn. Here is the code i'm using, with SetGlobalObject(); #include "framewerk.h" using namespace leadwerks; int main() { if(!Initialize())return 1; RegisterAbstractPath("C:/LE2.3"); SetAppTitle( "C++ Lua Demo" ) ; Graphics( 800, 600 ) ; AFilter() ; TFilter() ; TLight light; TMesh ground; TMaterial material; Framewerk fw; if( !fw.Create() ) { MessageBoxA(0,"Failed to initialize engine.",NULL,0); return 1; } //================================================================ // Here is the code I added //================================================================ SetGlobalObject("world_main",fw.GetMain().GetWorld()); LoadModel("abstract::windmill.gmf"); //================================================================ // //================================================================ fw.GetRenderer().SetSkybox( LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat") ); fw.GetRenderer().SetSSAO(0); fw.SetStats(2); PositionEntity(fw.GetMain().GetCamera(),Vec3(0,8,-22)); material = LoadMaterial("abstract::cobblestones.mat"); ground = CreateCube(); ScaleEntity ( ground, Vec3(12, 1, 12)); PositionEntity( ground, Vec3(0, -1, 0)); PaintEntity ( ground, material ); light=CreateDirectionalLight(); RotateEntity( light, Vec3(45) ); // Game loop do { if( KeyHit(KEY_ESCAPE) ) break; if( AppTerminate() ) break; // Update timing and world //UpdateAppTime(); //UpdateWorld(AppSpeed()) ; // Render fw.Update(); fw.Render(); // Send to screen Flip(0) ; } while( true ); // Done return Terminate() ; } Is it possible to use Lua with Framewerk ? Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI. Link to comment Share on other sites More sharing options...
Josh Posted November 25, 2009 Author Share Posted November 25, 2009 That should work perfectly. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
DaDonik Posted November 25, 2009 Share Posted November 25, 2009 It's working with Framewerk All i had to add to my project was: SetGlobalObject ("world_main", g_FW.GetMain ().GetWorld ()); SetGlobalObject ("world_transparency", g_FW.GetTransparency ().GetWorld ()); SetGlobalObject ("world_background", g_FW.GetBackground ().GetWorld ()); SetGlobalObject ("camera_main", g_FW.GetMain ().GetCamera ()); SetGlobalObject ("camera_transparency", g_FW.GetTransparency ().GetCamera ()); SetGlobalObject ("camera_background", g_FW.GetBackground ().GetCamera ()); g_FW is an instance of the Framewerk...obviously Josh, you told us that LUA runs along with C++ with NO code changes...thats just not true! I need the 6 lines above!! Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Josh Posted November 25, 2009 Author Share Posted November 25, 2009 ...due to the way that particular script is written. It could be written so it doesn't need those values at all. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
DaDonik Posted November 25, 2009 Share Posted November 25, 2009 No problem for me. As long as it works when writing 6 lines in c++, it's still like magic Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Canardia Posted November 25, 2009 Share Posted November 25, 2009 Those lines need to be added to gamelib, so you don't have to write any additional lines in your game code. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZeroByte Posted November 25, 2009 Share Posted November 25, 2009 Thank's DaDonik, it's working. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI. Link to comment Share on other sites More sharing options...
Soamp Posted April 20, 2010 Share Posted April 20, 2010 Hi, I used ProjectWizard to create an empty project. Josh's code worked fine but when I create an instance of Framewerk I get these errors : Error 1 error LNK2019: unresolved external symbol "public: virtual __thiscall leadwerks::Framewerk::~Framewerk(void)" (??1Framewerk@leadwerks@@UAE@XZ) referenced in function _WinMain@16 test_windows002.obj test_windows002 Error 2 error LNK2019: unresolved external symbol "public: __thiscall leadwerks::Framewerk::Framewerk(void)" (??0Framewerk@leadwerks@@QAE@XZ) referenced in function _WinMain@16 test_windows002.obj test_windows002 Error 3 fatal error LNK1120: 2 unresolved externals .\test_windows002-Debug.exe test_windows002 Here is my code: // ==================================================================== // This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard // Written by Rimfrost Software // http://www.rimfrost.com // ==================================================================== #include "engine.h" #include "framewerk.h" using namespace leadwerks; int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { Initialize() ; RegisterAbstractPath("C:/Program Files/Leadwerks Engine SDK"); SetAppTitle( "test_windows002" ) ; 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(); } Framewerk fw; gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); camera=CreateCamera(); PositionEntity(camera,Vec3(0,0,-2)); material=LoadMaterial("abstract::cobblestones.mat"); 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() ; } Can anybody help me please. thanks. Quote Link to comment Share on other sites More sharing options...
Canardia Posted April 20, 2010 Share Posted April 20, 2010 Don't use Framewerk, but use Framework. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.