Completed the button implementation for the help tooltips

Still need to fix the buttons in the panel
This commit is contained in:
Linus Probert 2018-10-10 22:34:41 +02:00
parent e845195823
commit e526c037e8
7 changed files with 29 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

7
assets/Extras/README.txt Normal file
View File

@ -0,0 +1,7 @@
The image files contained in this folder are created by Linus Probert (author
of BreakHack).
They are either modifications of the DanwLike tileset or completely original
content. Feel free to use them as you please. The images that are combined
from DawnLike assets should be handled under the same licensing rights as the
original works. The others are completely unencumbered.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -87,8 +87,9 @@ static char *skills_tooltip[] = {
" Skills are listed in the bar below the game screen.", "", " Skills are listed in the bar below the game screen.", "",
"", "",
"", "",
" SKILL INFO: SHIFT + <NUM>", "", " SKILL INFO: ", "SHIFT", " + <N>", "",
" Where <NUM> is the skill number (1-5)", "", " Where <N> is the button corresponding to the skill",
" Eg. ", "1", "2", "3", "4", "5", "",
"", "",
" DISABLE TOOLTIPS: CTRL + D", "", " DISABLE TOOLTIPS: CTRL + D", "",
"", "",
@ -104,11 +105,11 @@ static char *how_to_play_tooltip[] = {
"", "",
" ATTACK: Walk into a monster to attack it", "", " ATTACK: Walk into a monster to attack it", "",
"", "",
" HOLD TURN: Press SPACE", "", " HOLD TURN: Press ", "SPACE", "",
"", "",
" THROW DAGGER: Press 4 then chose a direction (nav keys)", "", " THROW DAGGER: Press ", "4", " then chose a direction (nav keys)", "",
"", "",
" DRINK HEALTH: Press 5 (if you need health and have potions)", "", " DRINK HEALTH: Press ", "5", " (if you need health and have potions)", "",
"", "",
" TOGGLE MUSIC: CTRL + M", "", " TOGGLE MUSIC: CTRL + M", "",
"", "",

View File

@ -26,12 +26,24 @@
static bool static bool
render_button_texture_for(const char *text, Position pos, Camera *cam) render_button_texture_for(const char *text, Position pos, Camera *cam)
{ {
Texture *t = texturecache_add("Characters/Player0.png"); Texture *t = texturecache_add("Extras/Controller.png");
SDL_Rect clip = CLIP16(0, 0); SDL_Rect clip;
if (strcmp(text, "1") == 0) { if (strcmp(text, "1") == 0) {
// no op clip = CLIP16(0, 0);
} else if (strcmp(text, "2") == 0) { } else if (strcmp(text, "2") == 0) {
clip = CLIP16(16, 0); clip = CLIP16(16, 0);
} else if (strcmp(text, "3") == 0) {
clip = CLIP16(32, 0);
} else if (strcmp(text, "4") == 0) {
clip = CLIP16(48, 0);
} else if (strcmp(text, "5") == 0) {
clip = CLIP16(48, 48);
} else if (strcmp(text, "ESC") == 0) {
clip = CLIP16(0, 64);
} else if (strcmp(text, "SHIFT") == 0) {
clip = CLIP16(16, 48);
} else if (strcmp(text, "SPACE") == 0) {
clip = CLIP16(16, 32);
} else { } else {
return false; return false;
} }
@ -81,7 +93,7 @@ tooltip_create(char **content, Camera *cam)
while (*content) { while (*content) {
if (strlen(*content) > 0) { if (strlen(*content) > 0) {
if (render_button_texture_for(*content, POS(renderBox.x, renderBox.y - 4), cam)) { if (render_button_texture_for(*content, POS(renderBox.x, renderBox.y - 4), cam)) {
renderBox.x += 24; renderBox.x += 16;
} else { } else {
load_texture_for(text, *content, &renderBox, cam->renderer); load_texture_for(text, *content, &renderBox, cam->renderer);
texture_render(text, &renderBox, cam); texture_render(text, &renderBox, cam);