#include <broken_brick.hpp>
Inherits GameObject.
Public Member Functions | |
BrokenBrick (SpritePtr sprite, const Vector &pos, const Vector &movement) | |
~BrokenBrick () | |
virtual void | update (float elapsed_time) |
This function is called once per frame and allows the object to update it's state. | |
virtual void | draw (DrawingContext &context) |
The GameObject should draw itself onto the provided DrawingContext if this function is called. | |
Private Member Functions | |
BrokenBrick (const BrokenBrick &) | |
BrokenBrick & | operator= (const BrokenBrick &) |
Private Attributes | |
Timer | timer |
SpritePtr | sprite |
Vector | position |
Vector | movement |
Definition at line 28 of file broken_brick.hpp.
BrokenBrick::~BrokenBrick | ( | ) |
BrokenBrick::BrokenBrick | ( | const BrokenBrick & | ) | [private] |
void BrokenBrick::update | ( | float | elapsed_time | ) | [virtual] |
This function is called once per frame and allows the object to update it's state.
The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)
Implements GameObject.
Definition at line 37 of file broken_brick.cpp.
References Timer::check(), movement, position, GameObject::remove_me(), and timer.
00038 { 00039 position += movement * elapsed_time; 00040 00041 if (timer.check()) 00042 remove_me(); 00043 }
void BrokenBrick::draw | ( | DrawingContext & | context | ) | [virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Definition at line 46 of file broken_brick.cpp.
References graphicsRandom, LAYER_OBJECTS, position, RandomGenerator::rand(), and sprite.
00047 { 00048 sprite->draw_part(context, 00049 Vector(graphicsRandom.rand(16), graphicsRandom.rand(16)), Vector(16, 16), 00050 position, LAYER_OBJECTS + 1); 00051 }
BrokenBrick& BrokenBrick::operator= | ( | const BrokenBrick & | ) | [private] |
Timer BrokenBrick::timer [private] |
SpritePtr BrokenBrick::sprite [private] |
Vector BrokenBrick::position [private] |
Vector BrokenBrick::movement [private] |