11#include " Giraffe.hpp"
2+
3+ #include < cmath>
4+
25#include " Util/GameObject.hpp"
36#include " Util/Image.hpp"
7+ #include " Util/Logger.hpp"
48#include " Util/Text.hpp"
59#include " Util/Time.hpp"
610#include " Util/Transform.hpp"
11+
712#include " config.hpp"
813
914void GiraffeText::Update (const Util::Transform &transform) {
1015 auto &pos = m_Transform.translation ;
1116 auto &scale = m_Transform.scale ;
1217 auto &rotation = m_Transform.rotation ;
1318
14- pos + = transform.translation ;
15- rotation += transform. rotation ;
19+ pos = transform.translation ;
20+ // rotation = std::fmod( rotation + 50.0F, 360.0F) ;
1621 scale = transform.scale ;
1722
23+ LOG_DEBUG (" {} {}" , scale.x , scale.y );
24+
1825 m_Drawable->Draw (m_Transform, m_ZIndex);
1926}
2027
@@ -31,10 +38,12 @@ void Giraffe::Update([[maybe_unused]] const Util::Transform &transform) {
3138 auto &scale = m_Transform.scale ;
3239 auto &rotation = m_Transform.rotation ;
3340
34- if (pos.y > WINDOW_HEIGHT || pos.y + WINDOW_HEIGHT < 0 ) {
41+ if (pos.y >= static_cast <float >(WINDOW_HEIGHT) / 2 ||
42+ pos.y + static_cast <float >(WINDOW_HEIGHT) / 2 <= 0 ) {
3543 dir.y *= -1 ;
3644 }
37- if (pos.x > WINDOW_WIDTH || pos.x + WINDOW_WIDTH < 0 ) {
45+ if (pos.x >= static_cast <float >(WINDOW_WIDTH) / 2 ||
46+ pos.x + static_cast <float >(WINDOW_WIDTH) / 2 <= 0 ) {
3847 dir.x *= -1 ;
3948 }
4049
@@ -49,7 +58,7 @@ void Giraffe::Update([[maybe_unused]] const Util::Transform &transform) {
4958
5059 m_Drawable->Draw (m_Transform, m_ZIndex);
5160 for (auto &child : m_Children) {
52- child->Update (deltaTransform );
61+ child->Update (m_Transform );
5362 }
5463
5564 // LOG_DEBUG("GIRA: x: {}, y: {}", pos.x, pos.y);
0 commit comments