I am also getting an access violation when using the ->SetPosition/Fov commands in C++. Code in question(Posting the entire App::Start for completeness' sake) :
bool App::Start()
{
//Perform cfg checks. Sets screenres to 1920x1080 if they throw an error
try {
ScreenWidth = stoi(System::GetProperty("Screen Width", "1920"));
ScreenHeight = stoi(System::GetProperty("Screen Height", "1080"));
} catch (std::invalid_argument) {std::cout << "\n\nWaiter!!! There was a string in my Screen Res!\n\n";}
//Initialize Steamworks (optional)
if (!Steamworks::Initialize())
{
System::Print("Error: Failed to initialize Steam.");
return false;
}
//Create a window
window = Leadwerks::Window::Create("Game Window",0,0,ScreenWidth,ScreenHeight,Window::Titlebar);
//Create a context
context = Context::Create(window);
//Create a world
world = World::Create();
std::string mapname = System::GetProperty("map","Maps/G.map");
Map::Load(mapname);
//The culprits are right here----->
//cam->SetPosition(0, 5, 0);
//cam->SetFOV(90);
//Move the mouse to the center of the screen
window->SetMousePosition(context->GetWidth()/2,context->GetHeight()/2);
window->HideMouse();
return true;
}
I have tried debuging multiple times, and it always throws an access violation when those 2 lines are uncommented. It works perfectly fine if I just create a camera through the editor though, so I have no clue what is going on.
EDIT: Apparently my problem was I forgot to call Camera::Create on cam....... I am an idiot. ಠ_ಠ