56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
#include "samples/ghhb_game.h"
|
|
#include "samples/instrument_select.h"
|
|
#include "samples/title_screen.h"
|
|
#include "entities/song.h"
|
|
|
|
// Emscripten is used for web builds.
|
|
#ifdef __EMSCRIPTEN__
|
|
#include <emscripten/emscripten.h>
|
|
#endif
|
|
|
|
int INSTRUMENT_GAMEPAD_INDEX[MAX_INSTRUMENT_TYPES] = {-1, -1, -1, -1};
|
|
int INSTRUMENT_PHYSICAL_GAMEPAD[MAX_INSTRUMENT_TYPES] = {-1, -1, -1, -1};
|
|
|
|
Game game;
|
|
|
|
void update()
|
|
{
|
|
float delta_time = GetFrameTime();
|
|
game.update(delta_time);
|
|
}
|
|
|
|
// TODO: Make this a GUI app for each platform.
|
|
int main(int argc, char** argv)
|
|
{
|
|
game.add_manager<WindowManager>(1280, 720, "Guitar Hero But Better");
|
|
auto font_manager = game.add_manager<FontManager>();
|
|
auto json_manager = game.add_manager<JsonManager>();
|
|
auto song_manager = game.add_manager<SongManager>(json_manager);
|
|
game.init();
|
|
|
|
// Game::init initializes all managers, so we can load fonts now.
|
|
font_manager->load_font("Roboto", "assets/fonts/Roboto.ttf", 64);
|
|
font_manager->load_font("Tiny5", "assets/fonts/Tiny5.ttf", 64);
|
|
font_manager->set_texture_filter("Roboto", TEXTURE_FILTER_BILINEAR);
|
|
|
|
game.add_scene<TitleScreen>("title");
|
|
game.add_scene<InstrumentSelectScreen>("instrument_select");
|
|
game.add_scene<GHHBScene>("ghhb");
|
|
|
|
Song& song = song_manager->load_song("mary_had_a_lil_lamb", "assets/songs/json/mary.json");
|
|
printf("Song name: %s\n", song.header.name.c_str());
|
|
printf("Song bpm: %f\n", song.header.bpm);
|
|
printf("First note duration: %d\n", song.tracks[0].notes[0].duration_ms);
|
|
|
|
|
|
#ifdef __EMSCRIPTEN__
|
|
emscripten_set_main_loop(update, 0, true);
|
|
#else
|
|
while (!WindowShouldClose())
|
|
{
|
|
update();
|
|
}
|
|
#endif
|
|
return 0;
|
|
}
|