aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-19 18:30:53 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-19 18:30:53 +0100
commit5126638d46398579c26d3c7bd908fe17b8508b13 (patch)
treefbb9e981187f32bf78dc521ff538ea31de9c0019 /main.c
parent5f0fce4191309e9526b7109a0d87c092ce6a4193 (diff)
battery calc and unstable levels
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/main.c b/main.c
index 2e92bc1..eb8e458 100644
--- a/main.c
+++ b/main.c
@@ -50,6 +50,11 @@ int main( int argc, char* args[] ) {
txtd textd; char_width_init(textd.cw);
SDL_Surface* image = SDL_LoadBMP("content/gf.bmp");
textd.tex = SDL_CreateTextureFromSurface(rend, image);
+ SDL_SetTextureColorMod(textd.tex, 0, 0, 0);
+
+ SDL_Surface* imagesmall = SDL_LoadBMP("content/gfsmall.bmp");
+ SDL_Texture* txsmall = SDL_CreateTextureFromSurface(rend, imagesmall);
+ SDL_SetTextureColorMod(txsmall, 0, 0, 0);
SDL_Surface* sprites = SDL_LoadBMP("content/sprites.bmp");
SDL_Texture* txsprites = SDL_CreateTextureFromSurface(rend, sprites);
@@ -200,14 +205,21 @@ int main( int argc, char* args[] ) {
/ info_unit_get_health(&info, &ar->us[i].info);
SDL_Rect hprect = {
(int)x-posx, (int)y-posy+ts-5,
- ts*amt, 5 };
+ ts*amt, 6 };
int sw = 1 ? ar->us[i].owner : 0;
SDL_SetRenderDrawColor(rend, 255*sw, 255*(1-sw), 0, 255);
SDL_RenderFillRect(rend, &hprect);
+ SDL_SetTextureColorMod(txsmall, 0, 100, 0);
char shp[32]; sprintf(shp, "%.0f", ar->us[i].hp);
float php[2] = { (int)x-posx, (int)y-posy+ts-5 };
- render_text_scaled(rend, shp, php, &textd, 1);
+ render_text_small(rend, shp, php, txsmall);
+
+ SDL_SetTextureColorMod(txsmall, 255, 160, 0);
+ char sch[32]; sprintf(sch, "%.0f", ar->us[i].charge);
+ float pch[2] = { (int)x-posx, (int)y-posy+ts+1 };
+ render_text_small(rend, sch, pch, txsmall);
+ SDL_SetTextureColorMod(txsmall, 0, 0, 0);
}
hud_render(&_hud, rend, &textd, &mkb, &info, txsprites);