Files are now in a src directory and I'm using a src/meson.build and tests/meson.build to specify what to build.
This commit is contained in:
parent
4778677647
commit
1d4ae911b9
108 changed files with 94 additions and 83 deletions
67
src/main.cpp
Normal file
67
src/main.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#include "gui/fsm.hpp"
|
||||
#include "textures.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "autowalker.hpp"
|
||||
#include "ai.hpp"
|
||||
#include <iostream>
|
||||
#include "shaders.hpp"
|
||||
#include "backend.hpp"
|
||||
#include "game_level.hpp"
|
||||
#include "camera.hpp"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
sfml::Backend backend;
|
||||
|
||||
shaders::init();
|
||||
components::init();
|
||||
guecs::init(&backend);
|
||||
ai::init("ai");
|
||||
GameDB::init();
|
||||
cinematic::init();
|
||||
|
||||
sound::mute(true);
|
||||
|
||||
gui::FSM main;
|
||||
main.event(game::Event::START);
|
||||
Autowalker walker(main);
|
||||
|
||||
sound::play("ambient_1", true);
|
||||
|
||||
if(argc > 1 && argv[1][0] == 't') {
|
||||
walker.start_autowalk();
|
||||
}
|
||||
|
||||
while(main.active()) {
|
||||
main.render();
|
||||
|
||||
if(main.in_state(gui::State::BOSS_FIGHT)) {
|
||||
main.handle_boss_fight_events();
|
||||
} else {
|
||||
// BUG: need to sort out how to deal with this in the FSM
|
||||
if(main.in_state(gui::State::IDLE)
|
||||
|| main.in_state(gui::State::LOOTING)
|
||||
|| main.in_state(gui::State::CUT_SCENE_PLAYING)
|
||||
|| main.in_state(gui::State::IN_COMBAT))
|
||||
{
|
||||
if(main.autowalking) {
|
||||
walker.autowalk();
|
||||
} else {
|
||||
main.handle_keyboard_mouse();
|
||||
}
|
||||
} else{
|
||||
main.event(game::Event::TICK);
|
||||
}
|
||||
|
||||
main.handle_world_events();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
} catch(const std::system_error& e) {
|
||||
std::cout << "WARNING: On OSX you'll get this error on shutdown.\n";
|
||||
std::cout << "Caught system_error with code "
|
||||
"[" << e.code() << "] meaning "
|
||||
"[" << e.what() << "]\n";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue