Implementing the window class
Now that we have our blueprint, let's begin actually building our window class. The entry and exit points seem as good a place as any to start with:
Window::Window(){ Setup("Window", sf::Vector2u(640,480)); } Window::Window(const std::string& l_title, const sf::Vector2u& l_size) { Setup(l_title,l_size); } Window::~Window(){ Destroy(); }
Both implementations of the constructor and destructor simply utilize the helper methods which we'll be implementing shortly. There's also a default constructor that takes no arguments and initializes some pre-set default values, which is not necessary, but it's convenient. With that said, let's take a look at the setup method:
void Window::Setup(const std::string l_title, const sf::Vector2u& l_size) { m_windowTitle = l_title; m_windowSize = l_size; m_isFullscreen = false; m_isDone = false; Create(); }
Once again, this is quite simple. As mentioned before, it initializes and keeps track of some...