HUD for currently selected spell

This commit is contained in:
Iris Lightshard 2018-12-19 10:17:49 -08:00
parent 7ec9628655
commit b8eb524afb
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
6 changed files with 18 additions and 1 deletions

View file

@ -92,6 +92,16 @@ void renderForeground()
drawFgObjects2(rightHere); 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() void interact()
{ {
while(SDL_PollEvent(&event)) while(SDL_PollEvent(&event))
@ -258,6 +268,8 @@ int init(int argc, char* args[])
nextArrow = loadImage("assets/img/windows/nextButton.gif"); nextArrow = loadImage("assets/img/windows/nextButton.gif");
selectArrow = loadImage("assets/img/windows/selectArrow.gif"); selectArrow = loadImage("assets/img/windows/selectArrow.gif");
loadingTxt = TTF_RenderText_Solid(font, "loading map data...", textColor); 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); hero = newPlayer("assets/img/characters/kmage.png", 160, 90);

View file

@ -18,6 +18,8 @@ void renderBackground();
void renderForeground(); void renderForeground();
void renderHUD();
void interact(); void interact();
void kListen(); void kListen();

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

View file

@ -14,4 +14,4 @@
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 180 #define SCREEN_HEIGHT 180
#define SOUND_ON //#define SOUND_ON

View file

@ -28,6 +28,7 @@ extern SDL_Surface* choiceBox;
extern SDL_Surface* nextArrow; extern SDL_Surface* nextArrow;
extern SDL_Surface* selectArrow; extern SDL_Surface* selectArrow;
extern SDL_Surface* loadingTxt; extern SDL_Surface* loadingTxt;
extern SDL_Surface* spellGlyphs;
#ifdef SOUND_ON #ifdef SOUND_ON
extern Mix_Music* menuBGM; extern Mix_Music* menuBGM;

2
main.c
View file

@ -41,6 +41,7 @@ SDL_Surface* choiceBox = NULL;
SDL_Surface* nextArrow = NULL; SDL_Surface* nextArrow = NULL;
SDL_Surface* selectArrow = NULL; SDL_Surface* selectArrow = NULL;
SDL_Surface* loadingTxt = NULL; SDL_Surface* loadingTxt = NULL;
SDL_Surface* spellGlyphs = NULL;
TTF_Font* font = NULL; TTF_Font* font = NULL;
SDL_Color textColor = {255, 255, 255}; SDL_Color textColor = {255, 255, 255};
@ -89,6 +90,7 @@ int main (int argc, char* args[])
movePlayer(hero, rightHere); movePlayer(hero, rightHere);
renderBackground(); renderBackground();
renderForeground(); renderForeground();
renderHUD();
SDL_Flip(screen); SDL_Flip(screen);
kListen(&kaosFlag); kListen(&kaosFlag);
pager(); pager();