Constified many Graphics and Window methods

This commit is contained in:
Alex Szpakowski
2013-02-16 01:45:01 -04:00
parent eba8cbc0b5
commit a68bdfe7a2
5 changed files with 67 additions and 67 deletions
+9 -9
View File
@@ -45,27 +45,27 @@ public:
virtual ~Window();
virtual bool setWindow(int width = 800, int height = 600, bool fullscreen = false, bool vsync = true, int fsaa = 0) = 0;
virtual void getWindow(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa) = 0;
virtual void getWindow(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa) const = 0;
virtual bool checkWindowSize(int width, int height, bool fullscreen) = 0;
virtual WindowSize **getFullscreenSizes(int &n) = 0;
virtual bool checkWindowSize(int width, int height, bool fullscreen) const = 0;
virtual WindowSize **getFullscreenSizes(int &n) const = 0;
virtual int getWidth() = 0;
virtual int getHeight() = 0;
virtual int getWidth() const = 0;
virtual int getHeight() const = 0;
virtual bool isCreated() = 0;
virtual bool isCreated() const = 0;
virtual void setWindowTitle(std::string &title) = 0;
virtual std::string getWindowTitle() = 0;
virtual std::string getWindowTitle() const = 0;
virtual bool setIcon(love::image::ImageData *imgd) = 0;
// default no-op implementation
virtual void swapBuffers();
virtual bool hasFocus() = 0;
virtual bool hasFocus() const = 0;
virtual void setMouseVisible(bool visible) = 0;
virtual bool getMouseVisible() = 0;
virtual bool getMouseVisible() const = 0;
//virtual static Window *getSingleton() = 0;
// No virtual statics, of course, but you are supposed to implement this static.
+9 -9
View File
@@ -157,7 +157,7 @@ bool Window::setWindow(int width, int height, bool fullscreen, bool vsync, int f
return true;
}
void Window::getWindow(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa)
void Window::getWindow(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa) const
{
width = currentMode.width;
height = currentMode.height;
@@ -166,7 +166,7 @@ void Window::getWindow(int &width, int &height, bool &fullscreen, bool &vsync, i
fsaa = currentMode.fsaa;
}
bool Window::checkWindowSize(int width, int height, bool fullscreen)
bool Window::checkWindowSize(int width, int height, bool fullscreen) const
{
Uint32 sdlflags = fullscreen ? (SDL_OPENGL | SDL_FULLSCREEN) : SDL_OPENGL;
@@ -178,7 +178,7 @@ bool Window::checkWindowSize(int width, int height, bool fullscreen)
typedef Window::WindowSize WindowSize;
WindowSize **Window::getFullscreenSizes(int &n)
WindowSize **Window::getFullscreenSizes(int &n) const
{
SDL_Rect **modes = SDL_ListModes(0, SDL_OPENGL | SDL_FULLSCREEN);
@@ -203,17 +203,17 @@ WindowSize **Window::getFullscreenSizes(int &n)
return sizes;
}
int Window::getWidth()
int Window::getWidth() const
{
return currentMode.width;
}
int Window::getHeight()
int Window::getHeight() const
{
return currentMode.height;
}
bool Window::isCreated()
bool Window::isCreated() const
{
return created;
}
@@ -224,7 +224,7 @@ void Window::setWindowTitle(std::string &title)
SDL_WM_SetCaption(windowTitle.c_str(), 0);
}
std::string Window::getWindowTitle()
std::string Window::getWindowTitle() const
{
// not a reference
// because we want this untouched
@@ -262,7 +262,7 @@ void Window::swapBuffers()
SDL_GL_SwapBuffers();
}
bool Window::hasFocus()
bool Window::hasFocus() const
{
return (SDL_GetAppState() & SDL_APPINPUTFOCUS) != 0;
}
@@ -272,7 +272,7 @@ void Window::setMouseVisible(bool visible)
SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE);
}
bool Window::getMouseVisible()
bool Window::getMouseVisible() const
{
return (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE) ? true : false;
}
+9 -9
View File
@@ -38,26 +38,26 @@ public:
~Window();
bool setWindow(int width = 800, int height = 600, bool fullscreen = false, bool vsync = true, int fsaa = 0);
void getWindow(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa);
void getWindow(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa) const;
bool checkWindowSize(int width, int height, bool fullscreen);
WindowSize **getFullscreenSizes(int &n);
bool checkWindowSize(int width, int height, bool fullscreen) const;
WindowSize **getFullscreenSizes(int &n) const;
int getWidth();
int getHeight();
int getWidth() const;
int getHeight() const;
bool isCreated();
bool isCreated() const;
void setWindowTitle(std::string &title);
std::string getWindowTitle();
std::string getWindowTitle() const;
bool setIcon(love::image::ImageData *imgd);
void swapBuffers();
bool hasFocus();
bool hasFocus() const;
void setMouseVisible(bool visible);
bool getMouseVisible();
bool getMouseVisible() const;
static love::window::Window *getSingleton();