Got this texture stuff working
This commit is contained in:
parent
0723f62559
commit
e845195823
60
src/main.c
60
src/main.c
|
@ -59,74 +59,74 @@
|
|||
#endif // STEAM_BUILD
|
||||
|
||||
static char *artifacts_tooltip[] = {
|
||||
"CONGRATULATIONS!",
|
||||
"CONGRATULATIONS!", "",
|
||||
"",
|
||||
" You just picked up your first artifact!",
|
||||
" You just picked up your first artifact!", "",
|
||||
"",
|
||||
" Your current artifacts and corresponding level are",
|
||||
" listed next to your skills."
|
||||
" Your current artifacts and corresponding level are", "",
|
||||
" listed next to your skills." "",
|
||||
"",
|
||||
"",
|
||||
" Artifacts have mystical effects that improve your offensive",
|
||||
" or defensive advantage in the dungeon. However it is sometimes",
|
||||
" hard to know what effect an artifact has.",
|
||||
" Artifacts have mystical effects that improve your offensive", "",
|
||||
" or defensive advantage in the dungeon. However it is sometimes", "",
|
||||
" hard to know what effect an artifact has.", "",
|
||||
"",
|
||||
"",
|
||||
" Perhaps an experienced dungeoner will know more?",
|
||||
" Perhaps an experienced dungeoner will know more?", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *skills_tooltip[] = {
|
||||
"CONGRATULATIONS!",
|
||||
"CONGRATULATIONS!", "",
|
||||
"",
|
||||
" You have aquired a new level and a new skill!",
|
||||
" You have aquired a new level and a new skill!", "",
|
||||
"",
|
||||
" Skills are listed in the bar below the game screen.",
|
||||
" Skills are listed in the bar below the game screen.", "",
|
||||
"",
|
||||
"",
|
||||
" SKILL INFO: SHIFT + <NUM>",
|
||||
" Where <NUM> is the skill number (1-5)",
|
||||
" SKILL INFO: SHIFT + <NUM>", "",
|
||||
" Where <NUM> is the skill number (1-5)", "",
|
||||
"",
|
||||
" DISABLE TOOLTIPS: CTRL + D",
|
||||
" DISABLE TOOLTIPS: CTRL + D", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *how_to_play_tooltip[] = {
|
||||
"HOW TO PLAY",
|
||||
"HOW TO PLAY", "",
|
||||
"",
|
||||
" NAVIGATION: Use ARROWS or WASD or HJKL to move",
|
||||
" NAVIGATION: Use ARROWS or WASD or HJKL to move", "",
|
||||
"",
|
||||
" 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", "",
|
||||
"",
|
||||
" TOGGLE SOUND: CTRL + S",
|
||||
" TOGGLE SOUND: CTRL + S", "",
|
||||
"",
|
||||
" TOGGLE FULLSCREEN: CTRL + F",
|
||||
" TOGGLE FULLSCREEN: CTRL + F", "",
|
||||
"",
|
||||
" TOGGLE MENU: ESC",
|
||||
" TOGGLE MENU: ", "ESC", "",
|
||||
"",
|
||||
" Your stats and inventory are listed in the right panel",
|
||||
" Your stats and inventory are listed in the right panel", "",
|
||||
"",
|
||||
"",
|
||||
" GOOD LUCK!",
|
||||
" May your death be quick and painless...",
|
||||
" GOOD LUCK!", "",
|
||||
" May your death be quick and painless...", "",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
162
src/skill.c
162
src/skill.c
|
@ -38,163 +38,163 @@
|
|||
#include "tooltip.h"
|
||||
|
||||
static char *flurry_tooltip[] = {
|
||||
"FLURRY",
|
||||
"FLURRY", "",
|
||||
"",
|
||||
" Hits an adjecant enemy with a flurry of three strikes.",
|
||||
" Each strike has the same odds of hitting as a regular attack",
|
||||
" Hits an adjecant enemy with a flurry of three strikes.", "",
|
||||
" Each strike has the same odds of hitting as a regular attack", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 5 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 5 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 1)",
|
||||
" followed by a direction (left, right, up or down)",
|
||||
"USAGE:", "",
|
||||
" activate the skill (press ", "1", ")", "",
|
||||
" followed by a direction (left, right, up or down)", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *bash_tooltip[] = {
|
||||
"BASH",
|
||||
"BASH", "",
|
||||
"",
|
||||
" Bashes an adjecant enemy with your shield",
|
||||
" On a successful hit the target will be stunned for 2 turns",
|
||||
" Bashes an adjecant enemy with your shield", "",
|
||||
" On a successful hit the target will be stunned for 2 turns", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 3 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 3 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 2)",
|
||||
" followed by a direction (left, right, up or down)",
|
||||
"USAGE:", "",
|
||||
" activate the skill (press ", "2", ")", "",
|
||||
" followed by a direction (left, right, up or down)", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *trip_tooltip[] = {
|
||||
"TRIP",
|
||||
"TRIP", "",
|
||||
"",
|
||||
" Trips an adjecant enemy causing him to fall (move), in",
|
||||
" the direction you tripped it in.",
|
||||
" On a successful hit the enemy will also be stunned."
|
||||
" Trips an adjecant enemy causing him to fall (move), in", "",
|
||||
" the direction you tripped it in.", "",
|
||||
" On a successful hit the enemy will also be stunned." "",
|
||||
"",
|
||||
" This can be combined with traps and pits to great effect.",
|
||||
" This can be combined with traps and pits to great effect.", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 3 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 3 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 2)",
|
||||
" followed by a direction (left, right, up or down)",
|
||||
"USAGE:", "",
|
||||
" activate the skill (press ", "2", ")", "",
|
||||
" followed by a direction (left, right, up or down)", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *backstab_tooltip[] = {
|
||||
"BACKSTAB",
|
||||
"BACKSTAB", "",
|
||||
"",
|
||||
" You flip over an adjecant enemy taking it's place and",
|
||||
" it taking yours, finnishing off with a stab in the back",
|
||||
" of your foe.",
|
||||
" A successful attack will also leave the enemy stunned."
|
||||
" You flip over an adjecant enemy taking it's place and", "",
|
||||
" it taking yours, finnishing off with a stab in the back", "",
|
||||
" of your foe.", "",
|
||||
" A successful attack will also leave the enemy stunned." "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 5 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 5 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 1)",
|
||||
" followed by a direction (left, right, up or down)",
|
||||
"USAGE:", "",
|
||||
" activate the skill (press ", "1", ")", "",
|
||||
" followed by a direction (left, right, up or down)", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *phase_tooltip[] = {
|
||||
"PHASE",
|
||||
"PHASE", "",
|
||||
"",
|
||||
" You phase out of existence for a time. While you are phased you",
|
||||
" are unaffected by gravity, traps and enemies won't see you.",
|
||||
" You can also pass through enemies.",
|
||||
" You phase out of existence for a time. While you are phased you", "",
|
||||
" are unaffected by gravity, traps and enemies won't see you.", "",
|
||||
" You can also pass through enemies.", "",
|
||||
"",
|
||||
" The effect lasts for 3 turns",
|
||||
" The effect lasts for 3 turns", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 8 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 8 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 3)",
|
||||
" then move as normal",
|
||||
" activate the skill (press ", "3", ")", "",
|
||||
" then move as normal", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *charge_tooltip[] = {
|
||||
"CHARGE",
|
||||
"CHARGE", "",
|
||||
"",
|
||||
" You charge in a chosen direction into the first obstructing",
|
||||
" object. Charging into an enemy can deliver massive damage.",
|
||||
" You charge in a chosen direction into the first obstructing", "",
|
||||
" object. Charging into an enemy can deliver massive damage.", "",
|
||||
"",
|
||||
" Damage is affected by charge distance.",
|
||||
" Longer distance, more damage.",
|
||||
" Damage is affected by charge distance.", "",
|
||||
" Longer distance, more damage.", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 5 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 5 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 3)",
|
||||
" followed by a direction (left, right, up or down)",
|
||||
" activate the skill (press ", "3", ")", "",
|
||||
" followed by a direction (left, right, up or down)", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *dagger_tooltip[] = {
|
||||
"THROW DAGGER",
|
||||
"THROW DAGGER", "",
|
||||
"",
|
||||
" You throw a dagger in the chosen direction.",
|
||||
" You throw a dagger in the chosen direction.", "",
|
||||
"",
|
||||
" Damage is affected by throwing distance.",
|
||||
" Longer distance, more damage.",
|
||||
" Damage is affected by throwing distance.", "",
|
||||
" Longer distance, more damage.", "",
|
||||
"",
|
||||
" Dagger supply is not infinite, your current dagger",
|
||||
" inventory is displayed in the panel to the right.",
|
||||
" Dagger supply is not infinite, your current dagger", "",
|
||||
" inventory is displayed in the panel to the right.", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 0 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 0 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" activate the skill (press 4)",
|
||||
" followed by a direction (left, right, up or down)",
|
||||
"USAGE:", "",
|
||||
" activate the skill (press ", "4", ")", "",
|
||||
" followed by a direction (left, right, up or down)", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *health_tooltip[] = {
|
||||
"DRINK HEALTH",
|
||||
"DRINK HEALTH", "",
|
||||
"",
|
||||
" You take a sip from your health vial",
|
||||
" You take a sip from your health vial", "",
|
||||
"",
|
||||
" The current amount of sips in your vials is",
|
||||
" dsplayed in the panel to the right.",
|
||||
" The current amount of sips in your vials is", "",
|
||||
" dsplayed in the panel to the right.", "",
|
||||
"",
|
||||
"COOLDOWN:",
|
||||
" 0 turns",
|
||||
"COOLDOWN:", "",
|
||||
" 0 turns", "",
|
||||
"",
|
||||
"USAGE:",
|
||||
" Sip health (press 5)",
|
||||
"USAGE:", "",
|
||||
" Sip health (press ", "5", ")", "",
|
||||
"",
|
||||
"",
|
||||
"Press ESC to close",
|
||||
"Press ", "ESC", " to close", "",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -30,11 +30,13 @@ render_button_texture_for(const char *text, Position pos, Camera *cam)
|
|||
SDL_Rect clip = CLIP16(0, 0);
|
||||
if (strcmp(text, "1") == 0) {
|
||||
// no op
|
||||
} else if (strcmp(text, "2") == 0) {
|
||||
clip = CLIP16(16, 0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_Rect renderBox = { pos.x, pos.y, 8, 8 };
|
||||
SDL_Rect renderBox = { pos.x, pos.y, 16, 16 };
|
||||
texture_render_clip(t, &renderBox, &clip, cam);
|
||||
return true;
|
||||
}
|
||||
|
@ -66,10 +68,10 @@ tooltip_create(char **content, Camera *cam)
|
|||
}
|
||||
|
||||
Sprite *sprite = gui_util_create_tooltip_frame_sprite(BOTTOM_GUI_WIDTH/16 - 6,
|
||||
(Uint32) ((rowCount * 10 + 48)/16),
|
||||
(Uint32) ((rowCount * 9 + 48)/16),
|
||||
cam);
|
||||
sprite->pos.x = 48;
|
||||
sprite->pos.y = 96;
|
||||
sprite->pos.y = 48;
|
||||
Texture *texture = sprite->textures[0];
|
||||
Texture *text = texture_create();
|
||||
texture_load_font(text, "GUI/SDS_8x8.ttf", LOG_FONT_SIZE, 0);
|
||||
|
@ -78,13 +80,17 @@ tooltip_create(char **content, Camera *cam)
|
|||
|
||||
while (*content) {
|
||||
if (strlen(*content) > 0) {
|
||||
if (!render_button_texture_for(*content, POS(renderBox.w, renderBox.y), cam)) {
|
||||
if (render_button_texture_for(*content, POS(renderBox.x, renderBox.y - 4), cam)) {
|
||||
renderBox.x += 24;
|
||||
} else {
|
||||
load_texture_for(text, *content, &renderBox, cam->renderer);
|
||||
texture_render(text, &renderBox, cam);
|
||||
}
|
||||
renderBox.x += text->dim.width;
|
||||
}
|
||||
} else {
|
||||
renderBox.x = 16;
|
||||
renderBox.y += 14;
|
||||
}
|
||||
|
||||
renderBox.y += 10;
|
||||
content++;
|
||||
}
|
||||
SDL_SetRenderTarget(cam->renderer, NULL);
|
||||
|
|
Loading…
Reference in New Issue