sprite edge setters

This commit is contained in:
Frank DeMarco 2020-08-01 19:30:16 -04:00
parent 555c1e51a3
commit cea0bb5a21
3 changed files with 32 additions and 8 deletions

View File

@ -4,14 +4,14 @@
game, screen + sprite wipes, screen offset, screen scale, networking, post game, screen + sprite wipes, screen offset, screen scale, networking, post
processing, all objects deactivatable, all objects subscribed to events, all processing, all objects deactivatable, all objects subscribed to events, all
objects resetable, wrapable & scrollable surface, separate window for objects resetable, wrapable & scrollable surface, separate window for
configuration console, text editor for config json, asset favoriting, audio configuration console and variable viewer, text editor for config json, asset
filters, enforce consistent angle orientation, floating point coordinates, favoriting, audio filters, enforce consistent angle orientation, floating
relative coordinates, relative lengths, relative sizes, delta time, specify point coordinates, relative coordinates, relative lengths, relative sizes,
config parameters on command line, effects chain, asset dict with metadata, delta time, specify config parameters on command line, effects chain, asset
move added sprite locations by offset when location is changed, gradients, dict with metadata, move added sprite locations by offset when location is
level select code input, logging, variable screen resolution, debug display, changed, gradients, level select code input, logging, variable screen
loading wheel animation, shadowed sprite, separate update and draw, sprite resolution, debug display, loading wheel animation, shadowed sprite, separate
movement cage update and draw, sprite movement cage
:) SWEATY HANDS :) OILY SNACKS :) AND BAD HYGIENE :) :) SWEATY HANDS :) OILY SNACKS :) AND BAD HYGIENE :)

View File

@ -280,6 +280,26 @@ glm::vec2 Sprite::get_center(int index)
return get_box(index).get_center(); return get_box(index).get_center();
} }
void Sprite::set_top(float top)
{
move({0, top - get_top()}, false);
}
void Sprite::set_right(float right)
{
move({right - get_right(), 0}, false);
}
void Sprite::set_bottom(float bottom)
{
move({0, bottom - get_bottom()}, false);
}
void Sprite::set_left(float left)
{
move({left - get_left(), 0}, false);
}
void Sprite::set_south(const glm::vec2& south) void Sprite::set_south(const glm::vec2& south)
{ {
move(south - get_south(), false); move(south - get_south(), false);

View File

@ -77,6 +77,10 @@ struct Sprite : Node
glm::vec2 get_south(int = 0); glm::vec2 get_south(int = 0);
glm::vec2 get_west(int = 0); glm::vec2 get_west(int = 0);
glm::vec2 get_center(int = 0); glm::vec2 get_center(int = 0);
void set_top(float);
void set_right(float);
void set_bottom(float);
void set_left(float);
void set_nw(const glm::vec2&); void set_nw(const glm::vec2&);
void set_ne(const glm::vec2&); void set_ne(const glm::vec2&);
void set_south(const glm::vec2&); void set_south(const glm::vec2&);