From e7d3c8a3b961c7252a5fd17bc4e25de616597b0e Mon Sep 17 00:00:00 2001 From: /nick haya <74699483+The-SGPT@users.noreply.github.com> Date: Mon, 7 Feb 2022 15:59:38 +0800 Subject: [PATCH] Added more documentation and make AnimatedObject support scaling --- bin/data/monogram.ttf | Bin 0 -> 41508 bytes src/Main.cpp | 8 +++++++- src/Render.cpp | 34 ++++++++++++++++++++++++++++++++++ src/Render.hpp | 21 +++++++++++++++++++-- 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 bin/data/monogram.ttf diff --git a/bin/data/monogram.ttf b/bin/data/monogram.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4d4a390a776329d59021b57a43552bbdf755c66b GIT binary patch literal 41508 zcmd^odzc+%ndke}Io&5oCnQa1LP8qS>4X3Yp_5Lhb8D!Cgqsl*0TFLBNs|PVP7Dbm z!!V^HA|g79s0_NO=qMs0I?8z48poM&U50gB*PX}Zanx~LmtlBzeH8h{loO(GOssCIg`Pi--k1Ua;$sHn%`|){w z&-e|8jvW(V_|Ok1O*7t9yB6oUNNwHzgS*CW|Jz+31pEhZzWTuUO^3{n`mIz}>lI@%^K-=Tdtnvi8W4>m-#WLr~E%Tm)?y4)3*}o6LR_M^J}r z8NTbcES&LL<}X){@g0?qrg@s-d#Qfc?zQB)1Z`dA(VX#>0T zmEY}21%F52w6cz0X!&9Fp6YqaoBn^em^Cq3!xjE5Rv#6)A7}LG#Zp&4SuFE#WwzWZ z51U)-rhaMt#Y<)_Ibq4dC8sTUc;MYbg19EKL>`bw@aa5!D&f<2^3!Agc2ijgDJx}_oP}t1whYM{Su4Y`PDW(CjLHVth{(5Dw#b;ABj>`mw#qg+PqxbrIbSZ2 z3*{oYSY9AI<%M#ITq-Y;7t3Yx61iNikSpb-a+SPHu9la}E98~(DtWbBBje!Z&2qck zA$Q8V5bHi5AC?cvN93dOpnOa|E)U5k_h8y(9}U@3OOp*WB(R;KlX?5C$dLw)T7<)mp?$`Pvy^H2fJi4d~!f; zG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zn_F0YVR%B$qna*d3e zL_Q+7$(!XXa9sS8+g*Su+4YEfc`yn^9}i?{0DhL{#Krp|1Q_bf0S>@-^r(8jsHXbSiURY zk^dxn<)7rA<*jl(wD=mRXFoLg0QC7E;cVPJIxE_ zQTdFy#9V4#WL|78GcPfhn=8zf=B4t#<=66K`LE_G^D=X_dAWIod8K)kd9}I5jGJrC zF02^GWlt`ILFYeA+x} zK4Ts;pEaK|e`Y>!zF;0Ve{Q~LzGS{^zGA*ApOr7jC(XY#x%mt8HS?F|>y4w6`-X9Zhj52Q zIH8AGJHp+wCPK5Z!;vvzkKH>g#0fq0Tu>0wv!`g!x*!0UwI?)ZU$E=ofdk`~*x7rc zlb#EUdwcd4?fQk+jvub?#jg9JBm4I6p6K4EhsH&YlYNepi!3MmtmrOsH1D&=)t z8kaie4?5;Awag#X!<d zJ-o!;b%P#yUQ&pz=Z2y^`|=3D>?6@h_vIGM5k1r|r%I1drB_&$9Zl&Nt~k7Ja!=P$?&n+)^EBsZeAc+ass5-v_Pn&9u;+DA`(;u4^+mh;YRl`*dYE-} zu-#cVhvv-j>-OziGc>ez*tgbjI8-0mr(4 zV_m?pKHRZB+_65~u|C|fKHM=Hs2UBlj0Rdp11+Ng@@RlO8X%7b$fE)Bh5&g(;CDm7 zu_55t5O8b=I5q?v8v>3E0mp`bV`IRvG2qx3aBK`XHU=CU1CEUW$HstTbPaRLS`>ip z=+8Cx;JW4>9M`$eH3#8*y*nRu#|`ed(H*zecN{%@aOU{o!v|ltf8x3$4Q(AgG)s?% z_wCtx#D2K@;Oi!N&oF4vs?i)frZuB2A&)~%XnWj=yK3wQw$}Wc-#+>eJpaZ`E4T9a J)Q=AC{y#M3F$@3z literal 0 HcmV?d00001 diff --git a/src/Main.cpp b/src/Main.cpp index d2f050d..cda78df 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -11,6 +11,7 @@ using namespace Render; class MainState : public State { AnimatedObject objs; + TextObject text; Object title; virtual void Create() { title.create(0, 0, "data/bg.png"); @@ -24,6 +25,11 @@ class MainState : public State { title.center.x = WINDOW_WIDTH/2; title.center.y = WINDOW_HEIGHT/2; + + text.create(50, 480 - 100, "funny"); + text.scale.x = 2; + text.scale.y = 2; + AddObject(&text); } int yvel = 0; int xvel = 0; @@ -46,7 +52,7 @@ class MainState : public State { }; int main() { - Init("lmfao"); + Init("SDLflixel :)))))"); MainState m; diff --git a/src/Render.cpp b/src/Render.cpp index 2b0c16d..e771b70 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -114,6 +114,40 @@ void Render::AnimatedObject::PlayAnimation(string anim_name) { current_framename = anim_name; } +void Render::TextObject::create(int x, int y, string text, string font_name) { + Render::Object::create(x,y,"data/smile.png"); // dummy + + font = TTF_OpenFont(font_name.c_str(), 25); + + SDL_Surface* temp = TTF_RenderText_Solid(font, text.c_str(), {255, 255, 255, 255}); + + this->text = text; + + this->_tex = SDL_CreateTextureFromSurface(renderer, temp); + SDL_FreeSurface(temp); + int w_, h_; + SDL_QueryTexture(this->_tex, NULL, NULL, &w_, &h_); + _sc_w = w_; + _sc_h = h_; + this->x = x; + this->y = y; + w = w_; + h = h_; +} + +void Render::TextObject::changeText(string text) { + SDL_Surface* temp = TTF_RenderText_Solid(font, text.c_str(), {255, 255, 255, 255}); + this->text = text; + this->_tex = SDL_CreateTextureFromSurface(renderer, temp); + SDL_FreeSurface(temp); + int w_, h_; + SDL_QueryTexture(this->_tex, NULL, NULL, &w_, &h_); + _sc_w = w_; + _sc_h = h_; + w = w_; + h = h_; +} + void Render::Object::centerSelf(AXIS axis) { switch (axis) { case X: diff --git a/src/Render.hpp b/src/Render.hpp index b6cba32..146d483 100644 --- a/src/Render.hpp +++ b/src/Render.hpp @@ -7,6 +7,7 @@ #include #include #include "SDL2/SDL.h" +#include "SDL2/SDL_ttf.h" #include "BASS/audio_out.h" using namespace std; @@ -47,7 +48,7 @@ namespace Render { /* * Create a new Object instance. */ - void create(int x = 0, int y = 0, string path = ""); + virtual void create(int x = 0, int y = 0, string path = ""); virtual void Draw(float dt); @@ -84,7 +85,7 @@ namespace Render { /* * Create a new AnimatedObject instance. */ - void create(int x = 0, int y = 0, string path = ""); + virtual void create(int x = 0, int y = 0, string path = ""); /* * Add an animation to said object. Uses SDL_Rects for frames. */ @@ -104,6 +105,22 @@ namespace Render { int startTime; }; + class TextObject : public Object { + public: + /* + * Create a new TextObject instance. + */ + virtual void create(int x = 0, int y = 0, string text = "", string font_name = "data/monogram.ttf"); + /* + * Change current text. !! TO AVOID MEMORY LEAKS, DO NOT RUN THIS EVERY FRAME! !! + */ + virtual void changeText(string text = ""); + + TTF_Font* font; + private: + string text = ""; + }; + /* * A state is where you would contain said objects. */