box aspect function
This commit is contained in:
parent
569e203409
commit
14759a1c79
25
README
25
README
|
@ -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,24 +90,25 @@ 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
|
||||
Works 3.0 license. See LICENSE_BPmono.txt for details.
|
||||
Included libraries are included under various permissive licenses:
|
||||
|
||||
gif-h is unlicensed, public domain code released under the The Unlicense. See
|
||||
lib/gif-h/LICENSE
|
||||
- BPmono.ttf is licensed under the Creative Commons Attribution - No Derivative
|
||||
Works 3.0 license. See LICENSE_BPmono.txt for details.
|
||||
|
||||
GLEW is included under a permissive license in lib/glew/LICENSE.txt
|
||||
- gif-h is unlicensed, public domain code released under the The Unlicense. See
|
||||
lib/gif-h/LICENSE
|
||||
|
||||
GLM is included under the MIT license in lib/glm/LICENSE
|
||||
- GLEW is included under a permissive license in lib/glew/LICENSE.txt
|
||||
|
||||
nlohmann's json library is included under the MIT license in
|
||||
lib/json/LICENSE.MIT
|
||||
- GLM is included under the MIT license in lib/glm/LICENSE
|
||||
|
||||
SDL2 GFX is included under a permissive license in lib/sdl2-gfx/LICENSE
|
||||
- nlohmann's json library is included under the MIT license in
|
||||
lib/json/LICENSE.MIT
|
||||
|
||||
superxbr.cpp is included under a permissive license at the top of
|
||||
lib/superxbr.cpp
|
||||
- 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
|
||||
lib/superxbr.cpp
|
||||
|
||||
Business
|
||||
````````
|
||||
|
|
|
@ -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 :)
|
||||
|
||||
|
|
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());
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue