#include "samples/ghhb_game.h" #include "samples/instrument_select.h" #include "samples/song_select.h" #include "samples/title_screen.h" #include "entities/song.h" // Emscripten is used for web builds. #ifdef __EMSCRIPTEN__ #include #endif int INSTRUMENT_GAMEPAD_INDEX[MAX_INSTRUMENT_TYPES] = {-1, -1, -1, -1}; int INSTRUMENT_PHYSICAL_GAMEPAD[MAX_INSTRUMENT_TYPES] = {-1, -1, -1, -1}; std::string SELECTED_SONG_PATH = "assets/songs/json/mary.json"; 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(1280, 720, "Guitar Hero But Better"); auto font_manager = game.add_manager(); auto json_manager = game.add_manager(); auto song_manager = game.add_manager(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("title"); game.add_scene("song_select"); game.add_scene("instrument_select"); game.add_scene("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; }