HUD for currently selected spell
This commit is contained in:
parent
7ec9628655
commit
b8eb524afb
6 changed files with 18 additions and 1 deletions
12
Engine.c
12
Engine.c
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
|
2
Engine.h
2
Engine.h
|
@ -18,6 +18,8 @@ void renderBackground();
|
||||||
|
|
||||||
void renderForeground();
|
void renderForeground();
|
||||||
|
|
||||||
|
void renderHUD();
|
||||||
|
|
||||||
void interact();
|
void interact();
|
||||||
|
|
||||||
void kListen();
|
void kListen();
|
||||||
|
|
BIN
assets/img/hud/spellbook.png
Normal file
BIN
assets/img/hud/spellbook.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 535 B |
2
config.h
2
config.h
|
@ -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
|
||||||
|
|
1
extern.h
1
extern.h
|
@ -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
2
main.c
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue