diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eb3992e..b86f4eda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,12 +55,13 @@ SET(SOURCES # framework sources src/framework/framebuffer.cpp + src/framework/font.cpp src/framework/fonts.cpp src/framework/textureloader.cpp src/framework/texture.cpp - src/framework/texturemanager.cpp - src/framework/configmanager.cpp - src/framework/resourcemanager.cpp + src/framework/textures.cpp + src/framework/configs.cpp + src/framework/resources.cpp src/framework/engine.cpp src/framework/graphics.cpp src/framework/logger.cpp diff --git a/src/framework/configmanager.cpp b/src/framework/configs.cpp similarity index 80% rename from src/framework/configmanager.cpp rename to src/framework/configs.cpp index 2bcc1ee4..6e679ce4 100644 --- a/src/framework/configmanager.cpp +++ b/src/framework/configs.cpp @@ -22,24 +22,14 @@ */ -#include "configmanager.h" -#include "resourcemanager.h" +#include "configs.h" +#include "resources.h" #include -ConfigManager g_config; +Configs g_config; -ConfigManager::ConfigManager() -{ - -} - -ConfigManager::~ConfigManager() -{ - -} - -bool ConfigManager::load(const std::string& fileName) +bool Configs::load(const std::string& fileName) { m_fileName = fileName; @@ -72,7 +62,7 @@ bool ConfigManager::load(const std::string& fileName) return true; } -void ConfigManager::save() +void Configs::save() { if(!m_fileName.empty()) { YAML::Emitter out; @@ -81,27 +71,27 @@ void ConfigManager::save() } } -void ConfigManager::setValue(const std::string &key, const std::string &value) +void Configs::setValue(const std::string &key, const std::string &value) { m_confsMap[key] = value; } -void ConfigManager::setValue(const std::string &key, const char *value) +void Configs::setValue(const std::string &key, const char *value) { m_confsMap[key] = value; } -void ConfigManager::setValue(const std::string &key, int value) +void Configs::setValue(const std::string &key, int value) { setValue(key, convertType(value)); } -void ConfigManager::setValue(const std::string &key, float value) +void Configs::setValue(const std::string &key, float value) { setValue(key, convertType(value)); } -void ConfigManager::setValue(const std::string &key, bool value) +void Configs::setValue(const std::string &key, bool value) { if(value) setValue(key,"true"); @@ -109,7 +99,7 @@ void ConfigManager::setValue(const std::string &key, bool value) setValue(key,"false"); } -const std::string &ConfigManager::getString(const std::string &key) +const std::string &Configs::getString(const std::string &key) { auto iter = m_confsMap.find(key); if(iter == m_confsMap.end()) { @@ -120,7 +110,7 @@ const std::string &ConfigManager::getString(const std::string &key) return iter->second; } -float ConfigManager::getFloat(const std::string &key) +float Configs::getFloat(const std::string &key) { auto iter = m_confsMap.find(key); if(iter == m_confsMap.end()) { @@ -130,7 +120,7 @@ float ConfigManager::getFloat(const std::string &key) return convertType(iter->second); } -bool ConfigManager::getBoolean(const std::string &key) +bool Configs::getBoolean(const std::string &key) { auto iter = m_confsMap.find(key); if(iter == m_confsMap.end()) { @@ -140,7 +130,7 @@ bool ConfigManager::getBoolean(const std::string &key) return (iter->second == "true"); } -int ConfigManager::getInteger(const std::string &key) +int Configs::getInteger(const std::string &key) { auto iter = m_confsMap.find(key); if(iter == m_confsMap.end()) { diff --git a/src/framework/configmanager.h b/src/framework/configs.h similarity index 92% rename from src/framework/configmanager.h rename to src/framework/configs.h index d948cb8f..6bf33a10 100644 --- a/src/framework/configmanager.h +++ b/src/framework/configs.h @@ -22,16 +22,15 @@ */ -#ifndef CONFIGMANAGER_H -#define CONFIGMANAGER_H +#ifndef CONFIGS_H +#define CONFIGS_H #include "prerequisites.h" -class ConfigManager +class Configs { public: - ConfigManager(); - ~ConfigManager(); + Configs() { } /// Read configuration file and parse all settings to memory bool load(const std::string& fileName); @@ -55,6 +54,6 @@ private: std::map m_confsMap; }; -extern ConfigManager g_config; +extern Configs g_config; -#endif // CONFIGMANAGER_H +#endif // CONFIGS_H diff --git a/src/framework/engine.cpp b/src/framework/engine.cpp index aeec5c62..f562f8d3 100644 --- a/src/framework/engine.cpp +++ b/src/framework/engine.cpp @@ -27,29 +27,16 @@ #include "platform.h" #include "graphics.h" #include "input.h" -#include "configmanager.h" +#include "configs.h" #include "gamestate.h" Engine g_engine; -Engine::Engine() : - m_stopping(false), - m_running(false), - m_currentState(NULL) -{ -} - -Engine::~Engine() -{ -} - void Engine::init() { - // initialize graphics stuff + // initialize stuff g_graphics.init(); - - // load fonts - g_fonts.load(); + g_fonts.init(); // finally show the window onResize(Platform::getWindowWidth(), Platform::getWindowHeight()); @@ -57,8 +44,11 @@ void Engine::init() void Engine::terminate() { + // force last state exit changeState(NULL); + // terminate stuff + g_fonts.terminate(); g_graphics.terminate(); } diff --git a/src/framework/engine.h b/src/framework/engine.h index 3df249a0..14a7a90e 100644 --- a/src/framework/engine.h +++ b/src/framework/engine.h @@ -34,8 +34,9 @@ class GameState; class Engine { public: - Engine(); - ~Engine(); + Engine() : m_stopping(false), + m_running(false), + m_currentState(NULL) { } void init(); void terminate(); diff --git a/src/framework/font.cpp b/src/framework/font.cpp new file mode 100644 index 00000000..188373e7 --- /dev/null +++ b/src/framework/font.cpp @@ -0,0 +1,30 @@ +/* The MIT License + * + * Copyright (c) 2010 OTClient, https://github.com/edubart/otclient + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + +#include "font.h" + +bool Font::load(const std::string& file) +{ + return false; +} diff --git a/src/framework/font.h b/src/framework/font.h new file mode 100644 index 00000000..8cb26892 --- /dev/null +++ b/src/framework/font.h @@ -0,0 +1,47 @@ +/* The MIT License + * + * Copyright (c) 2010 OTClient, https://github.com/edubart/otclient + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + +#ifndef FONT_H +#define FONT_H + +#include "prerequisites.h" + +class Font +{ +public: + Font() { } + virtual ~Font() { } + + /// Load font from file + bool load(const std::string &file); + + std::string& getName() { return m_name; } + +private: + std::string m_name; +}; + +typedef std::shared_ptr FontPtr; + +#endif // FONT_H diff --git a/src/framework/fonts.cpp b/src/framework/fonts.cpp index e78fd27a..387af43d 100644 --- a/src/framework/fonts.cpp +++ b/src/framework/fonts.cpp @@ -1,22 +1,49 @@ +/* The MIT License + * + * Copyright (c) 2010 OTClient, https://github.com/edubart/otclient + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + #include "fonts.h" -#include "resourcemanager.h" +#include "font.h" +#include "resources.h" Fonts g_fonts; -Fonts::Fonts() -{ -} - -Fonts::~Fonts() -{ -} - -bool Fonts::load() +void Fonts::init() { std::list files = g_resources.getDirectoryFiles("fonts"); - for(auto it = files.begin(); it != files.end(); ++it) { - notice("File: %s", (*it).c_str()); + foreach(const std::string& file, files) { + if(boost::ends_with(file, ".yml")) { + std::shared_ptr font(new Font); + font->load(file); + m_fonts[font->getName()] = font; + } } - - return true; +} + +Font* Fonts::get(const std::string& fontName) +{ + auto it = m_fonts.find(fontName); + if(it != m_fonts.end()) + return it->second.get(); + return NULL; } diff --git a/src/framework/fonts.h b/src/framework/fonts.h index f68cd1c4..c233d21f 100644 --- a/src/framework/fonts.h +++ b/src/framework/fonts.h @@ -1,25 +1,49 @@ +/* The MIT License + * + * Copyright (c) 2010 OTClient, https://github.com/edubart/otclient + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + #ifndef FONTS_H #define FONTS_H #include "prerequisites.h" -#include "rect.h" - -struct Font -{ - - Rect textureArea[256]; -}; +#include "font.h" class Fonts { public: - Fonts(); - ~Fonts(); + Fonts() { } - bool load(); + /// Initialize all fonts + void init(); + + /// Get a font by name + Font *get(const std::string& fontName); + + /// Terminate all fonts + void terminate() { } private: - std::map mFonts; + std::map > m_fonts; }; extern Fonts g_fonts; diff --git a/src/framework/graphics.cpp b/src/framework/graphics.cpp index 4805a4ae..42f14558 100644 --- a/src/framework/graphics.cpp +++ b/src/framework/graphics.cpp @@ -32,16 +32,6 @@ Graphics g_graphics; -Graphics::Graphics() -{ - -} - -Graphics::~Graphics() -{ - -} - void Graphics::init() { // setup opengl diff --git a/src/framework/graphics.h b/src/framework/graphics.h index 0b8a7319..fafa5f40 100644 --- a/src/framework/graphics.h +++ b/src/framework/graphics.h @@ -35,8 +35,7 @@ class Texture; class Graphics { public: - Graphics(); - ~Graphics(); + Graphics() { } void init(); void terminate(); diff --git a/src/framework/logger.cpp b/src/framework/logger.cpp index 6188e826..a5ce6309 100644 --- a/src/framework/logger.cpp +++ b/src/framework/logger.cpp @@ -23,6 +23,10 @@ #include "logger.h" +#include "util.h" + +#include +#include void Logger::log(int level, const char *trace, const char *format, ...) { diff --git a/src/framework/logger.h b/src/framework/logger.h index e5f2bd2c..3248ec60 100644 --- a/src/framework/logger.h +++ b/src/framework/logger.h @@ -25,7 +25,7 @@ #ifndef LOGGER_H #define LOGGER_H -#include "prerequisites.h" +#include namespace Logger { diff --git a/src/framework/prerequisites.h b/src/framework/prerequisites.h index 9aec6dd9..b04dd614 100644 --- a/src/framework/prerequisites.h +++ b/src/framework/prerequisites.h @@ -42,7 +42,6 @@ typedef int8_t int8; #include #include #include -#include #include #include #include @@ -63,6 +62,8 @@ typedef int8_t int8; // boost utilities #include #include +#include +#define foreach BOOST_FOREACH // internal logger #include "logger.h" diff --git a/src/framework/resourcemanager.cpp b/src/framework/resources.cpp similarity index 77% rename from src/framework/resourcemanager.cpp rename to src/framework/resources.cpp index c239adbb..4e8589ac 100644 --- a/src/framework/resourcemanager.cpp +++ b/src/framework/resources.cpp @@ -22,33 +22,23 @@ */ -#include "resourcemanager.h" +#include "resources.h" #include -ResourceManager g_resources; +Resources g_resources; -ResourceManager::ResourceManager() -{ - -} - -ResourceManager::~ResourceManager() -{ - -} - -void ResourceManager::init(const char *argv0) +void Resources::init(const char *argv0) { PHYSFS_init(argv0); } -void ResourceManager::terminate() +void Resources::terminate() { PHYSFS_deinit(); } -bool ResourceManager::setWriteDir(const std::string& path) +bool Resources::setWriteDir(const std::string& path) { bool ret = (bool)PHYSFS_setWriteDir(path.c_str()); @@ -57,7 +47,7 @@ bool ResourceManager::setWriteDir(const std::string& path) return ret; } -bool ResourceManager::addToSearchPath(const std::string& path, bool insertInFront /*= true*/) +bool Resources::addToSearchPath(const std::string& path, bool insertInFront /*= true*/) { if(!PHYSFS_addToSearchPath(path.c_str(), insertInFront ? 0 : 1)) { error("Error while adding \"%s\" to resources search path: %s", path.c_str(), PHYSFS_getLastError()); @@ -66,12 +56,12 @@ bool ResourceManager::addToSearchPath(const std::string& path, bool insertInFron return true; } -bool ResourceManager::fileExists(const std::string& filePath) +bool Resources::fileExists(const std::string& filePath) { return PHYSFS_exists(filePath.c_str()); } -unsigned char *ResourceManager::loadFile(const std::string& fileName, unsigned int *fileSize) +unsigned char *Resources::loadFile(const std::string& fileName, unsigned int *fileSize) { PHYSFS_file *file = PHYSFS_openRead(fileName.c_str()); if(!file) { @@ -88,7 +78,7 @@ unsigned char *ResourceManager::loadFile(const std::string& fileName, unsigned i return buffer; } -std::string ResourceManager::loadTextFile(const std::string& fileName) +std::string Resources::loadTextFile(const std::string& fileName) { std::string text; unsigned int fileSize; @@ -100,7 +90,7 @@ std::string ResourceManager::loadTextFile(const std::string& fileName) return text; } -bool ResourceManager::saveFile(const std::string &fileName, const unsigned char *data, unsigned int size) +bool Resources::saveFile(const std::string &fileName, const unsigned char *data, unsigned int size) { PHYSFS_file *file = PHYSFS_openWrite(fileName.c_str()); if(!file) { @@ -113,12 +103,12 @@ bool ResourceManager::saveFile(const std::string &fileName, const unsigned char return true; } -bool ResourceManager::saveTextFile(const std::string &fileName, std::string text) +bool Resources::saveTextFile(const std::string &fileName, std::string text) { return saveFile(fileName, (const unsigned char*)text.c_str(), text.size()); } -std::list ResourceManager::getDirectoryFiles(const std::string& directory) +std::list Resources::getDirectoryFiles(const std::string& directory) { std::list files; char **rc = PHYSFS_enumerateFiles(directory.c_str()); diff --git a/src/framework/resourcemanager.h b/src/framework/resources.h similarity index 93% rename from src/framework/resourcemanager.h rename to src/framework/resources.h index 66f43a17..061c4440 100644 --- a/src/framework/resourcemanager.h +++ b/src/framework/resources.h @@ -22,16 +22,15 @@ */ -#ifndef RESOURCEMANAGER_H -#define RESOURCEMANAGER_H +#ifndef RESOURCES_H +#define RESOURCES_H #include "prerequisites.h" -class ResourceManager +class Resources { public: - ResourceManager(); - ~ResourceManager(); + Resources() { } void init(const char *argv0); void terminate(); @@ -68,6 +67,6 @@ public: std::list getDirectoryFiles(const std::string& directory); }; -extern ResourceManager g_resources; +extern Resources g_resources; -#endif // RESOURCEMANAGER_H +#endif // RESOURCES_H diff --git a/src/framework/texture.h b/src/framework/texture.h index 1bd35b0c..c88cf2cb 100644 --- a/src/framework/texture.h +++ b/src/framework/texture.h @@ -28,7 +28,7 @@ #include "prerequisites.h" #include "size.h" -class TextureManager; +class Textures; class Texture { diff --git a/src/framework/texturemanager.cpp b/src/framework/textures.cpp similarity index 89% rename from src/framework/texturemanager.cpp rename to src/framework/textures.cpp index 90a6f6fa..cb911706 100644 --- a/src/framework/texturemanager.cpp +++ b/src/framework/textures.cpp @@ -22,23 +22,13 @@ */ -#include "texturemanager.h" -#include "resourcemanager.h" +#include "textures.h" +#include "resources.h" #include "textureloader.h" -TextureManager g_textures; +Textures g_textures; -TextureManager::TextureManager() -{ - -} - -TextureManager::~TextureManager() -{ - m_texturesMap.clear(); -} - -TexturePtr TextureManager::get(const std::string& textureFile) +TexturePtr Textures::get(const std::string& textureFile) { TexturePtr texture; diff --git a/src/framework/textures.h b/src/framework/textures.h new file mode 100644 index 00000000..e16991b4 --- /dev/null +++ b/src/framework/textures.h @@ -0,0 +1,48 @@ +/* The MIT License + * + * Copyright (c) 2010 OTClient, https://github.com/edubart/otclient + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + +#ifndef TEXTURES_H +#define TEXTURES_H + +#include "prerequisites.h" +#include "texture.h" + +typedef std::weak_ptr TextureWeakPtr; + +class Textures +{ +public: + Textures() { } + + /// Load a texture from file, if it was already loaded it will be retrieved from cache + TexturePtr get(const std::string& textureFile); + +private: + typedef std::map TexturesMap; + TexturesMap m_texturesMap; +}; + +extern Textures g_textures; + +#endif // TEXTURES_H diff --git a/src/framework/util.cpp b/src/framework/util.cpp index f0efadd2..727b80fa 100644 --- a/src/framework/util.cpp +++ b/src/framework/util.cpp @@ -24,6 +24,8 @@ #include "util.h" +#include + std::string vformat(const char *format, va_list args) { if(!format) diff --git a/src/framework/util.h b/src/framework/util.h index b0fffdf7..403dace0 100644 --- a/src/framework/util.h +++ b/src/framework/util.h @@ -25,7 +25,8 @@ #ifndef UTIL_H #define UTIL_H -#include "prerequisites.h" +#include "logger.h" +#include /// Formatting like printf for std::string, va_list input version std::string vformat(const char *format, va_list args); @@ -34,20 +35,16 @@ std::string vformat(const char *format, va_list args); std::string format(const char *format, ...); /// Convert any data type through boost::lexical_cast -//TODO: move declatation to util.cpp template R convertType(T t) { - R r = R(); - - try{ - r = boost::lexical_cast(t); + R ret = R(); + try { + ret = boost::lexical_cast(t); + } catch(boost::bad_lexical_cast bad) { + error("Error converting type: %s", bad.what()); } - catch(boost::bad_lexical_cast bad){ - //TODO: add an error message - } - - return r; + return ret; } #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 9109a701..65acfafe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,8 +23,8 @@ #include "framework/engine.h" -#include "framework/configmanager.h" -#include "framework/resourcemanager.h" +#include "framework/configs.h" +#include "framework/resources.h" #include "framework/platform.h" #include "menustate.h" @@ -108,7 +108,7 @@ int main(int argc, const char *argv[]) // state scope { - std::unique_ptr menuState(new MenuState()); + std::shared_ptr menuState(new MenuState()); g_engine.changeState(menuState.get()); Platform::showWindow(); diff --git a/src/menustate.cpp b/src/menustate.cpp index 21304a99..ff255580 100644 --- a/src/menustate.cpp +++ b/src/menustate.cpp @@ -25,23 +25,13 @@ #include "menustate.h" #include "framework/framebuffer.h" #include "framework/graphics.h" -#include "framework/texturemanager.h" +#include "framework/textures.h" #include "framework/logger.h" #include "framework/engine.h" #include "framework/rect.h" TexturePtr background; -MenuState::MenuState() -{ - -} - -MenuState::~MenuState() -{ - -} - void MenuState::onEnter() { m_background = g_textures.get("background.png"); diff --git a/src/menustate.h b/src/menustate.h index 7923fffd..033f5cf3 100644 --- a/src/menustate.h +++ b/src/menustate.h @@ -32,8 +32,7 @@ class MenuState : public GameState { public: - MenuState(); - virtual ~MenuState(); + MenuState() { } virtual void onEnter(); virtual void onLeave();