box aspect function
This commit is contained in:
parent
569e203409
commit
14759a1c79
19
README
19
README
|
@ -1,8 +1,10 @@
|
||||||
++~~~~~~~~~~~~~~~~~~~~~~~++
|
++~~~~~~~~~~~~~~~~~~~~~~~++
|
||||||
|
++~~~~~~~~~~~~~~~~~~~~~~~++
|
||||||
:: ::
|
:: ::
|
||||||
:: SFW (SDL Framework) ::
|
:: SFW (SDL Framework) ::
|
||||||
:: ::
|
:: ::
|
||||||
++~~~~~~~~~~~~~~~~~~~~~~~++
|
++~~~~~~~~~~~~~~~~~~~~~~~++
|
||||||
|
++~~~~~~~~~~~~~~~~~~~~~~~++
|
||||||
|
|
||||||
SFW is a C++ framework that facilitates the creation of SDL projects. It
|
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
|
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
|
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.
|
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.
|
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
|
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
|
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
|
lib/superxbr.cpp
|
||||||
|
|
||||||
|
|
||||||
Business
|
Business
|
||||||
````````
|
````````
|
||||||
420@shampoo.ooo
|
420@shampoo.ooo
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
generate documentation from comments, get resource function, automatically
|
generate documentation from comments, get resource function, automatically
|
||||||
update animations, add arguments list to animation call, queue multiple calls
|
update animations, add arguments list to animation call, queue multiple calls
|
||||||
to animation, print list of chunk and music decoders available, allow nodes
|
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 :)
|
:) SWEATY HANDS :) OILY SNACKS :) AND BAD HYGIENE :)
|
||||||
|
|
||||||
|
|
16
src/Box.cpp
16
src/Box.cpp
|
@ -57,11 +57,6 @@ glm::vec2 Box::get_size() const
|
||||||
return glm::vec2(get_w(), get_h());
|
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)
|
void Box::set_size(const glm::vec2& size, bool preserve_center)
|
||||||
{
|
{
|
||||||
glm::vec2 center = get_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
|
float Box::get_top() const
|
||||||
{
|
{
|
||||||
return get_y();
|
return get_y();
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
void set_h(float);
|
void set_h(float);
|
||||||
glm::vec2 get_size() const;
|
glm::vec2 get_size() const;
|
||||||
void set_size(const glm::vec2&, bool = false);
|
void set_size(const glm::vec2&, bool = false);
|
||||||
|
float aspect() const;
|
||||||
float get_area() const;
|
float get_area() const;
|
||||||
float get_top() const;
|
float get_top() const;
|
||||||
float get_right() const;
|
float get_right() const;
|
||||||
|
|
Loading…
Reference in New Issue