Jump to content

can't seem to run my map with my c++ script or in game..


Recommended Posts

Posted

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;

}

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...