1
0
Fork 0

Move everything from global namespace to "sp" namespace

When writing the X11 (linux) implementation there was a problem with X11 defining a "Display" type and we also have a Display class in the engine.

So to fix that problem and minimize the risk for running into other name conflicts. We move everything from global namespace.
This commit is contained in:
Henrik Hautakoski 2019-09-29 23:47:57 +02:00
parent 9da8addeb2
commit e10daeaaa6
No known key found for this signature in database
GPG key ID: 96765B12FEAC4745
120 changed files with 551 additions and 105 deletions

View file

@ -10,8 +10,9 @@
#include <Spectre/Math/Matrix4.h>
#include <vector>
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 */

View file

@ -5,6 +5,8 @@
#include <vector>
#include "Renderer2D.h"
namespace sp {
class DefaultRenderer2D : public Renderer2D
{
public :
@ -22,4 +24,6 @@ protected :
ShaderProgram m_shader;
};
} // namespace
#endif /* SPECTRE_DEFAULT_RENDERER2D_H */

View file

@ -10,6 +10,8 @@
#include <Spectre/Math/Vector2.h>
#include <Spectre/Graphics/Texture.h>
namespace sp {
class FontDriver;
// TODO: Fixup this api :)
@ -73,4 +75,6 @@ protected :
std::vector<unsigned char> m_rawData;
};
}
#endif /* SPECTRE_GRAPHCIS_FONT_H */

View file

@ -8,6 +8,8 @@
#include <Spectre/Math/Vector2.h>
#include <Spectre/Graphics/PixelFormat.h>
namespace sp {
class Image
{
public :
@ -59,4 +61,6 @@ private :
std::vector<unsigned char> m_pixels;
};
} //namespace sp
#endif /* SPECTRE_GRAPHICS_IMAGE_H */

View file

@ -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 */

View file

@ -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 */

View file

@ -8,6 +8,8 @@
#include <Spectre/Math/Vector2.h>
#include <vector>
namespace sp {
class Renderer2D;
class ShaderProgram;
class Texture;
@ -43,4 +45,6 @@ protected :
unsigned char m_zorder;
};
} // namespace sp
#endif /* SPECTRE_GRAPHCIS_RENDERABLE_H */

View file

@ -6,6 +6,8 @@
#include <Spectre/Graphics/ShaderProgram.h>
#include <Spectre/Scene/Camera2D.h>
namespace sp {
class Renderer2D
{
public :
@ -28,4 +30,6 @@ protected :
const Camera2D* m_camera;
};
} // namespace sp
#endif /* SPECTRE_GRAPHICS_RENDERER2D_H */

View file

@ -4,6 +4,8 @@
#include <string>
namespace sp {
class Shader
{
public :
@ -51,4 +53,6 @@ protected :
std::string m_error;
};
} // namespace sp
#endif /* SPECTRE_GRAPHICS_SHADER_H */

View file

@ -6,6 +6,8 @@
#include <Spectre/Math/Matrix4.h>
#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 */
} // namespace sp
#endif /* SPECTRE_GRAPHICS_SHADER_PROGRAM_H */

View file

@ -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 */

View file

@ -8,6 +8,8 @@
#include <Spectre/Graphics/Transformable.h>
#include <Spectre/Graphics/Renderable.h>
namespace sp {
class Text : public Renderable2D
{
public :
@ -88,4 +90,6 @@ private :
mutable std::vector<Vertex2D> m_vertices;
};
} // namespace sp
#endif /* SPECTRE_GRAPHICS_TEXT_H */

View file

@ -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 */

View file

@ -5,6 +5,8 @@
#include <Spectre/Math/Transform.h>
#include <Spectre/Math/Vector2.h>
namespace sp {
class Transformable
{
public :
@ -56,4 +58,6 @@ private :
mutable Transform m_transform;
};
} // namespace sp
#endif /* SPECTRE_GRAPHICS_TRANSFORMABLE_H */

View file

@ -5,6 +5,8 @@
#include <Spectre/Math/Vector2.h>
#include <Spectre/Math/Vector4.h>
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 */