I’m at the end of section 3 of my online course, and I’ve learned so much! I’ll be honest, since Java and C++ are both object oriented languages, I feel that it has been a pretty smooth transition so far.
While not part of the course, I noticed when showing some friends my game, it didn’t look right on their screen. The problem was that the game is coded for a single screen size, and if they have a smaller screen, it doesn’t display properly. Some things are off the screen, or off center.
So, I remembered an old Android trick for similar issues, and started implementing it here. Rather than setting static sizes throughout the game, I set my code up like so:
int sWidth = 1024;
int sHeight = 786;
sf::RenderWindow window(sf::VideoMode(sWidth, sHeight), “Timber!”);
By making the objects variants of sWidth and sHeight, I can later poll the screen size and set the graphics to match. At least that is the plan. Right now I am just doing it manually, but rather than adjusting every line of code, I am just changing the sWidth/sHeigth lines.
You can check out the full commit, including adding text and time bars at my GitLab.
Linux – keep it simple.