box aspect function

This commit is contained in:
frank 2021-07-21 02:08:45 -04:00
parent 569e203409
commit 14759a1c79
4 changed files with 27 additions and 17 deletions

19
README
View File

@ -1,8 +1,10 @@
++~~~~~~~~~~~~~~~~~~~~~~~++
++~~~~~~~~~~~~~~~~~~~~~~~++
:: ::
:: SFW (SDL Framework) ::
:: ::
++~~~~~~~~~~~~~~~~~~~~~~~++
++~~~~~~~~~~~~~~~~~~~~~~~++
SFW is a C++ framework that facilitates the creation of SDL projects. It
provides generic game objects that can be used, extended or overwritten. Games
@ -88,25 +90,26 @@ License
The original code for this framework is licensed to freely use, copy, modify and
sell, without restriction under the zlib license. See LICENSE.txt for details.
BPmono.ttf is licensed under the Creative Commons Attribution - No Derivative
Included libraries are included under various permissive licenses:
- BPmono.ttf is licensed under the Creative Commons Attribution - No Derivative
Works 3.0 license. See LICENSE_BPmono.txt for details.
gif-h is unlicensed, public domain code released under the The Unlicense. See
- gif-h is unlicensed, public domain code released under the The Unlicense. See
lib/gif-h/LICENSE
GLEW is included under a permissive license in lib/glew/LICENSE.txt
- GLEW is included under a permissive license in lib/glew/LICENSE.txt
GLM is included under the MIT license in lib/glm/LICENSE
- GLM is included under the MIT license in lib/glm/LICENSE
nlohmann's json library is included under the MIT license in
- nlohmann's json library is included under the MIT license in
lib/json/LICENSE.MIT
SDL2 GFX is included under a permissive license in lib/sdl2-gfx/LICENSE
- SDL2 GFX is included under a permissive license in lib/sdl2-gfx/LICENSE
superxbr.cpp is included under a permissive license at the top of
- superxbr.cpp is included under a permissive license at the top of
lib/superxbr.cpp
Business
````````
420@shampoo.ooo

View File

@ -21,7 +21,7 @@
generate documentation from comments, get resource function, automatically
update animations, add arguments list to animation call, queue multiple calls
to animation, print list of chunk and music decoders available, allow nodes
that aren't connected to root
that aren't connected to root, add imagemagick to library, add curl to library
:) SWEATY HANDS :) OILY SNACKS :) AND BAD HYGIENE :)

View File

@ -57,11 +57,6 @@ glm::vec2 Box::get_size() const
return glm::vec2(get_w(), get_h());
}
float Box::get_area() const
{
return get_w() * get_h();
}
void Box::set_size(const glm::vec2& size, bool preserve_center)
{
glm::vec2 center = get_center();
@ -73,6 +68,17 @@ void Box::set_size(const glm::vec2& size, bool preserve_center)
}
}
/* Returns width divided by height regardless of which side is longer */
float Box::aspect() const
{
return get_w() / get_h();
}
float Box::get_area() const
{
return get_w() * get_h();
}
float Box::get_top() const
{
return get_y();

View File

@ -29,6 +29,7 @@ public:
void set_h(float);
glm::vec2 get_size() const;
void set_size(const glm::vec2&, bool = false);
float aspect() const;
float get_area() const;
float get_top() const;
float get_right() const;