| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | auto Sorcery::Create::start() -> int { |
| 54 | |
| 55 | _ctx.controller->go_to(Enums::Screen::CREATE); |
| 56 | _ctx.controller->initialise(); |
| 57 | |
| 58 | _ctx.game->creation_candidate = std::make_shared<Character>(&_ctx); |
| 59 | _ctx.game->creation_candidate->reset(Enums::Character::Stage::ENTER_NAME); |
| 60 | |
| 61 | auto candidate{_ctx.game->creation_candidate}; |
| 62 | |
| 63 | _ctx.ui->first_frame = true; |
| 64 | _ctx.controller->clear_input_buffer(); |
| 65 | |
| 66 | // Main loop |
| 67 | auto done{false}; |
| 68 | SDL_Event event; |
| 69 | while (!done) { |
| 70 | |
| 71 | while (SDL_PollEvent(&event)) { |
| 72 | |
| 73 | // Check for Quit Events |
| 74 | ImGui_ImplSDL2_ProcessEvent(&event); |
| 75 | done = _ctx.controller->check_for_abort(event); |
| 76 | |
| 77 | // Check for Window Resize |
| 78 | _ctx.controller->check_for_resize(event, _ctx.ui); |
| 79 | |
| 80 | // Check for Back Event |
| 81 | if (_ctx.controller->check_for_back(event)) { |
| 82 | if (_go_back_stage()) |
| 83 | return BACK_TO_TRAINING_GROUNDS; |
| 84 | } |
| 85 | |
| 86 | if (_ctx.controller->check_for_quicksave(event)) |
| 87 | _ctx.application->save_state_to_binary( |
| 88 | _ctx.get_file(SAVE_STATE_FILENAME)); |
| 89 | else if (_ctx.controller->check_for_quickload(event)) { |
| 90 | _ctx.application->load_state_from_binary( |
| 91 | _ctx.get_file(SAVE_STATE_FILENAME)); |
| 92 | continue; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | using enum Enums::Character::Stage; |
| 97 | switch (candidate->get_stage()) { |
| 98 | case ENTER_NAME: |
| 99 | _ctx.ui->display(Enums::Screen::CREATE_NAME, |
| 100 | unenum(candidate->get_stage())); |
| 101 | |
| 102 | if (candidate->get_stage() != Enums::Character::Stage::ENTER_NAME) { |
| 103 | candidate->set_stage(CHOOSE_RACE); |
| 104 | } |
| 105 | break; |
| 106 | case CHOOSE_RACE: |
| 107 | _ctx.ui->display(Enums::Screen::CREATE_RACE, |
| 108 | unenum(candidate->get_stage())); |
| 109 | if (candidate->get_stage() != |
nothing calls this directly
no test coverage detected