metaldc4life Posted September 14, 2014 Share Posted September 14, 2014 I tried running my game but it just closes the window in leadwerks when I hit run or debug.. i'm new to c++ but enjoy it quite a bit and would like to know how to get this working in game and in Microsoft visual studio... Thanks! here is my script I am using: #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } bool App::Start() { window = Window::Create("leadworks!!!", 1024, 1024, 1024, Leadwerks::Window::Titlebar); /*if (!Steamworks::Initialize()) { System::Print("Error: Failed to initialize Steam."); return false; }*/ //Create a window window = Leadwerks::Window::Create("hi?"); //Create a context context = Context::Create(window); //Create a world world = World::Create(); //Create a camera camera = Camera::Create(); camera->Move(0, 2, -5); //Hide the mouse cursor window->HideMouse(); std::string mapname = System::GetProperty("map", "Maps/JungleDave.map"); Map::Load("maps/JungleDave.map"); //Move the mouse to the center of the screen window->SetMousePosition(context->GetWidth() / 2, context->GetHeight() / 2); return true; } bool App::Loop() { //Close the window to end the program if (window->Closed()) return true; //Press escape to end freelook mode if (window->KeyHit(Key::Escape)); return true; } Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 14, 2014 Share Posted September 14, 2014 what happens if you comment out this line: if (window->KeyHit(Key::Escape)); Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 14, 2014 Author Share Posted September 14, 2014 what should I place as the comment? it also says sandbox is disabled even though it is enabled.. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 14, 2014 Share Posted September 14, 2014 Commenting code means putting two slashes before the code, so that it is ignored during compiling. //if (window->KeyHit(Key::Escape)); Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 14, 2014 Author Share Posted September 14, 2014 still won't bring it up in leadwerks.. is there any other method because I even built both too in visual studio Quote Link to comment Share on other sites More sharing options...
shadmar Posted September 14, 2014 Share Posted September 14, 2014 You run window-> Create () twice. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
metaldc4life Posted September 14, 2014 Author Share Posted September 14, 2014 what do you mean? sorry i'm new at this just started yesterday on c++.. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 14, 2014 Share Posted September 14, 2014 Like shadmar said, you are create two windows. Remove this line: //Create a window window = Leadwerks::Window::Create("hi?"); Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 14, 2014 Author Share Posted September 14, 2014 oh ok I fixed that part.. but how do I get it running with the remaining script? Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 14, 2014 Author Share Posted September 14, 2014 the weird part is that it says this in leadwerks: Lua sandboxing disabled. even when it is enabled it still says this and vice-versa.. Quote Link to comment Share on other sites More sharing options...
metaldc4life Posted September 14, 2014 Author Share Posted September 14, 2014 got it! thanks! Quote 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.