added get point on circle function
This commit is contained in:
parent
df8bf267f0
commit
c6341d2bfc
|
@ -9,11 +9,11 @@
|
|||
point coordinates, relative coordinates, relative lengths, relative sizes,
|
||||
delta time, specify config parameters on command line, effects chain, asset
|
||||
dict with metadata, move added sprite locations by offset when location is
|
||||
changed, gradients, level select code input, logging, variable screen
|
||||
resolution, debug display, loading wheel animation, shadowed sprite, separate
|
||||
update and draw, sprite movement cage, multiple windows, multiple renderers,
|
||||
node children list, node animations list, copy constructor for all base
|
||||
classes, private and public class members, pixel class iterator, sprite
|
||||
changed, gradients, level select code input, log to stdout and file, variable
|
||||
screen resolution, debug display, loading wheel animation, shadowed sprite,
|
||||
separate update and draw, sprite movement cage, multiple windows, multiple
|
||||
renderers, node children list, node animations list, copy constructor for all
|
||||
base classes, private and public class members, pixel class iterator, sprite
|
||||
movement history, input history, use seconds instead of milliseconds, store
|
||||
a node's animations in list, frame object for sprite class, inline short
|
||||
functions, add box2d to library, load in separate thread and display progress
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <cstdlib>
|
||||
|
||||
#include "sdl2-gfx/SDL2_gfxPrimitives.h"
|
||||
|
||||
#include "Pixels.hpp"
|
||||
|
@ -8,6 +10,11 @@ void sfw::set_magnitude(glm::vec2& vector, float magnitude)
|
|||
vector = glm::normalize(vector) * magnitude;
|
||||
}
|
||||
|
||||
glm::vec2 sfw::get_point_on_circle(const glm::vec2& center, float radius, float angle)
|
||||
{
|
||||
return {center.x + std::sin(angle) * radius, center.y - std::cos(angle) * radius};
|
||||
}
|
||||
|
||||
Box sfw::get_texture_box(SDL_Texture* texture)
|
||||
{
|
||||
int width, height;
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace sfw
|
|||
enum scaler {scale2x, xbr};
|
||||
|
||||
void set_magnitude(glm::vec2&, float);
|
||||
glm::vec2 get_point_on_circle(const glm::vec2&, float, float);
|
||||
Box get_texture_box(SDL_Texture*);
|
||||
glm::vec2 fit_and_preserve_aspect(const glm::vec2&, const glm::vec2&);
|
||||
std::vector<std::vector<Box>> get_blinds_boxes(glm::vec2, float = 0.05f, int = 4);
|
||||
|
|
Loading…
Reference in New Issue