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