From 194f70c48c044e79fe3c0cb6d9f472f223b0a36c Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 12 Aug 2014 20:33:40 +0200 Subject: [PATCH] SharedState: Constify most getter methods --- src/sharedstate.cpp | 4 ++-- src/sharedstate.h | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index f85a835..3d92dba 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -208,7 +208,7 @@ void SharedState::setScreen(Scene &screen) } #define GSATT(type, lower) \ - type SharedState :: lower() \ + type SharedState :: lower() const \ { \ return p->lower; \ } @@ -330,7 +330,7 @@ void SharedState::checkShutdown() scriptBinding->terminate(); } -Font &SharedState::defaultFont() +Font &SharedState::defaultFont() const { return *p->defaultFont; } diff --git a/src/sharedstate.h b/src/sharedstate.h index ce787fa..dd30e8c 100644 --- a/src/sharedstate.h +++ b/src/sharedstate.h @@ -55,35 +55,35 @@ struct SharedMidiState; struct SharedState { - void *bindingData(); + void *bindingData() const; void setBindingData(void *data); - SDL_Window *sdlWindow(); + SDL_Window *sdlWindow() const; - Scene *screen(); + Scene *screen() const; void setScreen(Scene &screen); - FileSystem &fileSystem(); + FileSystem &fileSystem() const; - EventThread &eThread(); - RGSSThreadData &rtData(); - Config &config(); + EventThread &eThread() const; + RGSSThreadData &rtData() const; + Config &config() const; - Graphics &graphics(); - Input &input(); - Audio &audio(); + Graphics &graphics() const; + Input &input() const; + Audio &audio() const; - GLState &_glState(); + GLState &_glState() const; - ShaderSet &shaders(); + ShaderSet &shaders() const; - TexPool &texPool(); + TexPool &texPool() const; - SharedFontState &fontState(); - Font &defaultFont(); + SharedFontState &fontState() const; + Font &defaultFont() const; #ifdef MIDI - SharedMidiState &midiState(); + SharedMidiState &midiState() const; #endif sigc::signal prepareDraw; @@ -101,7 +101,7 @@ struct SharedState TEXFBO &gpTexFBO(int minW, int minH); - Quad &gpQuad(); + Quad &gpQuad() const; /* Basically just a simple "TexPool" * replacement for Tilemap atlas use */