Player12
An open source football management simulator
Loading...
Searching...
No Matches
help_scene.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <array>
12#include <cstdint>
13#include <optional>
14#include <span>
15#include <string>
16#include <vector>
17
18#include "gui/gui_scene.h"
19
21namespace Glossary
22{
23struct Term
24{
25 const char* term_key;
26 const char* definition_key;
27};
28
30std::span<const Term> terms();
31} // namespace Glossary
32
38class HelpScene : public GUIScene
39{
40 public:
45 HelpScene(GUIView* guiView_ptr, bool inCareer,
46 std::optional<std::size_t> focusTerm = std::nullopt);
47
48 void onEnter() override;
49 void update(float /*deltaTime*/) override
50 {
51 // Rendering reads current state; there is no per-frame update work.
52 }
53 void render() override;
54 [[nodiscard]] SceneID getID() const override { return SceneID::HELP; }
55
56 private:
58
59 void renderStart();
60 void renderShortcuts();
61 void renderGlossary();
62 void rebuildShortcuts();
63 void leave();
64 void filterTerms();
65
66 bool in_career = false;
67 std::optional<std::size_t> focus_term;
68 bool focus_pending = false;
69 std::optional<float> focus_screen_y;
70 std::array<char, 64> query{};
71 std::string filtered_query;
72 std::vector<std::size_t> matches;
74 {
75 std::string label_key;
76 std::string keys;
77 bool heading = false;
78 bool is_default = true;
79 };
80 std::vector<ShortcutRow> shortcut_rows;
81 std::uint32_t shortcuts_revision = 0;
83 std::vector<std::string> search_text;
84};
Base class for all GUI scenes.
Definition gui_scene.h:68
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
Help screen: getting started, the keyboard shortcuts in force and a searchable glossary....
Definition help_scene.h:39
std::uint32_t shortcuts_revision
Definition help_scene.h:81
bool focus_pending
Definition help_scene.h:68
std::vector< ShortcutRow > shortcut_rows
Definition help_scene.h:80
std::vector< std::size_t > matches
Definition help_scene.h:72
void leave()
Definition help_scene.cpp:101
std::array< char, 64 > query
Definition help_scene.h:70
void update(float) override
Updates scene logic.
Definition help_scene.h:49
void onEnter() override
Called when the scene is entered/becomes active.
Definition help_scene.cpp:79
SceneID getID() const override
Gets the ID of the scene.
Definition help_scene.h:54
std::optional< std::size_t > focus_term
Definition help_scene.h:67
void renderGlossary()
Definition help_scene.cpp:265
std::optional< float > focus_screen_y
Definition help_scene.h:69
std::vector< std::string > search_text
Definition help_scene.h:83
std::string filtered_query
Definition help_scene.h:71
bool in_career
Definition help_scene.h:66
void rebuildShortcuts()
Definition help_scene.cpp:206
void render() override
Renders the scene.
Definition help_scene.cpp:109
void renderShortcuts()
Definition help_scene.cpp:238
void renderStart()
Definition help_scene.cpp:157
void filterTerms()
Definition help_scene.cpp:91
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition help_scene.h:57
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
Football-management terms explained on the Help screen.
Definition help_scene.h:22
std::span< const Term > terms()
Definition help_scene.cpp:71
Definition help_scene.h:24
const char * definition_key
Definition help_scene.h:26
const char * term_key
Definition help_scene.h:25
Definition help_scene.h:74
std::string keys
Definition help_scene.h:76
bool heading
Definition help_scene.h:77
std::string label_key
Definition help_scene.h:75
bool is_default
Definition help_scene.h:78