The ritual UI is now in its own thing, but not hooked up yet.
This commit is contained in:
parent
f1cc9f86c1
commit
263b7741f6
5 changed files with 156 additions and 73 deletions
|
@ -58,36 +58,11 @@ namespace gui {
|
|||
$ritual_ui = textures::get("ritual_crafting_area");
|
||||
$ritual_ui.sprite->setPosition({0,0});
|
||||
$ritual_ui.sprite->setTextureRect($ritual_closed_rect);
|
||||
$ritual_state = RitualUIState::CLOSED;
|
||||
$ritual_anim.simple = false;
|
||||
$ritual_anim.looped = false;
|
||||
$ritual_anim.easing = ease::NONE;
|
||||
$ritual_anim.stationary = true;
|
||||
$ritual_anim.texture_width = 380;
|
||||
$ritual_anim.frames = 3;
|
||||
$ritual_anim.speed = 0.2f;
|
||||
|
||||
$gui.init();
|
||||
}
|
||||
|
||||
void StatusUI::select_ritual() {
|
||||
using enum RitualUIState;
|
||||
|
||||
switch($ritual_state) {
|
||||
case OPEN:
|
||||
$ritual_state = CLOSING;
|
||||
break;
|
||||
case CLOSED:
|
||||
$ritual_state = OPENING;
|
||||
$ritual_anim.play();
|
||||
break;
|
||||
case OPENING: // ignored
|
||||
break;
|
||||
case CLOSING: // ignored
|
||||
break;
|
||||
default:
|
||||
dbc::sentinel("INVALID RitualUIState");
|
||||
}
|
||||
dbc::log("ritual selected but no way to trigger it yet");
|
||||
}
|
||||
|
||||
void StatusUI::select_slot(DinkyECS::Entity ent, any slot_name) {
|
||||
|
@ -152,44 +127,7 @@ namespace gui {
|
|||
}
|
||||
|
||||
void StatusUI::render(sf::RenderWindow &window) {
|
||||
sf::IntRect rect;
|
||||
sf::Vector2f scale{1.0, 1.0};
|
||||
sf::Vector2f pos{0, 0};
|
||||
|
||||
using enum RitualUIState;
|
||||
switch($ritual_state) {
|
||||
case OPEN: {
|
||||
rect = $ritual_open_rect;
|
||||
} break;
|
||||
case CLOSED: {
|
||||
$gui.render(window);
|
||||
rect = $ritual_closed_rect;
|
||||
}
|
||||
break;
|
||||
case OPENING: {
|
||||
$gui.render(window);
|
||||
if($ritual_anim.playing) {
|
||||
rect = $ritual_closed_rect;
|
||||
$ritual_anim.step(scale, pos, rect);
|
||||
} else {
|
||||
$ritual_state = OPEN;
|
||||
rect = $ritual_open_rect;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CLOSING: {
|
||||
$gui.render(window);
|
||||
rect = $ritual_closed_rect;
|
||||
$ritual_state = CLOSED;
|
||||
} break;
|
||||
default:
|
||||
dbc::sentinel("INVALID RitualUIState");
|
||||
}
|
||||
|
||||
$ritual_ui.sprite->setTextureRect(rect);
|
||||
$ritual_ui.sprite->setPosition(pos);
|
||||
$ritual_ui.sprite->setScale(scale);
|
||||
|
||||
$gui.render(window);
|
||||
window.draw(*$ritual_ui.sprite);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue