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.
53 lines
976 B
C++
53 lines
976 B
C++
|
|
#ifndef SPECTRE_GRAPHICS_SPRITE_H
|
|
#define SPECTRE_GRAPHICS_SPRITE_H
|
|
|
|
#include <Spectre/Math/Color.h>
|
|
#include "Vertex2D.h"
|
|
#include "Renderable.h"
|
|
|
|
namespace sp {
|
|
|
|
class Texture;
|
|
|
|
class Sprite : public Renderable2D
|
|
{
|
|
public :
|
|
Sprite();
|
|
|
|
Sprite(const vec2f& pos, const vec2f& size);
|
|
|
|
void init();
|
|
|
|
void setSize(vec2f size);
|
|
|
|
void setColor(const Color& color);
|
|
|
|
void setTexture(const Texture& texture);
|
|
|
|
void setTextureCoords(const vec2u& pos, const vec2u& size);
|
|
|
|
virtual const Texture* getTexture() const;
|
|
|
|
virtual const std::vector<Vertex2D>& getVertices() const;
|
|
|
|
virtual const std::vector<unsigned short>& getIndices() const;
|
|
|
|
virtual const RenderType getRenderType() const { return RenderType_Scene; };
|
|
|
|
virtual void render(Renderer2D& renderer) const;
|
|
|
|
protected :
|
|
|
|
void updateGeometry();
|
|
|
|
std::vector<unsigned short> m_indicies;
|
|
|
|
std::vector<Vertex2D> m_vertices;
|
|
|
|
const Texture* m_texture;
|
|
};
|
|
|
|
} // namespace sp
|
|
|
|
#endif /* SPECTRE_GRAPHICS_SPRITE_H */
|