#include <specialriser.hpp>
Inherits GameObject.
Public Member Functions | |
SpecialRiser (Vector pos, MovingObject *child) | |
~SpecialRiser () | |
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 | |
SpecialRiser (const SpecialRiser &) | |
SpecialRiser & | operator= (const SpecialRiser &) |
Private Attributes | |
float | offset |
MovingObject * | child |
Definition at line 26 of file specialriser.hpp.
SpecialRiser::SpecialRiser | ( | Vector | pos, | |
MovingObject * | child | |||
) |
Definition at line 21 of file specialriser.cpp.
References offset, and MovingObject::set_pos().
00021 : 00022 offset(), 00023 child(_child) 00024 { 00025 _child->set_pos(pos - Vector(0, 32)); 00026 offset = 0; 00027 }
SpecialRiser::~SpecialRiser | ( | ) |
SpecialRiser::SpecialRiser | ( | const SpecialRiser & | ) | [private] |
void SpecialRiser::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 34 of file specialriser.cpp.
References Sector::add_object(), child, Sector::current(), offset, and GameObject::remove_me().
00035 { 00036 offset += 50 * elapsed_time; 00037 if(offset > 32) { 00038 Sector::current()->add_object(child); 00039 remove_me(); 00040 } 00041 }
void SpecialRiser::draw | ( | DrawingContext & | context | ) | [virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Definition at line 44 of file specialriser.cpp.
References child, GameObject::draw(), DrawingContext::get_translation(), offset, DrawingContext::pop_transform(), DrawingContext::push_transform(), and DrawingContext::set_translation().
00045 { 00046 context.push_transform(); 00047 context.set_translation( 00048 context.get_translation() + Vector(0, -32 + offset)); 00049 child->draw(context); 00050 context.pop_transform(); 00051 }
SpecialRiser& SpecialRiser::operator= | ( | const SpecialRiser & | ) | [private] |
float SpecialRiser::offset [private] |
MovingObject* SpecialRiser::child [private] |