SOLUTION: The Camera class was not initializing its position variables, x_ and y_, so when the Manager class was instantiated it caused garbage from the stack to be pushed into those variables and offset the camera by a wild amount.
I'm in the process of setting up a basic framework in SDL and I've encountered a very strange problem. I'm building and displaying a tile map made up of chunks, and everything was displaying just fine. Then I added a GameManager class, and all of the sudden nothing displays on the screen anymore. First, I started pulling things out of the class to see when the display came back, but it never did. I got down to just a bare class with a single empty constructor and no dependencies being included. The display still didn't come back. The input still works fine, and the render methods are all still being called, but nothing shows up on the screen anymore. I got frustrated enough, that I actually just deleted the GameManager class and recreated a blank class from scratch to see if it caused the same problem and it did. The second I instantiate an object of the class, I suddenly lose the display. The weirdest part is that it still occurs even if the instantiation is put off until after the whole game loop runs.
Here is the full project for reference: https://github.com/kabbotta/last-ditch-cpp
In my main.cpp:
Game game;
game.init();
while (game.is_running())
{
game.update();
}
game.cleanup();
// Problem class
Manager mgr;
As you can see, I've moved the Manager instantiation after the entire game loop runs, quits, and cleans up. But it still causes the display to disappear. This is all that is left in Manager:
#ifndef MANAGER_H
#define MANAGER_H
class Manager
{
public:
Manager() {}
};
#endif /* MANAGER_H */