GameKit  0.0.1a
C++ gamedev tools
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
gk::Image Class Reference

#include <Image.hpp>

Inheritance diagram for gk::Image:
gk::IDrawable gk::Transformable gk::Sprite

Public Member Functions

 Image ()=default
 
 Image (const std::string &textureName)
 
 Image (const Texture &texture)
 
void load (const Image &image)
 
void load (const std::string &textureName)
 
void load (const Texture &texture)
 
const FloatRectclipRect () const
 
void setClipRect (float x, float y, u16 width, u16 height)
 
const FloatRectposRect () const
 
void setPosRect (float x, float y, u16 width, u16 height)
 
u16 width () const
 
u16 height () const
 
void setColor (const Color &color)
 
void setAlphaMod (u8 alpha)
 
void setFlip (bool isFlipped)
 
- Public Member Functions inherited from gk::IDrawable
virtual ~IDrawable ()=default
 Virtual destructor. More...
 
- Public Member Functions inherited from gk::Transformable
virtual ~Transformable ()=default
 
void setPosition (float x, float y, float z=0)
 
void setPosition (const Vector3f &position)
 
void setOrigin (float x, float y, float z=0)
 
void setOrigin (const Vector3f &origin)
 
void setScale (float factorX, float factorY, float factorZ=1)
 
void setScale (const Vector3f &factors)
 
void setRotation (float angle)
 
void setRotation (float angle, const Vector3f &axis)
 
const Vector3fgetPosition () const
 
const Vector3fgetOrigin () const
 
const Vector3fgetScale () const
 
float getRotation () const
 
void move (float offsetX, float offsetY, float offsetZ=0)
 
void move (const Vector3f &offset)
 
void scale (float factorX, float factorY, float factorZ=1)
 
void scale (const Vector3f &factor)
 
void rotate (float angle)
 
void rotate (float angle, const Vector3f &axis)
 
const TransformgetTransform () const
 

Protected Member Functions

void updateVertexBuffer () const
 
void draw (RenderTarget &target, RenderStates states) const override
 Draw the object to a render target. More...
 

Protected Attributes

const Texturem_texture = nullptr
 
VertexBuffer m_vbo
 

Private Attributes

u16 m_width = 0
 
u16 m_height = 0
 
FloatRect m_clipRect
 
FloatRect m_posRect
 
Color m_color
 
bool m_isFlipped = false
 

Detailed Description

Definition at line 25 of file Image.hpp.

Constructor & Destructor Documentation

§ Image() [1/3]

gk::Image::Image ( )
default

§ Image() [2/3]

gk::Image::Image ( const std::string &  textureName)

Definition at line 25 of file Image.cpp.

§ Image() [3/3]

gk::Image::Image ( const Texture texture)

Definition at line 29 of file Image.cpp.

Member Function Documentation

§ clipRect()

const FloatRect& gk::Image::clipRect ( ) const
inline

Definition at line 35 of file Image.hpp.

§ draw()

void gk::Image::draw ( RenderTarget target,
RenderStates  states 
) const
overrideprotectedvirtual

Draw the object to a render target.

This is a pure virtual function that has to be implemented by the derived class to define how the drawable should be drawn.

Parameters
targetRender target to draw to
statesCurrent render states

Implements gk::IDrawable.

Definition at line 124 of file Image.cpp.

§ height()

u16 gk::Image::height ( ) const
inline

Definition at line 42 of file Image.hpp.

§ load() [1/3]

void gk::Image::load ( const Image image)

Definition at line 33 of file Image.cpp.

§ load() [2/3]

void gk::Image::load ( const std::string &  textureName)

Definition at line 47 of file Image.cpp.

§ load() [3/3]

void gk::Image::load ( const Texture texture)

Definition at line 51 of file Image.cpp.

§ posRect()

const FloatRect& gk::Image::posRect ( ) const
inline

Definition at line 38 of file Image.hpp.

§ setAlphaMod()

void gk::Image::setAlphaMod ( u8  alpha)
inline

Definition at line 45 of file Image.hpp.

§ setClipRect()

void gk::Image::setClipRect ( float  x,
float  y,
u16  width,
u16  height 
)

Definition at line 61 of file Image.cpp.

§ setColor()

void gk::Image::setColor ( const Color color)
inline

Definition at line 44 of file Image.hpp.

§ setFlip()

void gk::Image::setFlip ( bool  isFlipped)
inline

Definition at line 46 of file Image.hpp.

§ setPosRect()

void gk::Image::setPosRect ( float  x,
float  y,
u16  width,
u16  height 
)

Definition at line 70 of file Image.cpp.

§ updateVertexBuffer()

void gk::Image::updateVertexBuffer ( ) const
protected

Definition at line 76 of file Image.cpp.

§ width()

u16 gk::Image::width ( ) const
inline

Definition at line 41 of file Image.hpp.

Member Data Documentation

§ m_clipRect

FloatRect gk::Image::m_clipRect
private

Definition at line 61 of file Image.hpp.

§ m_color

Color gk::Image::m_color
private

Definition at line 64 of file Image.hpp.

§ m_height

u16 gk::Image::m_height = 0
private

Definition at line 59 of file Image.hpp.

§ m_isFlipped

bool gk::Image::m_isFlipped = false
private

Definition at line 66 of file Image.hpp.

§ m_posRect

FloatRect gk::Image::m_posRect
private

Definition at line 62 of file Image.hpp.

§ m_texture

const Texture* gk::Image::m_texture = nullptr
protected

Definition at line 53 of file Image.hpp.

§ m_vbo

VertexBuffer gk::Image::m_vbo
protected

Definition at line 55 of file Image.hpp.

§ m_width

u16 gk::Image::m_width = 0
private

Definition at line 58 of file Image.hpp.


The documentation for this class was generated from the following files: