From d29b13932133f8377c86296c82861242a5b7afdb Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sat, 2 Apr 2011 18:02:39 -0300 Subject: [PATCH] use C++0x, change prerequisites headers --- src/framework/fonts.cpp | 4 ++-- src/framework/framebuffer.cpp | 4 ++++ src/framework/framebuffer.h | 4 ++-- src/framework/graphics.cpp | 4 ++++ src/framework/prerequisites.h | 22 +++------------------- src/framework/texture.cpp | 3 +++ src/framework/texture.h | 6 +++--- src/framework/texturemanager.h | 2 +- src/framework/win32platform.cpp | 3 +++ src/main.cpp | 2 +- 10 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/framework/fonts.cpp b/src/framework/fonts.cpp index 20b652f0..e78fd27a 100644 --- a/src/framework/fonts.cpp +++ b/src/framework/fonts.cpp @@ -14,8 +14,8 @@ Fonts::~Fonts() bool Fonts::load() { std::list files = g_resources.getDirectoryFiles("fonts"); - foreach(const std::string& file, files) { - notice("File: %s", file.c_str()); + for(auto it = files.begin(); it != files.end(); ++it) { + notice("File: %s", (*it).c_str()); } return true; diff --git a/src/framework/framebuffer.cpp b/src/framework/framebuffer.cpp index 8dbf3c35..9cc17732 100644 --- a/src/framework/framebuffer.cpp +++ b/src/framework/framebuffer.cpp @@ -25,6 +25,10 @@ #include "platform.h" #include "graphics.h" +#include +#include +#include + PFNGLGENFRAMEBUFFERSPROC oglGenFramebuffers = 0; PFNGLBINDFRAMEBUFFERPROC oglBindFramebuffer = 0; PFNGLFRAMEBUFFERTEXTURE2DPROC oglFramebufferTexture2D = 0; diff --git a/src/framework/framebuffer.h b/src/framework/framebuffer.h index d63347db..061218f8 100644 --- a/src/framework/framebuffer.h +++ b/src/framework/framebuffer.h @@ -43,8 +43,8 @@ public: void draw(int x, int y, int width, int height); private: - GLuint m_fboTexture; - GLuint m_fbo; + unsigned int m_fboTexture; + unsigned int m_fbo; bool m_fallbackOldImp; int m_width; int m_height; diff --git a/src/framework/graphics.cpp b/src/framework/graphics.cpp index d1acd2a5..ccfde3bf 100644 --- a/src/framework/graphics.cpp +++ b/src/framework/graphics.cpp @@ -26,6 +26,10 @@ #include "logger.h" #include "texture.h" +#include +#include +#include + Graphics g_graphics; Graphics::Graphics() diff --git a/src/framework/prerequisites.h b/src/framework/prerequisites.h index f20377dd..9aec6dd9 100644 --- a/src/framework/prerequisites.h +++ b/src/framework/prerequisites.h @@ -27,12 +27,10 @@ // easy typing #include - typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; - typedef uint32_t uint32; typedef uint16_t uint16; typedef uint8_t uint8; @@ -60,30 +58,16 @@ typedef int8_t int8; #include #include #include -#include +#include -// additional string algorithms +// boost utilities #include - -// easy casting #include -// smart pointers -#include - -// foreach -#include -#define foreach BOOST_FOREACH - -// GL stuff -#include -#include -#include - // internal logger #include "logger.h" // additional utilities #include "util.h" -#endif // PREREQUISITES_H \ No newline at end of file +#endif // PREREQUISITES_H diff --git a/src/framework/texture.cpp b/src/framework/texture.cpp index bea89d43..64d85c95 100644 --- a/src/framework/texture.cpp +++ b/src/framework/texture.cpp @@ -24,6 +24,9 @@ #include "texture.h" +#include +#include + Texture::Texture(int width, int height, int components, unsigned char *pixels) { m_size.setWidth(width); diff --git a/src/framework/texture.h b/src/framework/texture.h index e8720f9b..1bd35b0c 100644 --- a/src/framework/texture.h +++ b/src/framework/texture.h @@ -41,13 +41,13 @@ public: void enableBilinearFilter(); const Size& getSize() const { return m_size; } - GLuint getTextureId() const { return m_textureId; } + unsigned int getTextureId() const { return m_textureId; } private: - GLuint m_textureId; + unsigned int m_textureId; Size m_size; }; -typedef boost::shared_ptr TexturePtr; +typedef std::shared_ptr TexturePtr; #endif // TEXTURE_H diff --git a/src/framework/texturemanager.h b/src/framework/texturemanager.h index 19d8a829..8b64f362 100644 --- a/src/framework/texturemanager.h +++ b/src/framework/texturemanager.h @@ -28,7 +28,7 @@ #include "prerequisites.h" #include "texture.h" -typedef boost::weak_ptr TextureWeakPtr; +typedef std::weak_ptr TextureWeakPtr; class TextureManager { diff --git a/src/framework/win32platform.cpp b/src/framework/win32platform.cpp index 6aec3117..a01bed24 100644 --- a/src/framework/win32platform.cpp +++ b/src/framework/win32platform.cpp @@ -28,6 +28,9 @@ #include #include +#include +#include + LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); struct Win32PlatformPrivate { diff --git a/src/main.cpp b/src/main.cpp index ded18335..a62b63e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -108,7 +108,7 @@ int main(int argc, const char *argv[]) // state scope { - boost::scoped_ptr menuState(new MenuState); + std::unique_ptr menuState(new MenuState); g_engine.changeState(menuState.get()); Platform::showWindow();