Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
bomberman::Object Class Reference

Base class for objects. More...

#include <Object.h>

Inheritance diagram for bomberman::Object:
[legend]

Public Member Functions

 Object (SDL_Renderer *renderer)
 Construct a new object.
 
virtual ~Object ()
 Destroy the object.
 
void setSize (const int width, const int height)
 Set the Size of object.
 
void setPosition (const int x, const int y)
 Set the Position of object (integer)
 
void setPositionF (const float x, const float y)
 Set the Position of object (float/sub-pixel)
 
void setClip (const int width, const int height, const int x, const int y)
 Set the Clip of source texture.
 
void attachToCamera (bool isAttached=true)
 Attach object to camera movement.
 
void setVisible (bool isVisible)
 Toggle whether this object should currently be drawn.
 
bool isVisible () const
 Returns whether this object is currently drawable.
 
int getWidth () const
 Get the Width of object.
 
int getHeight () const
 Get the Height of object.
 
int getPositionX () const
 Get the Position X of object (integer)
 
int getPositionY () const
 Get the Position Y of object (integer)
 
float getPositionXF () const
 Get the Position X of object (float)
 
float getPositionYF () const
 Get the Position Y of object (float)
 
const SDL_Rect & getRect () const
 Get Rect of object.
 
SDL_FRect getRectF () const
 Get Rect of object (float position)
 
void setFlip (SDL_RendererFlip flip)
 Set the Flip object.
 
void setColorMod (Uint8 r, Uint8 g, Uint8 b)
 Set texture color modulation applied during draw.
 
virtual void update (const unsigned int delta)
 Update object.
 
void draw (const SDL_Rect &camera) const
 Draw object on the screen.
 

Protected Attributes

SDL_Renderer * renderer = nullptr
 
std::shared_ptr< SDL_Texture > texture = nullptr
 
SDL_Rect rect
 
SDL_Rect clip
 
SDL_RendererFlip flipping = SDL_FLIP_NONE
 
float positionX = 0.0f
 
float positionY = 0.0f
 
Uint8 colorModR = 0xFF
 
Uint8 colorModG = 0xFF
 
Uint8 colorModB = 0xFF
 

Detailed Description

Base class for objects.

Constructor & Destructor Documentation

◆ Object()

bomberman::Object::Object ( SDL_Renderer *  renderer)

Construct a new object.

Parameters
renderer- SDL2 renderer

Member Function Documentation

◆ attachToCamera()

void bomberman::Object::attachToCamera ( bool  isAttached = true)

Attach object to camera movement.

Parameters
isAttached- attach if true

◆ draw()

void bomberman::Object::draw ( const SDL_Rect &  camera) const

Draw object on the screen.

Parameters
SDL_Rect- camera position

◆ getHeight()

int bomberman::Object::getHeight ( ) const

Get the Height of object.

Returns
int - height

◆ getPositionX()

int bomberman::Object::getPositionX ( ) const

Get the Position X of object (integer)

Returns
int - position X

◆ getPositionXF()

float bomberman::Object::getPositionXF ( ) const

Get the Position X of object (float)

Returns
float - position X

◆ getPositionY()

int bomberman::Object::getPositionY ( ) const

Get the Position Y of object (integer)

Returns
int - position Y

◆ getPositionYF()

float bomberman::Object::getPositionYF ( ) const

Get the Position Y of object (float)

Returns
float - position Y

◆ getRect()

const SDL_Rect & bomberman::Object::getRect ( ) const

Get Rect of object.

Returns
SDL_Rect& - rect

◆ getRectF()

SDL_FRect bomberman::Object::getRectF ( ) const

Get Rect of object (float position)

Returns
SDL_FRect - rect with float position

◆ getWidth()

int bomberman::Object::getWidth ( ) const

Get the Width of object.

Returns
int - width

◆ setClip()

void bomberman::Object::setClip ( const int  width,
const int  height,
const int  x,
const int  y 
)

Set the Clip of source texture.

Parameters
width
height
x- position x
y- position y

◆ setFlip()

void bomberman::Object::setFlip ( SDL_RendererFlip  flip)

Set the Flip object.

Parameters
flip- flip of texture

◆ setPosition()

void bomberman::Object::setPosition ( const int  x,
const int  y 
)

Set the Position of object (integer)

Parameters
x- position x
y- position y

◆ setPositionF()

void bomberman::Object::setPositionF ( const float  x,
const float  y 
)

Set the Position of object (float/sub-pixel)

Parameters
x- position x
y- position y

◆ setSize()

void bomberman::Object::setSize ( const int  width,
const int  height 
)

Set the Size of object.

Parameters
width
height

◆ update()

void bomberman::Object::update ( const unsigned int  delta)
virtual

Update object.

Parameters
delta- time in milliseconds

Reimplemented in bomberman::Enemy, bomberman::Player, and bomberman::Sprite.


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