Compare commits

..

No commits in common. "8fdaadaf12e57cb0ad22b0b68fbf461a9a900b6a" and "e6072c9f1e4c29e038d6125fb0215e6f8075d0a8" have entirely different histories.

6 changed files with 21 additions and 34 deletions

View file

@ -277,9 +277,9 @@
"frame_height": 1080
},
"test_story":
{"path": "assets/story/rat_king_fight.jpg",
"frame_width": 3840,
"frame_height": 2160
{"path": "assets/story/test_storyboard.png",
"frame_width": 1280,
"frame_height": 720
}
},
"worldgen": {

View file

@ -213,9 +213,6 @@ namespace gui {
void FSM::BOSS_FIGHT(Event ev, std::any data) {
dbc::check($boss_fight != nullptr, "$boss_fight not initialized");
if($boss_scene->playing()) return;
$boss_fight->mouse_pos = mouse_position();
if(ev == gui::Event::QUIT) {
@ -383,6 +380,9 @@ namespace gui {
}
void FSM::draw_gui() {
if(in_state(State::BOSS_FIGHT)) {
$boss_fight->render($window);
} else {
if($debug_ui.active) {
debug_render();
} else {
@ -399,15 +399,12 @@ namespace gui {
$map_ui.render($window, $main_ui.$compass_dir);
}
}
}
void FSM::render() {
if(in_state(State::BOSS_FIGHT)) {
$window.clear();
if($boss_scene->playing()) {
$boss_scene->render($window);
} else {
$boss_fight->render($window);
}
} else {
draw_gui();
}
@ -541,10 +538,7 @@ namespace gui {
void FSM::next_level(bool bossfight) {
if(bossfight) {
$boss_scene = std::make_shared<storyboard::UI>("rat_king");
$boss_fight = boss::System::create_bossfight();
$boss_scene->init();
dbc::check($boss_scene->playing(), "boss scene doesn't play");
} else {
GameDB::create_level();
$status_ui.update_level();

View file

@ -12,7 +12,6 @@
#include "events.hpp"
#include "gui/event_router.hpp"
#include "gui/dnd_loot.hpp"
#include "storyboard/ui.hpp"
namespace gui {
enum class State {
@ -37,7 +36,6 @@ namespace gui {
DebugUI $debug_ui;
MainUI $main_ui;
std::shared_ptr<boss::Fight> $boss_fight = nullptr;
std::shared_ptr<storyboard::UI> $boss_scene = nullptr;
CombatUI $combat_ui;
StatusUI $status_ui;
MapViewUI $map_ui;

View file

@ -41,16 +41,12 @@ namespace storyboard {
$camera.render($view_texture);
$ui.render($view_texture);
// $ui.debug_layout($view_texture);
$ui.debug_layout($view_texture);
$view_texture.display();
window.draw($view_sprite);
}
bool UI::playing() {
return $audio->getStatus() == sf::SoundSource::Status::Playing;
}
sf::Time parse_time_code(const std::string& time) {
std::chrono::seconds out{};

View file

@ -26,7 +26,6 @@ namespace storyboard {
void zoom(const std::string &cell_name);
void reset();
void track_audio();
bool playing();
};
}

View file

@ -29,7 +29,8 @@ int main(int, char*[]) {
storyboard::UI main("rat_king");
main.init();
while(main.playing()) {
while(true) {
while(const auto ev = window.pollEvent()) {
auto gui_ev = router.process_event(ev);
auto mouse_pos = window.mapPixelToCoords(router.position);
@ -40,7 +41,6 @@ int main(int, char*[]) {
main.mouse(mouse_pos.x, mouse_pos.y, guecs::NO_MODS);
}
}
main.render(window);
window.display();
}