diff --git a/examples/text/Game.cpp b/examples/text/Game.cpp index 5a65a4b..43d3662 100644 --- a/examples/text/Game.cpp +++ b/examples/text/Game.cpp @@ -1,27 +1,30 @@ +#include #include #include #include #include #include "Game.h" -Font smallFont; -Font myFont; -Font fntLarge; +sp::Font smallFont; +sp::Font myFont; +sp::Font fntLarge; -Text myText; -Text txtLarge; -Text txtKerning; -Text fpsText; -Text txtSmall; +sp::Text myText; +sp::Text txtLarge; +sp::Text txtKerning; +sp::Text fpsText; +sp::Text txtSmall; -Camera2D guiCamera; +sp::Camera2D guiCamera; -BatchRenderer2D *renderer; +sp::BatchRenderer2D *renderer; void TextExample::init() { - Graphics* g = getGraphics(); + sp::Graphics* g = getGraphics(); + + std::cout << g->getVersion() << std::endl; g->setClearColor(52.0f / 255.0f, 58.0f / 255.0f, 80.0f / 255.0f); @@ -30,18 +33,18 @@ void TextExample::init() fntLarge.loadFromFile("assets/fonts/OPTIBelwe-Medium.otf"); myText.setFont(myFont); - myText.setColor(Color::Green); + myText.setColor(sp::Color::Green); myText.setString("Hello"); myText.setPosition(25.0f, 50.0f); txtLarge.setFont(myFont); - txtLarge.setColor(Color(200, 100, 0)); + txtLarge.setColor(sp::Color(200, 100, 0)); txtLarge.setString("Large Text, Looks good?"); txtLarge.setPosition(300.0f, 150.0f); txtLarge.setScale(2.0f); txtKerning.setFont(fntLarge); - txtKerning.setColor(Color(150, 0, 230)); + txtKerning.setColor(sp::Color(150, 0, 230)); txtKerning.setString("Kerning: VA Ta"); txtKerning.setPosition(150.0f, 200.0f); @@ -53,23 +56,23 @@ void TextExample::init() fpsText.setString("FPS: 0"); fpsText.setPosition(10.0f, 10.0f); - renderer = new BatchRenderer2D(); + renderer = new sp::BatchRenderer2D(); } void TextExample::update(double dt) { - InputModule* input = getInput(); + sp::InputModule* input = getInput(); input->update(); if (getFpsCounter().update()) { - std::string str = "FPS: " + core::to_string(getFpsCounter().getFPS(), 0); + std::string str = "FPS: " + sp::core::to_string(getFpsCounter().getFPS(), 0); fpsText.setString(str); } } void TextExample::render() { - Graphics* g = getGraphics(); + sp::Graphics* g = getGraphics(); g->clearBuffer(); diff --git a/examples/text/Game.h b/examples/text/Game.h index 0a8904d..f0cd6ba 100644 --- a/examples/text/Game.h +++ b/examples/text/Game.h @@ -6,7 +6,7 @@ #include #include -class TextExample : public Game, public InputListener +class TextExample : public sp::Game, public sp::InputListener { protected : diff --git a/include/Spectre/Core/NonCopyable.h b/include/Spectre/Core/NonCopyable.h index 0af481b..c5b6f96 100644 --- a/include/Spectre/Core/NonCopyable.h +++ b/include/Spectre/Core/NonCopyable.h @@ -2,6 +2,8 @@ #ifndef SPECTRE_CORE_NONCOPYABLE_H #define SPECTRE_CORE_NONCOPYABLE_H +namespace sp { + class NonCopyable { protected : @@ -15,4 +17,6 @@ private : NonCopyable& operator =(const NonCopyable&); }; +} // namespace sp + #endif /* SPECTRE_CORE_NONCOPYABLE_H */ \ No newline at end of file diff --git a/include/Spectre/Core/String.h b/include/Spectre/Core/String.h index 5421a92..5d16471 100644 --- a/include/Spectre/Core/String.h +++ b/include/Spectre/Core/String.h @@ -6,7 +6,7 @@ #include -namespace core +namespace sp { namespace core { // Convertion functions from standard c/c++ types. @@ -15,6 +15,6 @@ namespace core std::string to_string(float value); std::string to_string(float value, unsigned int precision); -}; +} } // namespace sp::core #endif /* SPECTRE_CORE_STRING_H */ diff --git a/include/Spectre/Display/Display.h b/include/Spectre/Display/Display.h index 398e1f1..305623b 100644 --- a/include/Spectre/Display/Display.h +++ b/include/Spectre/Display/Display.h @@ -8,6 +8,8 @@ #include #include +namespace sp { + class PlatformDisplay; class GLContext; @@ -73,4 +75,6 @@ protected : GLContext* m_context; }; +} // namepsace sp + #endif /* SPECTRE_DISPLAY_DISPLAY_H */ diff --git a/include/Spectre/Display/DisplayDescription.h b/include/Spectre/Display/DisplayDescription.h index 4d006bb..0d6539b 100644 --- a/include/Spectre/Display/DisplayDescription.h +++ b/include/Spectre/Display/DisplayDescription.h @@ -4,8 +4,10 @@ #include "DisplayMode.h" +namespace sp { + namespace DisplayDecorate { - + enum Type { None = 0, Menu = 1 << 0, @@ -27,4 +29,6 @@ public : unsigned int decoration; }; +} // namespace sp + #endif /* SPECTRE_DISPLAY_DISPLAYDESCRIPTION_H */ diff --git a/include/Spectre/Display/DisplayMode.h b/include/Spectre/Display/DisplayMode.h index 318a955..d12d194 100644 --- a/include/Spectre/Display/DisplayMode.h +++ b/include/Spectre/Display/DisplayMode.h @@ -4,6 +4,8 @@ #include +namespace sp { + class DisplayMode { public : @@ -16,7 +18,7 @@ public : inline bool operator==(const DisplayMode& other) { - return width == other.width + return width == other.width && height == other.height && bpp == other.bpp; } @@ -32,4 +34,6 @@ public : unsigned int bpp; /* Bits per pixel. */ }; +} // namespace sp + #endif /* SPECTRE_DISPLAY_DISPLAYMODE_H */ \ No newline at end of file diff --git a/include/Spectre/Display/GLContext.h b/include/Spectre/Display/GLContext.h index 6dca758..9f2acba 100644 --- a/include/Spectre/Display/GLContext.h +++ b/include/Spectre/Display/GLContext.h @@ -4,6 +4,8 @@ #include +namespace sp { + class PlatformDisplay; // Platform independant interface for OpenGL Contexts. @@ -43,4 +45,6 @@ public : virtual void swapBuffers() = 0; }; +} // namespace sp + #endif /* DISPLAY_GLCONTEXT_H */ diff --git a/include/Spectre/Game.h b/include/Spectre/Game.h index 885275c..41cb59d 100644 --- a/include/Spectre/Game.h +++ b/include/Spectre/Game.h @@ -11,6 +11,8 @@ class MessageQueue; class MessageHandler; class PlatformApplication; +namespace sp { + class Game { public : @@ -60,4 +62,6 @@ private : bool m_running; }; +} + #endif /* SPECTRE_GAME_H */ diff --git a/include/Spectre/Game/FPSCounter.h b/include/Spectre/Game/FPSCounter.h index 8b0fad1..2042a75 100644 --- a/include/Spectre/Game/FPSCounter.h +++ b/include/Spectre/Game/FPSCounter.h @@ -4,6 +4,8 @@ // Simple FPS counter. +namespace sp { + class FPSCounter { public : @@ -29,7 +31,7 @@ private : // Frame counter. unsigned int m_count; - + // time (in ms) unsigned int m_time; @@ -40,4 +42,6 @@ private : float m_fps; }; +} // namespace sp + #endif /* SPECTRE_FPS_COUNTER_H */ \ No newline at end of file diff --git a/include/Spectre/Game/GameTime.h b/include/Spectre/Game/GameTime.h index 97c8d42..6d4fea3 100644 --- a/include/Spectre/Game/GameTime.h +++ b/include/Spectre/Game/GameTime.h @@ -2,6 +2,8 @@ #ifndef SPECTRE_GAME_TIME_H #define SPECTRE_GAME_TIME_H +namespace sp { + class GameTime { public : @@ -42,4 +44,6 @@ protected : bool m_inLoop; }; +} // namespace sp + #endif /* SPECTRE_GAME_TIME_H */ \ No newline at end of file diff --git a/include/Spectre/Graphics.h b/include/Spectre/Graphics.h index c0a61ae..6999ec1 100644 --- a/include/Spectre/Graphics.h +++ b/include/Spectre/Graphics.h @@ -4,6 +4,8 @@ #include +namespace sp { + class PlatformApplication; class Graphics @@ -48,4 +50,6 @@ protected : Display *m_display; }; +} // namespace sp + #endif /* GRAPHICS_H */ diff --git a/include/Spectre/Graphics/BatchRenderer2D.h b/include/Spectre/Graphics/BatchRenderer2D.h index 7fe7d16..ed383c8 100644 --- a/include/Spectre/Graphics/BatchRenderer2D.h +++ b/include/Spectre/Graphics/BatchRenderer2D.h @@ -10,8 +10,9 @@ #include #include -class ShaderProgram; +namespace sp { +class ShaderProgram; class Texture; class BatchRenderer2D : public Renderer2D @@ -70,4 +71,6 @@ protected : ShaderProgram m_spriteShader; }; +} // namespace + #endif /* SPECTRE_BATCH_RENDERER2D_H */ \ No newline at end of file diff --git a/include/Spectre/Graphics/DefaultRenderer2D.h b/include/Spectre/Graphics/DefaultRenderer2D.h index 41c33e5..9a35acc 100644 --- a/include/Spectre/Graphics/DefaultRenderer2D.h +++ b/include/Spectre/Graphics/DefaultRenderer2D.h @@ -5,6 +5,8 @@ #include #include "Renderer2D.h" +namespace sp { + class DefaultRenderer2D : public Renderer2D { public : @@ -22,4 +24,6 @@ protected : ShaderProgram m_shader; }; +} // namespace + #endif /* SPECTRE_DEFAULT_RENDERER2D_H */ \ No newline at end of file diff --git a/include/Spectre/Graphics/Font.h b/include/Spectre/Graphics/Font.h index eda5026..17b5e4a 100644 --- a/include/Spectre/Graphics/Font.h +++ b/include/Spectre/Graphics/Font.h @@ -10,6 +10,8 @@ #include #include +namespace sp { + class FontDriver; // TODO: Fixup this api :) @@ -73,4 +75,6 @@ protected : std::vector m_rawData; }; +} + #endif /* SPECTRE_GRAPHCIS_FONT_H */ diff --git a/include/Spectre/Graphics/Image.h b/include/Spectre/Graphics/Image.h index 23efa73..11af7dc 100644 --- a/include/Spectre/Graphics/Image.h +++ b/include/Spectre/Graphics/Image.h @@ -8,6 +8,8 @@ #include #include +namespace sp { + class Image { public : @@ -59,4 +61,6 @@ private : std::vector m_pixels; }; +} //namespace sp + #endif /* SPECTRE_GRAPHICS_IMAGE_H */ diff --git a/include/Spectre/Graphics/PixelFormat.h b/include/Spectre/Graphics/PixelFormat.h index 772f875..c46c0f9 100644 --- a/include/Spectre/Graphics/PixelFormat.h +++ b/include/Spectre/Graphics/PixelFormat.h @@ -1,6 +1,8 @@ #ifndef SPECTRE_GRAPHICS_PIXELFORMAT_H #define SPECTRE_GRAPHICS_PIXELFORMAT_H +namespace sp { + enum PixelFormat { PF_Unknown = 0, @@ -9,4 +11,6 @@ enum PixelFormat PF_Alpha = 3, // 1 byte alpha channel. }; +} // namespace + #endif /* SPECTRE_GRAPHICS_PIXELFORMAT_H */ diff --git a/include/Spectre/Graphics/RenderState.h b/include/Spectre/Graphics/RenderState.h index d53efc5..f5eaede 100644 --- a/include/Spectre/Graphics/RenderState.h +++ b/include/Spectre/Graphics/RenderState.h @@ -2,6 +2,8 @@ #ifndef SPECTRE_GRAPHICS_RENDERSTATE_H #define SPECTRE_GRAPHICS_RENDERSTATE_H +namespace sp { + class ShaderProgram; class Texture; @@ -24,4 +26,6 @@ protected : const ShaderProgram *m_shader; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_RENDERSTATE_H */ diff --git a/include/Spectre/Graphics/Renderable.h b/include/Spectre/Graphics/Renderable.h index dbb2c65..a9749a6 100644 --- a/include/Spectre/Graphics/Renderable.h +++ b/include/Spectre/Graphics/Renderable.h @@ -8,6 +8,8 @@ #include #include +namespace sp { + class Renderer2D; class ShaderProgram; class Texture; @@ -43,4 +45,6 @@ protected : unsigned char m_zorder; }; +} // namespace sp + #endif /* SPECTRE_GRAPHCIS_RENDERABLE_H */ diff --git a/include/Spectre/Graphics/Renderer2D.h b/include/Spectre/Graphics/Renderer2D.h index 9690005..ed2b2d1 100644 --- a/include/Spectre/Graphics/Renderer2D.h +++ b/include/Spectre/Graphics/Renderer2D.h @@ -6,6 +6,8 @@ #include #include +namespace sp { + class Renderer2D { public : @@ -28,4 +30,6 @@ protected : const Camera2D* m_camera; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_RENDERER2D_H */ \ No newline at end of file diff --git a/include/Spectre/Graphics/Shader.h b/include/Spectre/Graphics/Shader.h index a601d9f..d399acd 100644 --- a/include/Spectre/Graphics/Shader.h +++ b/include/Spectre/Graphics/Shader.h @@ -4,6 +4,8 @@ #include +namespace sp { + class Shader { public : @@ -51,4 +53,6 @@ protected : std::string m_error; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_SHADER_H */ \ No newline at end of file diff --git a/include/Spectre/Graphics/ShaderProgram.h b/include/Spectre/Graphics/ShaderProgram.h index 905977f..5272f64 100644 --- a/include/Spectre/Graphics/ShaderProgram.h +++ b/include/Spectre/Graphics/ShaderProgram.h @@ -6,6 +6,8 @@ #include #include "Shader.h" +namespace sp { + struct Color; class ShaderProgram @@ -83,4 +85,6 @@ protected : mutable std::string m_error; }; -#endif /* SPECTRE_GRAPHICS_SHADER_PROGRAM_H */ \ No newline at end of file +} // namespace sp + +#endif /* SPECTRE_GRAPHICS_SHADER_PROGRAM_H */ diff --git a/include/Spectre/Graphics/Sprite.h b/include/Spectre/Graphics/Sprite.h index a786ec1..9c88e07 100644 --- a/include/Spectre/Graphics/Sprite.h +++ b/include/Spectre/Graphics/Sprite.h @@ -6,6 +6,8 @@ #include "Vertex2D.h" #include "Renderable.h" +namespace sp { + class Texture; class Sprite : public Renderable2D @@ -46,4 +48,6 @@ protected : const Texture* m_texture; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_SPRITE_H */ diff --git a/include/Spectre/Graphics/Text.h b/include/Spectre/Graphics/Text.h index bed3226..918e20f 100644 --- a/include/Spectre/Graphics/Text.h +++ b/include/Spectre/Graphics/Text.h @@ -8,6 +8,8 @@ #include #include +namespace sp { + class Text : public Renderable2D { public : @@ -88,4 +90,6 @@ private : mutable std::vector m_vertices; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_TEXT_H */ diff --git a/include/Spectre/Graphics/Texture.h b/include/Spectre/Graphics/Texture.h index b0a614e..d90dd92 100644 --- a/include/Spectre/Graphics/Texture.h +++ b/include/Spectre/Graphics/Texture.h @@ -10,6 +10,8 @@ // Basic OpenGL Texture object. +namespace sp { + class Texture : public NonCopyable { public: @@ -88,4 +90,6 @@ protected : PixelFormat m_format; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_TEXTURE_H */ diff --git a/include/Spectre/Graphics/Transformable.h b/include/Spectre/Graphics/Transformable.h index 15c2ebd..67c4406 100644 --- a/include/Spectre/Graphics/Transformable.h +++ b/include/Spectre/Graphics/Transformable.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + class Transformable { public : @@ -56,4 +58,6 @@ private : mutable Transform m_transform; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_TRANSFORMABLE_H */ \ No newline at end of file diff --git a/include/Spectre/Graphics/Vertex2D.h b/include/Spectre/Graphics/Vertex2D.h index b45693e..5f0f267 100644 --- a/include/Spectre/Graphics/Vertex2D.h +++ b/include/Spectre/Graphics/Vertex2D.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + // Based on https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/attributes.php enum VertexAttrib { @@ -27,4 +29,6 @@ struct Vertex2D Vertex2D(Vector2f pos, Vector4f color, Vector2f uv = 0.0f); }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_VERTEX2D_H */ diff --git a/include/Spectre/Input/InputDevice.h b/include/Spectre/Input/InputDevice.h index 582a3b5..543cdb2 100644 --- a/include/Spectre/Input/InputDevice.h +++ b/include/Spectre/Input/InputDevice.h @@ -4,6 +4,8 @@ #include "InputModule.h" +namespace sp { + class InputDevice { friend class InputModule; @@ -18,4 +20,6 @@ protected : virtual void update(InputModule *input) = 0; }; +} // namespace sp + #endif /* SPECTRE_INTPUT_DEVICE_H */ diff --git a/include/Spectre/Input/InputEvent.h b/include/Spectre/Input/InputEvent.h index 02f5031..aef33bd 100644 --- a/include/Spectre/Input/InputEvent.h +++ b/include/Spectre/Input/InputEvent.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + namespace MouseButton { enum Type { @@ -120,7 +122,7 @@ typedef struct InputEvent MousePosition }; - struct KeyEvent { + struct KeyEvent { Key::Type code; bool pressed; /* true if pressed, false if released. */ @@ -150,4 +152,6 @@ typedef struct InputEvent } InputEvent; +} // namespace sp + #endif /* SPECTRE_INPUT_EVENT_H */ diff --git a/include/Spectre/Input/InputListener.h b/include/Spectre/Input/InputListener.h index 78786c6..9f92406 100644 --- a/include/Spectre/Input/InputListener.h +++ b/include/Spectre/Input/InputListener.h @@ -4,10 +4,14 @@ #include "InputEvent.h" +namespace sp { + class InputListener { public : virtual void onInputEvent(const InputEvent& event); }; +} // namespace sp + #endif /* SPECTRE_INPUT_LISTENER_H */ \ No newline at end of file diff --git a/include/Spectre/Input/InputModule.h b/include/Spectre/Input/InputModule.h index c6074eb..c3eb2e7 100644 --- a/include/Spectre/Input/InputModule.h +++ b/include/Spectre/Input/InputModule.h @@ -8,6 +8,8 @@ #include "InputListener.h" #include "InputEvent.h" +namespace sp { + class Mouse; class Keyboard; class InputDevice; @@ -38,7 +40,7 @@ public : protected : void dispatch(); - + typedef std::vector InputDeviceVec; InputDeviceVec m_devices; @@ -54,4 +56,6 @@ protected : PlatformInput *m_platform; }; +} // namespace sp + #endif /* SPECTRE_INPUT_MODULE_H */ diff --git a/include/Spectre/Input/Keyboard.h b/include/Spectre/Input/Keyboard.h index 621094f..fe993f2 100644 --- a/include/Spectre/Input/Keyboard.h +++ b/include/Spectre/Input/Keyboard.h @@ -6,6 +6,8 @@ #include "InputEvent.h" #include "InputDevice.h" +namespace sp { + class Keyboard : public InputDevice { public : @@ -16,4 +18,6 @@ public : static std::string getKeyName(Key::Type key); }; +} // namespace sp + #endif /* SPECTRE_INPUT_KEYBOARD_H */ diff --git a/include/Spectre/Input/Mouse.h b/include/Spectre/Input/Mouse.h index 2958681..4268536 100644 --- a/include/Spectre/Input/Mouse.h +++ b/include/Spectre/Input/Mouse.h @@ -7,6 +7,8 @@ #include "InputEvent.h" #include "InputDevice.h" +namespace sp { + class Mouse : public InputDevice { public : @@ -22,4 +24,6 @@ public : static std::string getButtonName(MouseButton::Type button); }; +} // namespace sp + #endif /* SPECTRE_INPUT_MOUSE_H */ diff --git a/include/Spectre/Math/Color.h b/include/Spectre/Math/Color.h index 3e976ab..99338bd 100644 --- a/include/Spectre/Math/Color.h +++ b/include/Spectre/Math/Color.h @@ -5,6 +5,8 @@ #include "Vector3.h" #include "Vector4.h" +namespace sp { + // Basic structure representing a color in 32bit RGBA struct Color { @@ -62,4 +64,6 @@ Color operator -(const Color& a, unsigned int s); Color operator /(const Color& a, unsigned int s); Color operator *(const Color& a, unsigned int s); +} // namespace sp + #endif /* SPECTRE_MATH_COLOR_H */ diff --git a/include/Spectre/Math/Math.h b/include/Spectre/Math/Math.h index 36b0562..97f62d0 100644 --- a/include/Spectre/Math/Math.h +++ b/include/Spectre/Math/Math.h @@ -6,7 +6,7 @@ #include "Vector2.h" #include "Matrix4.h" -namespace math +namespace sp { namespace math { float rand(float min, float max); @@ -28,13 +28,13 @@ namespace math // ------------------------------ // Create a orthographic projection matrix. - Matrix4f orthoProjection(float left, float right, - float bottom, float top, + Matrix4f orthoProjection(float left, float right, + float bottom, float top, float zNear = -1.0f, float zFar = 1.0f); // Create a 2D rotation matrix. (rotation around Z-axis) Matrix4f rotation(float theta); - + // Create a 2D translation matrix. Matrix4f translate(const Vector2f& v); @@ -47,6 +47,7 @@ namespace math Vector3f getUpVector(const Matrix4f matrix); Vector3f getForwardVector(const Matrix4f matrix); -}; + +} } // namespace sp #endif /* SPECTRE_MATH_MATH_H */ \ No newline at end of file diff --git a/include/Spectre/Math/Matrix3.h b/include/Spectre/Math/Matrix3.h index b5328e9..d1d005a 100644 --- a/include/Spectre/Math/Matrix3.h +++ b/include/Spectre/Math/Matrix3.h @@ -7,6 +7,8 @@ #include #include +namespace sp { + template struct Matrix3 { @@ -20,7 +22,7 @@ struct Matrix3 | 0 3 6 | | 1 4 7 | | 2 5 8 | - |_ _| + |_ _| */ T v[9]; }; @@ -77,6 +79,8 @@ typedef Matrix3 Matrix3d; typedef Matrix3 Matrix3i; typedef Matrix3 Matrix3u; +} // namespace sp + #include "Matrix3.inl" #endif /* SPECTRE_MATH_MATRIX3_H */ \ No newline at end of file diff --git a/include/Spectre/Math/Matrix3.inl b/include/Spectre/Math/Matrix3.inl index 80a835d..8ac9947 100644 --- a/include/Spectre/Math/Matrix3.inl +++ b/include/Spectre/Math/Matrix3.inl @@ -2,6 +2,8 @@ #include #include "Matrix3.h" +namespace sp { + template <> Matrix3f Matrix3f::Identity( 1, 0, 0, @@ -120,3 +122,5 @@ inline std::ostream& operator<<(std::ostream &s, const Matrix3& mat) << mat.v[1] << " " << mat.v[4] << " " << mat.v[7] << std::endl << mat.v[2] << " " << mat.v[5] << " " << mat.v[8] << std::endl; } + +} // namespace sp diff --git a/include/Spectre/Math/Matrix4.h b/include/Spectre/Math/Matrix4.h index 7551bde..f1f7ddf 100644 --- a/include/Spectre/Math/Matrix4.h +++ b/include/Spectre/Math/Matrix4.h @@ -9,6 +9,8 @@ #include #include +namespace sp { + template struct Matrix4 { @@ -100,10 +102,11 @@ typedef Matrix4 mat4d; typedef Matrix4 mat4i; typedef Matrix4 mat4u; +} // namespace sp + // ---------------- // Implementation // ---------------- - #include "Matrix4.inl" #endif /* SPECTRE_MATH_MATRIX4_H */ \ No newline at end of file diff --git a/include/Spectre/Math/Matrix4.inl b/include/Spectre/Math/Matrix4.inl index 87b7d91..586469e 100644 --- a/include/Spectre/Math/Matrix4.inl +++ b/include/Spectre/Math/Matrix4.inl @@ -4,6 +4,8 @@ #include #include "Matrix4.h" +namespace sp { + template const Matrix4 Matrix4::Identity( 1, 0, 0, 0, @@ -152,3 +154,5 @@ inline std::ostream& operator<<(std::ostream &s, const Matrix4& mat) { return s << mat.toString(); } + +} // namespace sp \ No newline at end of file diff --git a/include/Spectre/Math/Transform.h b/include/Spectre/Math/Transform.h index 2d0a4a0..aff5782 100644 --- a/include/Spectre/Math/Transform.h +++ b/include/Spectre/Math/Transform.h @@ -5,6 +5,8 @@ #include "Vector2.h" #include "Matrix4.h" +namespace sp { + // Class representing a transformation matrix. class Transform @@ -75,4 +77,6 @@ Transform& operator*=(Transform& a, const Transform& b); Vector2f operator*(const Transform& t, const Vector2f& v); +} // namespace sp + #endif /* SPECTRE_MATH_TRANSFORM_H */ \ No newline at end of file diff --git a/include/Spectre/Math/Vector2.h b/include/Spectre/Math/Vector2.h index 4bfb3cb..e259c96 100644 --- a/include/Spectre/Math/Vector2.h +++ b/include/Spectre/Math/Vector2.h @@ -5,11 +5,13 @@ #include #include +namespace sp { + template struct Vector2 { union { - struct { + struct { T x, y; }; T v[2]; @@ -111,7 +113,7 @@ template inline Vector2 operator+(T s, const Vector2& v); template -inline Vector2 operator-(const Vector2& v,T s); +inline Vector2 operator-(const Vector2& v, T s); template inline Vector2 operator-(T s, const Vector2& v); @@ -132,7 +134,7 @@ template inline Vector2& operator+=(Vector2& v, T s); template -inline Vector2& operator-=(Vector2& v,T s); +inline Vector2& operator-=(Vector2& v, T s); template inline Vector2& operator/=(Vector2& v, T s); @@ -190,6 +192,8 @@ typedef Vector2 vec2i; typedef Vector2 vec2u; typedef Vector2 vec2b; +} // namespace sp + #include "Vector2.inl" #endif /* SPECTRE_MATH_VECTOR2_H */ diff --git a/include/Spectre/Math/Vector2.inl b/include/Spectre/Math/Vector2.inl index 6a0c4a3..17bfb14 100644 --- a/include/Spectre/Math/Vector2.inl +++ b/include/Spectre/Math/Vector2.inl @@ -3,6 +3,8 @@ #include #include "Vector2.h" +namespace sp { + template Vector2::Vector2() { @@ -314,3 +316,5 @@ inline std::ostream& operator<<(std::ostream &s, const Vector2& v) { return s << "(" << v.x << "," << v.y << ")"; } + +} // namespace sp \ No newline at end of file diff --git a/include/Spectre/Math/Vector3.h b/include/Spectre/Math/Vector3.h index 0d98ba3..b759747 100644 --- a/include/Spectre/Math/Vector3.h +++ b/include/Spectre/Math/Vector3.h @@ -5,6 +5,8 @@ #include "Vector2.h" #include +namespace sp { + template struct Vector3 { @@ -167,6 +169,8 @@ typedef Vector3 vec3i; typedef Vector3 vec3u; typedef Vector3 vec3b; +} // namespace sp + #include "Vector3.inl" #endif /* SPECTRE_MATH_VECTOR3_H */ diff --git a/include/Spectre/Math/Vector3.inl b/include/Spectre/Math/Vector3.inl index 34aa522..5859693 100644 --- a/include/Spectre/Math/Vector3.inl +++ b/include/Spectre/Math/Vector3.inl @@ -2,6 +2,8 @@ #include #include "Vector3.h" +namespace sp { + template Vector3::Vector3() { @@ -265,3 +267,5 @@ inline std::ostream& operator<<(std::ostream &s, const Vector3& v) { return s << "(" << v.x << "," << v.y << "," << v.z << ")"; } + +} // namespace sp \ No newline at end of file diff --git a/include/Spectre/Math/Vector4.h b/include/Spectre/Math/Vector4.h index 34e19bb..7b9e45b 100644 --- a/include/Spectre/Math/Vector4.h +++ b/include/Spectre/Math/Vector4.h @@ -4,6 +4,8 @@ #include +namespace sp { + template struct Vector4 { @@ -153,6 +155,8 @@ typedef Vector4 vec4i; typedef Vector4 vec4u; typedef Vector4 vec4b; +} // namespace sp + #include "Vector4.inl" #endif /* SPECTRE_MATH_VECTOR4_H */ diff --git a/include/Spectre/Math/Vector4.inl b/include/Spectre/Math/Vector4.inl index 83d2db4..c759fb7 100644 --- a/include/Spectre/Math/Vector4.inl +++ b/include/Spectre/Math/Vector4.inl @@ -2,6 +2,8 @@ #include #include "Vector4.h" +namespace sp { + template Vector4::Vector4() { @@ -252,3 +254,5 @@ inline std::ostream& operator<<(std::ostream &s, const Vector4& v) { return s << "(" << v.x << "," << v.y << "," << v.z << "," << v.w << ")"; } + +} // namespace sp diff --git a/include/Spectre/Scene/Camera2D.h b/include/Spectre/Scene/Camera2D.h index a435583..af62e76 100644 --- a/include/Spectre/Scene/Camera2D.h +++ b/include/Spectre/Scene/Camera2D.h @@ -13,6 +13,8 @@ // TODO: Zoom is implemented using a scale matrix. // It's abit weird to control. Must be a better solution. +namespace sp { + class Camera2D : public ICamera { public : @@ -29,7 +31,7 @@ public : void move(float x, float y); void move(const Vector2f& vec); - + void moveUp(float delta); void moveRight(float delta); @@ -80,4 +82,6 @@ protected : mutable bool m_projViewNeedsUpdate; }; +} // namespace sp + #endif /* SPECTRE_SCENE_CAMERA2D_H */ \ No newline at end of file diff --git a/include/Spectre/Scene/ICamera.h b/include/Spectre/Scene/ICamera.h index 7a17421..8d249eb 100644 --- a/include/Spectre/Scene/ICamera.h +++ b/include/Spectre/Scene/ICamera.h @@ -4,6 +4,8 @@ #include +namespace sp { + // Camera interface. class ICamera { @@ -17,4 +19,6 @@ public : virtual const Matrix4f& getProjectionViewMatrix() const = 0; }; +} // namespace sp + #endif /* SPECTRE_SCENE_ICAMERA_H */ \ No newline at end of file diff --git a/include/Spectre/System/File.h b/include/Spectre/System/File.h index f585665..d3bad58 100644 --- a/include/Spectre/System/File.h +++ b/include/Spectre/System/File.h @@ -5,7 +5,7 @@ #include #include -namespace File +namespace sp { namespace file { std::string getBasename(const std::string& path); @@ -14,6 +14,6 @@ namespace File std::string getPathname(const std::string& path); std::vector read(const std::string& path); -}; +} } #endif /* SPECTRE_SYSTEM_FILE_H */ diff --git a/include/Spectre/System/Log.h b/include/Spectre/System/Log.h index 57ecf45..68b26f0 100644 --- a/include/Spectre/System/Log.h +++ b/include/Spectre/System/Log.h @@ -2,6 +2,10 @@ #ifndef SYSTEM_LOG_H #define SYSTEM_LOG_H -void log(const char *fmt, ...); +namespace sp { + + void log(const char *fmt, ...); + +} // namespace sp #endif /* SYSTEM_LOG_H */ diff --git a/include/Spectre/System/MessageHandler.h b/include/Spectre/System/MessageHandler.h index 2113166..c82812c 100644 --- a/include/Spectre/System/MessageHandler.h +++ b/include/Spectre/System/MessageHandler.h @@ -4,6 +4,8 @@ #include "SystemEvent.h" +namespace sp { + class Display; class MessageHandler @@ -12,4 +14,6 @@ public : virtual void onSizeChanged(Display* display, int width, int height); }; +} // namespace sp + #endif /* SPECTRE_SYSTEM_MESSAGEHANDLER_H */ \ No newline at end of file diff --git a/include/Spectre/System/MessageQueue.h b/include/Spectre/System/MessageQueue.h index e6d947e..4f5e854 100644 --- a/include/Spectre/System/MessageQueue.h +++ b/include/Spectre/System/MessageQueue.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + class MessageQueue { public : @@ -18,4 +20,6 @@ protected : std::deque m_queue; }; +} // namespace sp + #endif /* SPECTRE_MESSAGE_QUEUE_H */ diff --git a/include/Spectre/System/System.h b/include/Spectre/System/System.h index f439b24..834d483 100644 --- a/include/Spectre/System/System.h +++ b/include/Spectre/System/System.h @@ -2,11 +2,12 @@ #ifndef SPECTRE_SYSTEM_SYSTEM_H #define SPECTRE_SYSTEM_SYSTEM_H -namespace System +namespace sp { namespace system { unsigned long getMilliseconds(); void sleep(int milliseconds); -}; + +} } // namespace sp::system #endif /* SPECTRE_SYSTEM_SYSTEM_H */ diff --git a/include/Spectre/System/SystemEvent.h b/include/Spectre/System/SystemEvent.h index ed924b1..31588e8 100644 --- a/include/Spectre/System/SystemEvent.h +++ b/include/Spectre/System/SystemEvent.h @@ -2,6 +2,8 @@ #ifndef SYSTEM_EVENT_H #define SYSTEM_EVENT_H +namespace sp { + class Display; struct SysEvent @@ -32,7 +34,8 @@ public : // Helper methods static SysEvent sizeEvent(Display *display, int width, int height); - }; +} // namespace sp + #endif /* SYSTEM_EVENT_H */ \ No newline at end of file diff --git a/source/Core/String.cpp b/source/Core/String.cpp index cee474d..7e8c092 100644 --- a/source/Core/String.cpp +++ b/source/Core/String.cpp @@ -2,6 +2,8 @@ #include #include +namespace sp { + std::string core::to_string(unsigned int value) { char buf[32]; @@ -23,3 +25,5 @@ std::string core::to_string(float value, unsigned int precision) sprintf(buf, format.c_str(), value); return std::string(buf); } + +} // namespace sp::core diff --git a/source/Display/Display.cpp b/source/Display/Display.cpp index bd8799e..7738b40 100644 --- a/source/Display/Display.cpp +++ b/source/Display/Display.cpp @@ -5,6 +5,8 @@ #include #include +namespace sp { + #define CAPTION_DEFAULT "Spectre" #define ICON_DEFAULT "./assets/app.ico" @@ -147,4 +149,6 @@ void Display::onReshape(int width, int height) { // Resize context if the windows resizes. m_context->setSize(width, height); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Display/DisplayDescription.cpp b/source/Display/DisplayDescription.cpp index 3629726..fe07531 100644 --- a/source/Display/DisplayDescription.cpp +++ b/source/Display/DisplayDescription.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + DisplayDescription::DisplayDescription() : mode (), decoration (DisplayDecorate::Default) @@ -11,4 +13,6 @@ DisplayDescription::DisplayDescription(DisplayMode mode, unsigned decoration) : mode (mode), decoration (decoration) { -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Display/DisplayMode.cpp b/source/Display/DisplayMode.cpp index fcb653e..85fea69 100644 --- a/source/Display/DisplayMode.cpp +++ b/source/Display/DisplayMode.cpp @@ -3,9 +3,11 @@ #include #include +namespace sp { + struct DisplayModeCmp { - inline bool operator() (const DisplayMode& a, const DisplayMode& b) + inline bool operator() (const DisplayMode& a, const DisplayMode& b) { if (a.bpp == b.bpp) { if (a.width == b.width) { @@ -51,4 +53,6 @@ std::vector DisplayMode::getFullscreenModes() DisplayMode DisplayMode::getDesktopMode() { return PlatformMisc::GetDesktopMode(); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Display/GLContext.cpp b/source/Display/GLContext.cpp index a833937..cd26ca8 100644 --- a/source/Display/GLContext.cpp +++ b/source/Display/GLContext.cpp @@ -3,11 +3,13 @@ #ifdef _WIN32 #include -typedef Win32GLContext ContextType; +typedef sp::Win32GLContext ContextType; #else #error "No GLContext implementation exists" #endif +namespace sp { + GLContext* GLContext::create() { return new ContextType(); @@ -17,3 +19,5 @@ GLContext::~GLContext() { // Nothing to do. } + +} // namespace sp diff --git a/source/Game.cpp b/source/Game.cpp index 44f60c0..f395494 100644 --- a/source/Game.cpp +++ b/source/Game.cpp @@ -9,6 +9,8 @@ #include #include +namespace sp { + Game::Game() { m_platform = new Win32Application(); @@ -64,7 +66,7 @@ void Game::gameLoop() m_fpsCounter.addFrame(); } } -} +} void Game::processEvents() { @@ -107,3 +109,5 @@ FPSCounter& Game::getFpsCounter() { return m_fpsCounter; } + +} diff --git a/source/Game/FPSCounter.cpp b/source/Game/FPSCounter.cpp index ba51d3d..3fa112f 100644 --- a/source/Game/FPSCounter.cpp +++ b/source/Game/FPSCounter.cpp @@ -2,6 +2,8 @@ #include #include +namespace sp { + FPSCounter::FPSCounter() : m_fps (60.0f), m_updateRate (2000) @@ -34,7 +36,7 @@ void FPSCounter::setUpdateRate(unsigned int ups) bool FPSCounter::update() { - unsigned int current = System::getMilliseconds(); + unsigned int current = system::getMilliseconds(); unsigned int elapsed = current - m_time; if (elapsed >= m_updateRate) { @@ -50,6 +52,8 @@ bool FPSCounter::update() void FPSCounter::reset() { - m_time = System::getMilliseconds(); + m_time = system::getMilliseconds(); m_count = 0; } + +} // namespace sp diff --git a/source/Game/GameTime.cpp b/source/Game/GameTime.cpp index 7d3e67e..1f46431 100644 --- a/source/Game/GameTime.cpp +++ b/source/Game/GameTime.cpp @@ -3,10 +3,12 @@ #include #include +namespace sp { + GameTime::GameTime(unsigned long updates_per_sec) { m_acc = 0; - m_current = System::getMilliseconds(); + m_current = system::getMilliseconds(); m_lastUpdate = m_current; setTimeStep(updates_per_sec); } @@ -67,10 +69,12 @@ void GameTime::accumulateTime() void GameTime::updateTime() { - m_current = System::getMilliseconds(); + m_current = system::getMilliseconds(); // Just to be safe. check so we don't get a negative interval. if (m_current < m_lastUpdate) { m_lastUpdate = m_current; } -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/BatchRenderer2D.cpp b/source/Graphics/BatchRenderer2D.cpp index 9748453..1bd2c17 100644 --- a/source/Graphics/BatchRenderer2D.cpp +++ b/source/Graphics/BatchRenderer2D.cpp @@ -10,6 +10,8 @@ #include +namespace sp { + static bool compare_renderable(const Renderable2D* a, const Renderable2D* b) { if (a->getZOrder() != b->getZOrder()) { @@ -256,4 +258,6 @@ void BatchRenderer2D::drawBatch(Batch& batch) if (batch.type == RenderType_UI) { glDisable(GL_BLEND); } -} \ No newline at end of file +} + +} // namespace sp diff --git a/source/Graphics/DefaultRenderer2D.cpp b/source/Graphics/DefaultRenderer2D.cpp index 99724f4..da943a8 100644 --- a/source/Graphics/DefaultRenderer2D.cpp +++ b/source/Graphics/DefaultRenderer2D.cpp @@ -4,6 +4,8 @@ #include #include +namespace sp { + DefaultRenderer2D::DefaultRenderer2D() { m_shader.create(); @@ -69,4 +71,6 @@ void DefaultRenderer2D::render() m_shader.disable(); m_queue.clear(); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Font.cpp b/source/Graphics/Font.cpp index 1aa5019..fd24c3a 100644 --- a/source/Graphics/Font.cpp +++ b/source/Graphics/Font.cpp @@ -7,6 +7,8 @@ #include #include "Font/FreeTypeDriver.h" +namespace sp { + Font::Font() : m_driver (new FreeTypeDriver()) { @@ -124,3 +126,5 @@ const Texture* Font::getTexture() const { return &m_cacheTextureA.texture; } + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Font/FontDriver.cpp b/source/Graphics/Font/FontDriver.cpp index 2027c74..dc7603f 100644 --- a/source/Graphics/Font/FontDriver.cpp +++ b/source/Graphics/Font/FontDriver.cpp @@ -1,6 +1,8 @@ #include "FontDriver.h" +namespace sp { + FontDriver::FontDriver() : m_hinting (true) { @@ -9,4 +11,6 @@ m_hinting (true) void FontDriver::setHinting(bool value) { m_hinting = value; -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Font/FontDriver.h b/source/Graphics/Font/FontDriver.h index 777a39d..d222fed 100644 --- a/source/Graphics/Font/FontDriver.h +++ b/source/Graphics/Font/FontDriver.h @@ -6,6 +6,8 @@ #include #include +namespace sp { + class FontDriver { public : @@ -28,4 +30,6 @@ protected : bool m_hinting; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_FONT_FONTDRIVER_H */ diff --git a/source/Graphics/Font/FreeTypeDriver.cpp b/source/Graphics/Font/FreeTypeDriver.cpp index a6946b9..e792654 100644 --- a/source/Graphics/Font/FreeTypeDriver.cpp +++ b/source/Graphics/Font/FreeTypeDriver.cpp @@ -9,6 +9,8 @@ #include "FreeTypeError.h" #include "FreeTypeDriver.h" +namespace sp { + class LibWrapper { public : @@ -165,4 +167,6 @@ Font::Glyph FreeTypeDriver::loadGlyph(unsigned int codepoint, Image& img, unsign std::string FreeTypeDriver::getName() { return m_face->family_name; -} \ No newline at end of file +} + +} // namespace \ No newline at end of file diff --git a/source/Graphics/Font/FreeTypeDriver.h b/source/Graphics/Font/FreeTypeDriver.h index d1204d6..669cfb8 100644 --- a/source/Graphics/Font/FreeTypeDriver.h +++ b/source/Graphics/Font/FreeTypeDriver.h @@ -5,8 +5,11 @@ #include #include FT_FREETYPE_H +#include #include "FontDriver.h" +namespace sp { + class FreeTypeDriver : public FontDriver { public: @@ -26,4 +29,6 @@ private : FT_Face m_face; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_FONT_FREETYPEDRIVER_H */ diff --git a/source/Graphics/Image.cpp b/source/Graphics/Image.cpp index 40868eb..5497c60 100644 --- a/source/Graphics/Image.cpp +++ b/source/Graphics/Image.cpp @@ -4,6 +4,8 @@ #include #include "ImageLoader.h" +namespace sp { + static ImageLoader _loader; Image::Image() : @@ -207,3 +209,5 @@ const unsigned char* Image::getPixels() const } return NULL; } + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/ImageLoader.cpp b/source/Graphics/ImageLoader.cpp index 8158acc..a9fd0cb 100644 --- a/source/Graphics/ImageLoader.cpp +++ b/source/Graphics/ImageLoader.cpp @@ -21,6 +21,8 @@ #include #include +namespace sp { + bool ImageLoader::loadFromFile(const char *filename, Image& img) { FILE *fd = fopen(filename, "rb"); @@ -59,7 +61,7 @@ bool ImageLoader::loadFromMemory(const void *data, unsigned size, Image& img) // TODO: Support more formats. bool ImageLoader::saveToFile(const Image& img, const char *filename) { - std::string ext = File::getExtension(filename); + std::string ext = file::getExtension(filename); std::vector encoded_data; if (ext == "png") { @@ -129,3 +131,5 @@ bool ImageLoader::encodePNG(const Image& img, std::vector& data) m_error = stbi_failure_reason(); return false; } + +} // namespace sp diff --git a/source/Graphics/ImageLoader.h b/source/Graphics/ImageLoader.h index f868a48..908b42e 100644 --- a/source/Graphics/ImageLoader.h +++ b/source/Graphics/ImageLoader.h @@ -6,6 +6,8 @@ #include #include +namespace sp { + class ImageLoader { public : @@ -30,4 +32,6 @@ protected : std::string m_error; }; +} // namespace sp + #endif /* SPECTRE_GRAPHICS_IMAGE_LOADER_H */ diff --git a/source/Graphics/RenderState.cpp b/source/Graphics/RenderState.cpp index 07e36e6..81c24af 100644 --- a/source/Graphics/RenderState.cpp +++ b/source/Graphics/RenderState.cpp @@ -4,6 +4,8 @@ #include #include +namespace sp { + RenderState::RenderState() : m_texture (0), m_shader (0) @@ -45,4 +47,6 @@ void RenderState::cleanup() if (m_shader) { m_shader->disable(); } -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Renderable2D.cpp b/source/Graphics/Renderable2D.cpp index f7a68ba..d7d85e5 100644 --- a/source/Graphics/Renderable2D.cpp +++ b/source/Graphics/Renderable2D.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + Renderable2D::Renderable2D() : m_zorder (0) { @@ -24,4 +26,6 @@ unsigned char Renderable2D::getZOrder() const void Renderable2D::setZOrder(unsigned char value) { m_zorder = value; -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Renderer2D.cpp b/source/Graphics/Renderer2D.cpp index 4c8f7cc..6e48eb5 100644 --- a/source/Graphics/Renderer2D.cpp +++ b/source/Graphics/Renderer2D.cpp @@ -1,5 +1,7 @@ #include +namespace sp { + Renderer2D::Renderer2D() : m_camera (NULL) { @@ -13,3 +15,5 @@ void Renderer2D::setCamera(const Camera2D& camera) { m_camera = &camera; } + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Shader.cpp b/source/Graphics/Shader.cpp index 2d61d78..c0b750d 100644 --- a/source/Graphics/Shader.cpp +++ b/source/Graphics/Shader.cpp @@ -4,6 +4,8 @@ #include #include +namespace sp { + Shader::Shader(Type type, const std::string& name) : m_name (name) { @@ -35,7 +37,7 @@ bool Shader::loadFromFile(const std::string& file) // If this shader does not have a name, pick the filename. if (m_name.length() < 1) { - m_name = File::getBasename(file); + m_name = file::getBasename(file); } // Load file into memory. @@ -98,3 +100,5 @@ std::string Shader::fetchErrorLog() return std::string(buf); } + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/ShaderProgram.cpp b/source/Graphics/ShaderProgram.cpp index a307ad2..b6dceaa 100644 --- a/source/Graphics/ShaderProgram.cpp +++ b/source/Graphics/ShaderProgram.cpp @@ -4,6 +4,8 @@ #include #include +namespace sp { + ShaderProgram::ShaderProgram() : m_id (0) { @@ -36,7 +38,7 @@ void ShaderProgram::addShader(const Shader& shader) bool ShaderProgram::loadFromFile(const std::string& filename) { - std::string extension = File::getExtension(filename); + std::string extension = file::getExtension(filename); // Meta file. load real shaders. if (extension == "shader.glsl") { @@ -191,3 +193,5 @@ std::string ShaderProgram::fetchErrorLog() return std::string(buf); } + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Sprite.cpp b/source/Graphics/Sprite.cpp index 905dc49..092ecd4 100644 --- a/source/Graphics/Sprite.cpp +++ b/source/Graphics/Sprite.cpp @@ -3,6 +3,8 @@ #include #include +namespace sp { + Sprite::Sprite() : m_texture (NULL) { @@ -114,4 +116,6 @@ void Sprite::updateGeometry() void Sprite::render(Renderer2D& renderer) const { renderer.draw(this); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Text.cpp b/source/Graphics/Text.cpp index 6acbcf9..36c8bc3 100644 --- a/source/Graphics/Text.cpp +++ b/source/Graphics/Text.cpp @@ -3,6 +3,8 @@ #include #include +namespace sp { + Text::Text() : m_font (NULL), m_size (22), @@ -173,4 +175,6 @@ void Text::updateGeometry() const void Text::render(Renderer2D& renderer) const { renderer.draw(this); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Texture.cpp b/source/Graphics/Texture.cpp index 086a4cd..f1d9d11 100644 --- a/source/Graphics/Texture.cpp +++ b/source/Graphics/Texture.cpp @@ -3,6 +3,8 @@ #include #include +namespace sp { + namespace { GLint pixelFormatToInternal(enum PixelFormat format) { @@ -252,3 +254,5 @@ bool Texture::operator!=(const Texture* other) const { return m_id != other->m_id; } + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Transformable.cpp b/source/Graphics/Transformable.cpp index eb35bbd..c729162 100644 --- a/source/Graphics/Transformable.cpp +++ b/source/Graphics/Transformable.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + Transformable::Transformable() : m_position (0.0f, 0.0f), m_scale (1.0f, 1.0f), @@ -92,4 +94,6 @@ const Transform& Transformable::getTransform() const m_transformNeedsUpdate = false; } return m_transform; -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Graphics/Vertex2D.cpp b/source/Graphics/Vertex2D.cpp index 2aeccdc..e91f73c 100644 --- a/source/Graphics/Vertex2D.cpp +++ b/source/Graphics/Vertex2D.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + Vertex2D::Vertex2D() : position (0.0f), color (1.0f), @@ -28,3 +30,5 @@ color (_color), uv (_uv) { } + +} // namespace sp diff --git a/source/GraphicsOpenGL.cpp b/source/GraphicsOpenGL.cpp index 290b31e..06513f8 100644 --- a/source/GraphicsOpenGL.cpp +++ b/source/GraphicsOpenGL.cpp @@ -3,6 +3,8 @@ #include #include +namespace sp { + Graphics::Graphics(PlatformApplication *platform) { m_width = 800; @@ -87,3 +89,5 @@ void Graphics::swapBuffers() { m_display->swapBuffers(); } + +} // namespace sp \ No newline at end of file diff --git a/source/Input/InputDevice.cpp b/source/Input/InputDevice.cpp index 63cd152..83d24e4 100644 --- a/source/Input/InputDevice.cpp +++ b/source/Input/InputDevice.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + InputDevice::~InputDevice() { } @@ -8,3 +10,5 @@ InputDevice::~InputDevice() void InputDevice::init() { } + +} // namespace sp \ No newline at end of file diff --git a/source/Input/InputEvent.cpp b/source/Input/InputEvent.cpp index 6db8a5b..0bd96c9 100644 --- a/source/Input/InputEvent.cpp +++ b/source/Input/InputEvent.cpp @@ -3,6 +3,8 @@ #include #include +namespace sp { + InputEvent::InputEvent(Type type) : type (type) { @@ -17,3 +19,5 @@ std::string InputEvent::MouseButtonEvent::getName() const { return Mouse::getButtonName(button); } + +} // namespace sp \ No newline at end of file diff --git a/source/Input/InputListener.cpp b/source/Input/InputListener.cpp index 2ea9d01..6fce171 100644 --- a/source/Input/InputListener.cpp +++ b/source/Input/InputListener.cpp @@ -1,6 +1,10 @@ #include +namespace sp { + void InputListener::onInputEvent(const InputEvent& event) { } + +} // namespace sp \ No newline at end of file diff --git a/source/Input/InputModule.cpp b/source/Input/InputModule.cpp index 9fdcfd9..977cc9d 100644 --- a/source/Input/InputModule.cpp +++ b/source/Input/InputModule.cpp @@ -6,6 +6,8 @@ #include #include +namespace sp { + InputModule::InputModule(PlatformInput *platform) : m_platform (platform) { @@ -94,3 +96,5 @@ void InputModule::dispatch() m_buffer.clear(); } + +} // namespace sp \ No newline at end of file diff --git a/source/Input/Keyboard.cpp b/source/Input/Keyboard.cpp index c608dad..3942dff 100644 --- a/source/Input/Keyboard.cpp +++ b/source/Input/Keyboard.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + struct keyentry { Key::Type type; @@ -110,3 +112,5 @@ std::string Keyboard::getKeyName(Key::Type key) } return table[key].name; } + +} // namespace sp \ No newline at end of file diff --git a/source/Input/Mouse.cpp b/source/Input/Mouse.cpp index fceea04..4520d5e 100644 --- a/source/Input/Mouse.cpp +++ b/source/Input/Mouse.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + Mouse::~Mouse() { } @@ -18,3 +20,5 @@ std::string Mouse::getButtonName(MouseButton::Type button) return "Unknown"; } } + +} // namespace sp \ No newline at end of file diff --git a/source/Math/Color.cpp b/source/Math/Color.cpp index c82e9a2..8150278 100644 --- a/source/Math/Color.cpp +++ b/source/Math/Color.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + const Color Color::Black (0 , 0 , 0 , 255); const Color Color::White (255, 255, 255, 255); const Color Color::Red (255, 0 , 0 , 255); @@ -126,3 +128,5 @@ Color operator *(const Color& c, unsigned int s) { return Color(c.r * s, c.g * s, c.b * s, c.a * s); } + +} // namespace sp \ No newline at end of file diff --git a/source/Math/Logarithm.cpp b/source/Math/Logarithm.cpp index f8ad0f4..9aa7f03 100644 --- a/source/Math/Logarithm.cpp +++ b/source/Math/Logarithm.cpp @@ -3,18 +3,18 @@ #include #include -namespace math { +namespace sp { - #define LOG2INBASE10 0.30102999566f +#define LOG2INBASE10 0.30102999566f - double log(double base, double value) { +double math::log(double base, double value) { - return log10(value) / log10(base); - } + return ::log10(value) / ::log10(base); +} - double log2(double value) { +double math::log2(double value) { - return log10(value) / LOG2INBASE10; - } + return ::log10(value) / LOG2INBASE10; +} -}; // namespace math +} // namespace sp diff --git a/source/Math/Math.cpp b/source/Math/Math.cpp index b2cc065..bee7afd 100644 --- a/source/Math/Math.cpp +++ b/source/Math/Math.cpp @@ -2,8 +2,8 @@ #include #include -namespace math { - +namespace sp { namespace math +{ float rand(float min, float max) { float r = ((float) ::rand()) / RAND_MAX; @@ -50,8 +50,8 @@ namespace math { Matrix4f rotation(float theta) { float r = deg2rad(theta); - float s = std::sin(r); - float c = std::cos(r); + float s = ::std::sin(r); + float c = ::std::cos(r); return Matrix4f( c, -s, 0.0f, 0.0f, @@ -94,4 +94,5 @@ namespace math { return Vector3f(matrix.e[8], matrix.e[9], matrix.e[10]); } -}; \ No newline at end of file + +} } // namespace sp::math diff --git a/source/Math/Transform.cpp b/source/Math/Transform.cpp index f5de97c..ad9905c 100644 --- a/source/Math/Transform.cpp +++ b/source/Math/Transform.cpp @@ -2,6 +2,8 @@ #include #include +namespace sp { + Transform::Transform() : m_matrix (Matrix4f::Identity) { @@ -155,4 +157,6 @@ Transform& operator*=(Transform& a, const Transform& other) Vector2f operator*(const Transform& transform, const Vector2f& vec) { return transform.transformPoint(vec); -} \ No newline at end of file +} + +} // namespace sp diff --git a/source/Platform/PlatformApplication.h b/source/Platform/PlatformApplication.h index bb59b46..b6cbc47 100644 --- a/source/Platform/PlatformApplication.h +++ b/source/Platform/PlatformApplication.h @@ -2,6 +2,8 @@ #ifndef SPECTRE_PLATFORM_H #define SPECTRE_PLATFORM_H +namespace sp { + class PlatformInput; class PlatformDisplay; class MessageQueue; @@ -22,4 +24,6 @@ public : virtual void update() = 0; }; +} // namespace sp + #endif /* SPECTRE_PLATFORM_H */ \ No newline at end of file diff --git a/source/Platform/PlatformDisplay.cpp b/source/Platform/PlatformDisplay.cpp index d7f53d9..dfe33bf 100644 --- a/source/Platform/PlatformDisplay.cpp +++ b/source/Platform/PlatformDisplay.cpp @@ -4,11 +4,13 @@ #ifdef _WIN32 #include -typedef Win32Display DisplayType; +typedef sp::Win32Display DisplayType; #else #error "No Display implementation exists" #endif +namespace sp { + PlatformDisplay* PlatformDisplay::make(Display* parent) { DisplayType* disp = new DisplayType(); @@ -29,4 +31,6 @@ void PlatformDisplay::onReshape(int width, int height) { // Forward to parent. m_parent->onReshape(width, height); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/PlatformDisplay.h b/source/Platform/PlatformDisplay.h index 0005c8e..cf16c14 100644 --- a/source/Platform/PlatformDisplay.h +++ b/source/Platform/PlatformDisplay.h @@ -8,6 +8,8 @@ // Low-level platform dependant API. #include +namespace sp { + class Display; class PlatformDisplay @@ -46,7 +48,9 @@ protected : private : - Display* m_parent; + Display * m_parent; }; +} // namespace sp + #endif /* SPECTRE_PLATFORM_DISPLAY_H */ \ No newline at end of file diff --git a/source/Platform/PlatformInput.h b/source/Platform/PlatformInput.h index 487d0e5..1a4c877 100644 --- a/source/Platform/PlatformInput.h +++ b/source/Platform/PlatformInput.h @@ -2,6 +2,8 @@ #ifndef PLATFORM_INPUT_H #define PLATFORM_INPUT_H +namespace sp { + class Keyboard; class Mouse; @@ -15,4 +17,6 @@ public : virtual void update() = 0; }; +} // namespace sp + #endif /* PLATFORM_INPUT_H */ diff --git a/source/Platform/PlatformMisc.h b/source/Platform/PlatformMisc.h index 191bf41..55d484b 100644 --- a/source/Platform/PlatformMisc.h +++ b/source/Platform/PlatformMisc.h @@ -3,9 +3,10 @@ #define PLATFORM_MISC_H #include - #include +namespace sp { + class DisplayMode; class PlatformMisc @@ -16,4 +17,6 @@ public: static DisplayMode GetDesktopMode(); }; +} // namespace sp + #endif /* PLATFORM_MISC_H */ diff --git a/source/Platform/Win32/Win32Application.cpp b/source/Platform/Win32/Win32Application.cpp index 2e0b959..3e51837 100644 --- a/source/Platform/Win32/Win32Application.cpp +++ b/source/Platform/Win32/Win32Application.cpp @@ -4,6 +4,8 @@ #include "Win32Mouse.h" #include "Win32Application.h" +namespace sp { + void Win32Application::init() { } @@ -94,3 +96,5 @@ LRESULT Win32Application::processMessage(MSG msg) // Message was not intercepted. Pass down to window. return DispatchMessage(&msg); } + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32Application.h b/source/Platform/Win32/Win32Application.h index f5056a2..c1e02b8 100644 --- a/source/Platform/Win32/Win32Application.h +++ b/source/Platform/Win32/Win32Application.h @@ -9,6 +9,8 @@ #include #include +namespace sp { + class Win32Application : public PlatformApplication { public : @@ -35,4 +37,6 @@ protected : MessageQueue m_messageQueue; }; +} // namespace sp + #endif /* WIN32_PLATFORM_H */ diff --git a/source/Platform/Win32/Win32Display.cpp b/source/Platform/Win32/Win32Display.cpp index fe866e3..ff4bd4a 100644 --- a/source/Platform/Win32/Win32Display.cpp +++ b/source/Platform/Win32/Win32Display.cpp @@ -9,6 +9,8 @@ #include "Win32Internal.h" #include "Win32Display.h" +namespace sp { + #define WND_CLASSNAME "SPECTRE_WIN32_WNDCLASS" static bool firstTime = true; @@ -258,3 +260,5 @@ LRESULT CALLBACK Win32Display::staticWndProc(HWND handle, UINT message, WPARAM w } return DefWindowProc(handle, message, wParam, lParam); } + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32Display.h b/source/Platform/Win32/Win32Display.h index 0ca06c4..7a08cb4 100644 --- a/source/Platform/Win32/Win32Display.h +++ b/source/Platform/Win32/Win32Display.h @@ -6,6 +6,8 @@ #include #include +namespace sp { + class Win32Display : public PlatformDisplay { public : @@ -63,4 +65,6 @@ protected : Vector2u m_minSize; }; +} // namespace sp + #endif /* PLATFORM_WIN32_DISPLAY_H */ diff --git a/source/Platform/Win32/Win32GLContext.cpp b/source/Platform/Win32/Win32GLContext.cpp index e894142..b9e9d79 100644 --- a/source/Platform/Win32/Win32GLContext.cpp +++ b/source/Platform/Win32/Win32GLContext.cpp @@ -7,6 +7,8 @@ #include "Win32Internal.h" #include "Win32GLContext.h" +namespace sp { + // Ensure that OpenGL extensions are loaded. static void ensureExtensionsLoaded(HDC dc) { @@ -175,4 +177,6 @@ bool Win32GLContext::setPixelFormat() return ::SetPixelFormat(m_deviceContext, format, &pfd); } return false; -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32GLContext.h b/source/Platform/Win32/Win32GLContext.h index e547956..6525c1e 100644 --- a/source/Platform/Win32/Win32GLContext.h +++ b/source/Platform/Win32/Win32GLContext.h @@ -7,6 +7,8 @@ #include #include +namespace sp { + class Win32GLContext : public GLContext { public : @@ -45,4 +47,6 @@ private : HGLRC m_renderContext; }; +} // namespace sp + #endif /* PLATFORM_WIN32_GLCONTEXT_H */ diff --git a/source/Platform/Win32/Win32Input.cpp b/source/Platform/Win32/Win32Input.cpp index ddefbe3..0474539 100644 --- a/source/Platform/Win32/Win32Input.cpp +++ b/source/Platform/Win32/Win32Input.cpp @@ -4,6 +4,8 @@ #include "Win32Mouse.h" #include "Win32Input.h" +namespace sp { + Win32InputMsgBuffer Win32Input::inputMsgBuffer; Win32InputMsgBuffer::Win32InputMsgBuffer() : @@ -24,4 +26,6 @@ Mouse* Win32Input::createMouse() void Win32Input::update() { -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32Input.h b/source/Platform/Win32/Win32Input.h index 0450150..21ad632 100644 --- a/source/Platform/Win32/Win32Input.h +++ b/source/Platform/Win32/Win32Input.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + #define WIN32_INPUT_BUFFER_QUEUE_MAX_SIZE 64 struct Win32InputMsgBuffer { @@ -29,4 +31,6 @@ public : static Win32InputMsgBuffer inputMsgBuffer; }; +} // namespace sp + #endif /* PLATFORM_WIN32_INPUT_H */ \ No newline at end of file diff --git a/source/Platform/Win32/Win32Keyboard.cpp b/source/Platform/Win32/Win32Keyboard.cpp index 5e0a47a..d9fef35 100644 --- a/source/Platform/Win32/Win32Keyboard.cpp +++ b/source/Platform/Win32/Win32Keyboard.cpp @@ -7,6 +7,8 @@ #include "Win32Keyboard.h" #include "Win32MsgBuffer.h" +namespace sp { + static Win32MsgBuffer msg_buf; static const Key::Type deviceToKey[256] = { @@ -117,3 +119,5 @@ bool Win32Keyboard::handleMessage(MSG message) { return msg_buf.postMessage(message); } + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32Keyboard.h b/source/Platform/Win32/Win32Keyboard.h index 2a61dd3..80cbd13 100644 --- a/source/Platform/Win32/Win32Keyboard.h +++ b/source/Platform/Win32/Win32Keyboard.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + class Win32Keyboard : public Keyboard { public : @@ -25,4 +27,6 @@ protected : bool m_hasFocus; }; +} // namespace sp + #endif /* PLATFORM_WIN32_KEYBOARD_H */ diff --git a/source/Platform/Win32/Win32Misc.cpp b/source/Platform/Win32/Win32Misc.cpp index 3ac163d..d20ad9c 100644 --- a/source/Platform/Win32/Win32Misc.cpp +++ b/source/Platform/Win32/Win32Misc.cpp @@ -2,6 +2,8 @@ #include #include +namespace sp { + void PlatformMisc::GetDisplayModes(std::vector& modes) { DEVMODE dev; @@ -20,3 +22,5 @@ DisplayMode PlatformMisc::GetDesktopMode() } return DisplayMode(); } + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32Mouse.cpp b/source/Platform/Win32/Win32Mouse.cpp index be2e4d1..e652f3d 100644 --- a/source/Platform/Win32/Win32Mouse.cpp +++ b/source/Platform/Win32/Win32Mouse.cpp @@ -6,6 +6,8 @@ #include "Win32Input.h" #include "Win32Mouse.h" +namespace sp { + static Win32MsgBuffer msg_buf; static Vector2f _normalizePos(int x, int y, RECT area) @@ -112,4 +114,6 @@ void Win32Mouse::update(InputModule *input) bool Win32Mouse::handleMessage(MSG message) { return msg_buf.postMessage(message); -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32Mouse.h b/source/Platform/Win32/Win32Mouse.h index 4efee5f..290103a 100644 --- a/source/Platform/Win32/Win32Mouse.h +++ b/source/Platform/Win32/Win32Mouse.h @@ -5,6 +5,8 @@ #include #include +namespace sp { + class Win32Mouse : public Mouse { public : @@ -31,4 +33,6 @@ protected : bool m_tracked; }; +} // namespace sp + #endif /* PLATFORM_WIN32_MOUSE_H */ diff --git a/source/Platform/Win32/Win32MsgBuffer.cpp b/source/Platform/Win32/Win32MsgBuffer.cpp index 81d3021..c3a68f2 100644 --- a/source/Platform/Win32/Win32MsgBuffer.cpp +++ b/source/Platform/Win32/Win32MsgBuffer.cpp @@ -2,6 +2,8 @@ #include #include "Win32MsgBuffer.h" +namespace sp { + Win32MsgBuffer::Win32MsgBuffer() : index (0) { @@ -15,4 +17,6 @@ bool Win32MsgBuffer::postMessage(MSG msg) } log("Win32MsgBuffer: Queue overflow\n"); return false; -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/Platform/Win32/Win32MsgBuffer.h b/source/Platform/Win32/Win32MsgBuffer.h index 5624e3b..9518f93 100644 --- a/source/Platform/Win32/Win32MsgBuffer.h +++ b/source/Platform/Win32/Win32MsgBuffer.h @@ -4,6 +4,8 @@ #include +namespace sp { + #define WIN32_MSG_BUFFER_MAX_SIZE 64 struct Win32MsgBuffer { @@ -15,4 +17,6 @@ struct Win32MsgBuffer { bool postMessage(MSG msg); }; +} // namespace sp + #endif /* PLATFORM_WIN32_MSG_BUFFER_H */ \ No newline at end of file diff --git a/source/Platform/Win32/Win32System.cpp b/source/Platform/Win32/Win32System.cpp index f78cef8..e1dab52 100644 --- a/source/Platform/Win32/Win32System.cpp +++ b/source/Platform/Win32/Win32System.cpp @@ -9,9 +9,11 @@ static LARGE_INTEGER getFrequency() { return freq; } -unsigned long System::getMilliseconds() +namespace sp { + +unsigned long system::getMilliseconds() { - static LARGE_INTEGER freq = getFrequency(); + static LARGE_INTEGER freq = ::getFrequency(); LARGE_INTEGER cnt; ::QueryPerformanceCounter(&cnt); @@ -19,10 +21,12 @@ unsigned long System::getMilliseconds() cnt.QuadPart *= 1000; cnt.QuadPart /= freq.QuadPart; - return (unsigned long) cnt.QuadPart; + return (unsigned long)cnt.QuadPart; } -void System::sleep(int milliseconds) +void system::sleep(int milliseconds) { ::Sleep(milliseconds); } + +} // namespace sp diff --git a/source/Scene/Camera2D.cpp b/source/Scene/Camera2D.cpp index 6cdfacd..7e4fd08 100644 --- a/source/Scene/Camera2D.cpp +++ b/source/Scene/Camera2D.cpp @@ -2,6 +2,8 @@ #include #include +namespace sp { + Camera2D::Camera2D() : m_position (0.0f, 0.0f), m_rotation (0.0f), @@ -171,4 +173,6 @@ const Transform& Camera2D::getTransform() const m_viewNeedsUpdate = false; } return m_view; -} \ No newline at end of file +} + +} // namespace sp \ No newline at end of file diff --git a/source/System/File.cpp b/source/System/File.cpp index fcea507..9d6f31d 100644 --- a/source/System/File.cpp +++ b/source/System/File.cpp @@ -3,7 +3,7 @@ #include #include -namespace File +namespace sp { namespace file { std::string getBasename(const std::string& path) { @@ -37,4 +37,4 @@ namespace File } return buf; } -}; +} } // namespace sp::file diff --git a/source/System/Log.cpp b/source/System/Log.cpp index 8be17f6..ee0ebce 100644 --- a/source/System/Log.cpp +++ b/source/System/Log.cpp @@ -3,11 +3,14 @@ #include #include -void log(const char *fmt, ...) { +namespace sp +{ + void log(const char *fmt, ...) { - va_list vl; + va_list vl; - va_start(vl, fmt); - vfprintf(stderr, fmt, vl); - va_end(vl); -} + va_start(vl, fmt); + vfprintf(stderr, fmt, vl); + va_end(vl); + } +} // namespace sp diff --git a/source/System/MessageHandler.cpp b/source/System/MessageHandler.cpp index 3660213..6965904 100644 --- a/source/System/MessageHandler.cpp +++ b/source/System/MessageHandler.cpp @@ -2,6 +2,10 @@ #include #include +namespace sp { + void MessageHandler::onSizeChanged(Display* display, int width, int height) { } + +} // namespace sp diff --git a/source/System/MessageQueue.cpp b/source/System/MessageQueue.cpp index a17f32f..fa547d3 100644 --- a/source/System/MessageQueue.cpp +++ b/source/System/MessageQueue.cpp @@ -1,6 +1,8 @@ #include +namespace sp { + void MessageQueue::postEvent(SysEvent& event) { m_queue.push_back(event); @@ -20,3 +22,5 @@ bool MessageQueue::isEmpty() const { return m_queue.empty(); } + +} // namespace sp \ No newline at end of file diff --git a/source/System/SystemEvent.cpp b/source/System/SystemEvent.cpp index 5a1e719..ad66452 100644 --- a/source/System/SystemEvent.cpp +++ b/source/System/SystemEvent.cpp @@ -1,7 +1,9 @@ #include -SysEvent::SysEvent(Type type) : +namespace sp { + +SysEvent::SysEvent(Type type) : type (type) { } @@ -14,3 +16,5 @@ SysEvent SysEvent::sizeEvent(Display *display, int width, int height) event.size.height = height; return event; } + +} // namespace sp \ No newline at end of file