Make window handle private with getter

This commit is contained in:
Bailey Harrison 2022-10-05 17:01:40 +01:00
parent 45a4db4dcf
commit c2ec967a89
3 changed files with 10 additions and 4 deletions

View File

@ -27,6 +27,8 @@ namespace engine {
Window& operator=(const Window&) = delete;
~Window();
SDL_Window* getHandle() const;
// Return the title name
std::string getTitle() const;
@ -129,11 +131,10 @@ namespace engine {
/* STATIC METHODS */
static void errorBox(const std::string& message);
public:
SDL_Window* m_handle;
private:
SDL_Window* m_handle;
bool m_shouldClose = false;
std::string m_title;

View File

@ -8,7 +8,7 @@ namespace engine {
Application::Application(const char* appName, const char* appVersion)
{
m_win = std::make_unique<Window>(appName);
m_gfx = std::make_unique<GFXDevice>(appName, appVersion, m_win->m_handle);
m_gfx = std::make_unique<GFXDevice>(appName, appVersion, m_win->getHandle());
}
Application::~Application()

View File

@ -179,6 +179,11 @@ namespace engine {
// public methods
SDL_Window* Window::getHandle() const
{
return m_handle;
}
std::string Window::getTitle() const
{
return m_title;