From b8eb524afbca75cb9f8630d433f4a8d5797251c7 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Wed, 19 Dec 2018 10:17:49 -0800 Subject: [PATCH] HUD for currently selected spell --- Engine.c | 12 ++++++++++++ Engine.h | 2 ++ assets/img/hud/spellbook.png | Bin 0 -> 535 bytes config.h | 2 +- extern.h | 1 + main.c | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 assets/img/hud/spellbook.png diff --git a/Engine.c b/Engine.c index 5803bb6..75365f6 100644 --- a/Engine.c +++ b/Engine.c @@ -92,6 +92,16 @@ void renderForeground() drawFgObjects2(rightHere); } +void renderHUD() +{ + SDL_Rect clip; + clip.x = bookMark*16;; + clip.y = 0; + clip.w = 16; + clip.h = 16; + applySurface(300,160, spellGlyphs, screen, &clip); +} + void interact() { while(SDL_PollEvent(&event)) @@ -258,6 +268,8 @@ int init(int argc, char* args[]) nextArrow = loadImage("assets/img/windows/nextButton.gif"); selectArrow = loadImage("assets/img/windows/selectArrow.gif"); loadingTxt = TTF_RenderText_Solid(font, "loading map data...", textColor); + spellGlyphs = loadImage("assets/img/hud/spellbook.png"); + SDL_SetAlpha(spellGlyphs, SDL_SRCALPHA|SDL_RLEACCEL, 156); hero = newPlayer("assets/img/characters/kmage.png", 160, 90); diff --git a/Engine.h b/Engine.h index f083e8d..f6eaf82 100644 --- a/Engine.h +++ b/Engine.h @@ -18,6 +18,8 @@ void renderBackground(); void renderForeground(); +void renderHUD(); + void interact(); void kListen(); diff --git a/assets/img/hud/spellbook.png b/assets/img/hud/spellbook.png new file mode 100644 index 0000000000000000000000000000000000000000..7cd1298150caa4b2c7bebdca5d6e1aea3cc83afc GIT binary patch literal 535 zcmV+y0_gpTP)000mI0{{R3>}#CM00009P)t-s003vF zr>Fn_|J!c<)c^nh0d!JMQvg8b*k%9#00Cl4M??UK1szBL000SaNLh0L04^f{04^f| zc%?sf00007bV*G`2jUD95itW&w3-$G000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2H zM@dakSAh-}0004ENklYU;w3I$YJbLRT5_^iGq4*R- zPSsN{g~rn&D6voJ%x+p0bdybXcE6pOoqs_k{%($b+f?=wspzNsUJ!dkj%!rT0e=p> zuXN%@jIfu;JIb;wfOB;~%MTD=ffi$6GN_CqFJNr}G|yeCV6g-f@&p6H1{ZJ+XezcG z16)xBPr7@#3m`|3!80J~=4iacGbBB@ilD>b;dB8C;Pi=!*&)^34DzYvvx7U4GX)>V z2F_-Jb}z(hhtJo(1bSeS9j0|%JJ5da74)4@QCH@X>N=Lk%0|$GjvTXE8i1+Ud2DaR za-_EPv|f9SZ}jE>nifnimB*wGmU^tLYghxLM+yQtN7wg)qzt9eTsKq{2hd}b^CjMF zoQZ