Graduating to ravioli
Let's start small. Every game needs to have a window, and as you already know from Chapter 1, It's Alive! It's Alive! – Setup and First Program, it needs to be created, destroyed, and its events need to be processed. It also needs to be able to clear the screen and update itself to show anything drawn after the screen was cleared. Additionally, keeping track of whether the window is being closed and if it's in full-screen mode, as well as having a method to toggle the latter would be quite useful. Lastly, we will, of course, need to draw to the window. Knowing all of that, the header of our window class will predictably look something like this:
class Window{ public: Window(); Window(const std::string& l_title,const sf::Vector2u& l_size); ~Window(); void BeginDraw(); // Clear the window. void EndDraw(); // Display the changes. void Update(); bool IsDone(); bool IsFullscreen(); sf::Vector2u GetWindowSize(); void ToggleFullscreen...