aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-24 16:38:42 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-24 16:38:42 +0100
commit0b338bbd007048551526ab4fa4130d53b414e650 (patch)
tree1eabc6fcd6954de07cf1304435b1f70fd58e29f2 /render
parentf26a86bcc78c1946f55b6a399039e3bd8fb5dd16 (diff)
fire and movement animations
Diffstat (limited to 'render')
-rw-r--r--render/render_text.c5
-rw-r--r--render/render_text.h4
2 files changed, 4 insertions, 5 deletions
diff --git a/render/render_text.c b/render/render_text.c
index 6b801eb..c701fd7 100644
--- a/render/render_text.c
+++ b/render/render_text.c
@@ -50,15 +50,14 @@ void render_text_scaled (SDL_Renderer* rend, char str[],
}
}
-void render_text_small (SDL_Renderer* rend, char str[], float off[],
- SDL_Texture *texsmall)
+void render_text_small (SDL_Renderer* rend, char str[], float off[], txtd *t)
{
int width = 0;
for (int i=0; str[i]!='\0'; i++) {
int char_i = str[i];
SDL_Rect srcRect = { (char_i%32)*5+1, (char_i/32)*7+1, 4, 6 };
SDL_Rect dstRect = { off[0]+width, off[1], 4, 6 };
- SDL_RenderCopy(rend, texsmall, &srcRect, &dstRect);
+ SDL_RenderCopy(rend, t->tex_small, &srcRect, &dstRect);
width += 5;
}
} \ No newline at end of file
diff --git a/render/render_text.h b/render/render_text.h
index a9e952e..3cad87b 100644
--- a/render/render_text.h
+++ b/render/render_text.h
@@ -5,6 +5,7 @@
typedef struct {
SDL_Texture *tex;
+ SDL_Texture *tex_small;
int cw[128];
} txtd;
@@ -15,7 +16,6 @@ void render_text (SDL_Renderer* gRenderer, char str[], float off[], txtd *t);
void render_text_scaled (SDL_Renderer* gRenderer, char str[],
float off[], txtd *t, float scale);
-void render_text_small (SDL_Renderer* rend, char str[], float off[],
- SDL_Texture *texsmall);
+void render_text_small (SDL_Renderer* rend, char str[], float off[], txtd *t);
#endif \ No newline at end of file