#include <rectf.hpp>
Public Member Functions | |
Rectf () | |
Rectf (const Vector &np1, const Vector &np2) | |
Rectf (float x1, float y1, float x2, float y2) | |
Rectf (const Vector &p1_, const Sizef &size) | |
float | get_left () const |
float | get_right () const |
float | get_top () const |
float | get_bottom () const |
float | get_width () const |
float | get_height () const |
Vector | get_middle () const |
void | set_pos (const Vector &v) |
void | set_height (float height) |
void | set_width (float width) |
void | set_size (float width, float height) |
Vector | get_size () |
void | move (const Vector &v) |
bool | contains (const Vector &v) const |
bool | contains (const Rectf &other) const |
float | distance (const Vector &other, AnchorPoint ap=ANCHOR_MIDDLE) const |
float | distance (const Rectf &other, AnchorPoint ap=ANCHOR_MIDDLE) const |
Public Attributes | |
Vector | p1 |
upper left edge | |
Vector | p2 |
lower right edge |
(Implementation Note) We're using upper left and lower right point instead of upper left and width/height here, because that makes the collision detection a little bit more efficient.
Definition at line 32 of file rectf.hpp.
Rectf::Rectf | ( | ) | [inline] |
Rectf::Rectf | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2 | |||
) | [inline] |
float Rectf::get_left | ( | ) | const [inline] |
Definition at line 53 of file rectf.hpp.
Referenced by check_collisions(), Tile::check_position_unisolid(), Sector::collision_tilemap(), GLRenderer::draw_filled_rect(), Background::draw_image(), get_anchor_pos(), get_hit_normal(), TileMap::get_tiles_overlapping(), Player::handle_input(), operator<<(), collision::rectangle_aatriangle(), collision::set_rectangle_rectangle_constraints(), and Player::try_grab().
float Rectf::get_right | ( | ) | const [inline] |
Definition at line 56 of file rectf.hpp.
Referenced by check_collisions(), Tile::check_position_unisolid(), Sector::collision_tilemap(), GLRenderer::draw_filled_rect(), Background::draw_image(), get_anchor_pos(), get_hit_normal(), TileMap::get_tiles_overlapping(), Player::handle_input(), operator<<(), collision::rectangle_aatriangle(), collision::set_rectangle_rectangle_constraints(), and Player::try_grab().
float Rectf::get_top | ( | ) | const [inline] |
Definition at line 59 of file rectf.hpp.
Referenced by check_collisions(), Tile::check_position_unisolid(), InvisibleBlock::collides(), UnstableTile::collision(), Brick::collision(), BonusBlock::collision(), Block::collision(), Sector::collision_tilemap(), GLRenderer::draw_filled_rect(), Background::draw_image(), get_anchor_pos(), get_hit_normal(), TileMap::get_tiles_overlapping(), Player::handle_input(), operator<<(), collision::rectangle_aatriangle(), and collision::set_rectangle_rectangle_constraints().
float Rectf::get_bottom | ( | ) | const [inline] |
Definition at line 62 of file rectf.hpp.
Referenced by GhostTree::active_update(), check_collisions(), Tile::check_position_unisolid(), InvisibleBlock::collides(), UnstableTile::collision(), Brick::collision(), BonusBlock::collision(), Block::collision(), Sector::collision_tilemap(), GLRenderer::draw_filled_rect(), Background::draw_image(), get_anchor_pos(), get_hit_normal(), TileMap::get_tiles_overlapping(), operator<<(), collision::rectangle_aatriangle(), collision::set_rectangle_rectangle_constraints(), Player::try_grab(), and Camera::update_scroll_normal().
float Rectf::get_width | ( | ) | const [inline] |
Definition at line 65 of file rectf.hpp.
References p1, p2, and Vector::x.
Referenced by GhostTree::active_update(), Player::adjust_height(), BicyclePlatform::BicyclePlatform(), Sector::collision_static_constrains(), Background::draw(), DrawingContext::draw_filled_rect(), Background::draw_image(), get_size(), Player::handle_input(), Dispenser::launch_badguy(), PneumaticPlatform::PneumaticPlatform(), Player::position_grabbed_object(), collision::rectangle_aatriangle(), and Block::start_bounce().
float Rectf::get_height | ( | ) | const [inline] |
Definition at line 68 of file rectf.hpp.
References p1, p2, and Vector::y.
Referenced by GhostTree::active_update(), Player::adjust_height(), PushButton::collision(), Sector::collision_static_constrains(), Fish::collision_tile(), Background::draw(), DrawingContext::draw_filled_rect(), Background::draw_image(), get_size(), Player::handle_input(), Player::position_grabbed_object(), collision::rectangle_aatriangle(), FlipLevelTransformer::transform_block(), FlipLevelTransformer::transform_moving_object(), FlipLevelTransformer::transform_platform(), FlipLevelTransformer::transform_sector(), FlipLevelTransformer::transform_tilemap(), and Camera::update_scroll_normal().
Vector Rectf::get_middle | ( | ) | const [inline] |
Definition at line 71 of file rectf.hpp.
References p1, p2, Vector::x, and Vector::y.
Referenced by GhostTree::active_update(), FlyingSnowBall::active_update(), Firefly::collision(), Stumpy::collision_squished(), PoisonIvy::collision_squished(), Yeti::drop_stalactite(), Explosion::explode(), get_anchor_pos(), BadGuy::is_offscreen(), MagicBlock::MagicBlock(), Candle::puff_smoke(), Block::start_bounce(), Mole::throw_rock(), Kugelblitz::try_activate(), BonusBlock::try_open(), Ispy::update(), and Camera::update_scroll_normal().
void Rectf::set_pos | ( | const Vector & | v | ) | [inline] |
Definition at line 74 of file rectf.hpp.
Referenced by BonusBlock::BonusBlock(), Brick::Brick(), Bullet::Bullet(), Door::Door(), Flame::Flame(), InfoBlock::InfoBlock(), InvisibleBlock::InvisibleBlock(), MovingSprite::MovingSprite(), Platform::Platform(), ScriptTrigger::ScriptTrigger(), SequenceTrigger::SequenceTrigger(), MovingObject::set_pos(), and ScriptedObject::set_pos().
void Rectf::set_height | ( | float | height | ) | [inline] |
void Rectf::set_width | ( | float | width | ) | [inline] |
void Rectf::set_size | ( | float | width, | |
float | height | |||
) | [inline] |
Definition at line 87 of file rectf.hpp.
References set_height(), and set_width().
Referenced by Block::Block(), Bullet::Bullet(), Climbable::Climbable(), Totem::collision_squished(), Dispenser::Dispenser(), Door::Door(), Firefly::Firefly(), Flower::Flower(), WalkingBadguy::initialize(), Stumpy::initialize(), InvisibleWall::InvisibleWall(), Totem::jump_off(), Totem::jump_on(), MovingSprite::MovingSprite(), PushButton::PushButton(), ScriptedObject::ScriptedObject(), ScriptTrigger::ScriptTrigger(), SecretAreaTrigger::SecretAreaTrigger(), SequenceTrigger::SequenceTrigger(), MovingObject::set_size(), MrIceBlock::set_state(), Switch::Switch(), and Wind::Wind().
00088 { 00089 set_width(width); 00090 set_height(height); 00091 }
Vector Rectf::get_size | ( | ) | [inline] |
Definition at line 92 of file rectf.hpp.
References get_height(), and get_width().
Referenced by Candle::draw(), MovingSprite::set_action_centered(), and BicyclePlatform::update().
00093 { 00094 return Vector(get_width(), get_height()); 00095 }
void Rectf::move | ( | const Vector & | v | ) | [inline] |
Definition at line 97 of file rectf.hpp.
Referenced by Player::adjust_height(), ParticleSystem_Interactive::collision(), Sector::collision_object(), Sector::collision_static_constrains(), TileMap::get_tiles_overlapping(), ScriptedObject::move(), MovingObject::set_pos(), and set_pos().
bool Rectf::contains | ( | const Vector & | v | ) | const [inline] |
bool Rectf::contains | ( | const Rectf & | other | ) | const [inline] |
float Rectf::distance | ( | const Vector & | other, | |
AnchorPoint | ap = ANCHOR_MIDDLE | |||
) | const [inline] |
Definition at line 117 of file rectf.hpp.
References get_anchor_pos().
00118 { 00119 Vector v = get_anchor_pos (*this, ap); 00120 return ((v - other).norm ()); 00121 }
float Rectf::distance | ( | const Rectf & | other, | |
AnchorPoint | ap = ANCHOR_MIDDLE | |||
) | const [inline] |
Definition at line 123 of file rectf.hpp.
References get_anchor_pos().
00124 { 00125 Vector v1 = get_anchor_pos (*this, ap); 00126 Vector v2 = get_anchor_pos (other, ap); 00127 00128 return ((v1 - v2).norm ()); 00129 }
upper left edge
Definition at line 135 of file rectf.hpp.
Referenced by WillOWisp::active_update(), Stalactite::active_update(), SSpiky::active_update(), Plant::active_update(), AngryStone::active_update(), Player::adjust_height(), BadGuy::BadGuy(), Igel::can_see(), Climbable::Climbable(), Dispenser::collision(), BadGuy::collision(), Kugelblitz::collision_player(), MrTree::collision_squished(), Sector::collision_static_constrains(), Sector::collision_tile_attributes(), contains(), Door::Door(), Switch::draw(), Door::draw(), InfoBoxLine::draw(), Player::draw(), InfoBlock::draw(), Menu::draw(), Font::draw_chars(), DrawingContext::draw_filled_rect(), Climbable::event(), IceCrusher::found_victim(), get_height(), get_left(), get_middle(), MovingObject::get_pos(), get_top(), get_width(), Player::handle_input(), IceCrusher::IceCrusher(), Sector::inside(), collision::intersects(), Ispy::intersects_line(), Owl::is_above_player(), Climbable::may_climb(), CaptainSnowball::might_climb(), BadGuy::might_fall(), move(), MovingSprite::MovingSprite(), collision::rectangle_aatriangle(), Rectf(), ScriptTrigger::ScriptTrigger(), SecretAreaTrigger::SecretAreaTrigger(), SequenceTrigger::SequenceTrigger(), Player::set_bonus(), set_height(), set_pos(), Toad::set_state(), set_width(), Block::start_bounce(), Switch::Switch(), Kugelblitz::try_activate(), BadGuy::try_activate(), Switch::update(), Wind::update(), Player::update(), InfoBlock::update(), and Wind::Wind().
lower right edge
Definition at line 137 of file rectf.hpp.
Referenced by WillOWisp::active_update(), Stalactite::active_update(), SSpiky::active_update(), Plant::active_update(), AngryStone::active_update(), Igel::can_see(), PneumaticPlatform::collision(), BicyclePlatform::collision(), Dispenser::collision(), BadGuy::collision(), Kugelblitz::collision_player(), MrTree::collision_squished(), Sector::collision_static_constrains(), Sector::collision_tile_attributes(), contains(), InfoBoxLine::draw(), Player::draw(), InfoBlock::draw(), Menu::draw(), Font::draw_chars(), Climbable::event(), IceCrusher::found_victim(), get_bottom(), get_height(), get_middle(), get_right(), get_width(), Player::handle_input(), collision::intersects(), Ispy::intersects_line(), Owl::is_above_player(), TitleScreen::make_tux_jump(), Climbable::may_climb(), CaptainSnowball::might_climb(), BadGuy::might_fall(), move(), collision::rectangle_aatriangle(), Rectf(), Player::set_bonus(), set_height(), Toad::set_state(), set_width(), Kugelblitz::try_activate(), BadGuy::try_activate(), Wind::update(), Player::update(), InfoBlock::update(), and Camera::update_scroll_normal().