I am trying to create a new class that encapsulates the default creation of a window, context and world. However as soon as I try to add a camera, the program no longer works.
So the app.cpp looks like this:
bool App::Start()
{
game = new Game();
return true;
}
bool App::Loop()
{
game->Update();
return true;
}
The game.cpp looks like this (some code is removed to keep it clean):
Game::Game()
{
//Create a window
window = Leadwerks::Window::Create("Test 3");
//Create a context
context = Leadwerks::Context::Create(window);
//Create a world
world = Leadwerks::World::Create();
//Create a camera
//cam = Leadwerks::Camera::Create();
}
void Game::Update()
{
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync(false);
}
The program works, but as soon as I add a camera (removing the comments), the program crashes.