30 namespace FlashcardApp
52 std::function<
void()> goBack,
77 void render(std::shared_ptr<ConsoleUI::ConsoleWindow> window)
override;
102 void setDecksNeedReload(
bool needReload)
104 m_decksNeedReload = needReload;
107 void drawBookshelf(std::shared_ptr<ConsoleUI::ConsoleWindow> window);
116 std::function<void()> m_goBack;
118 bool m_needsRedraw =
true;
119 int m_maxCardsPerPage = 0;
121 bool m_staticDrawn =
false;
122 bool m_decksNeedReload =
false;
123 std::chrono::steady_clock::time_point m_lastPageChangeTime;
124 const std::chrono::milliseconds m_pageChangeDelay{200};
127 bool m_paging =
false;
128 int m_prevBookshelfIndex = -1;
129 int bookshelfIndex = 0;
153 std::function<
void()> goBack,
154 std::function<
void()> goToDeckSelection,
155 std::function<
void(
const std::vector<int> &,
int,
bool)> showResults,
163 void init()
override;
179 void render(std::shared_ptr<ConsoleUI::ConsoleWindow> window)
override;
195 void setDecksNeedReload(
bool needReload)
197 m_decksNeedReload = needReload;
199 void updateCardDifficulty(
size_t cardIndex,
CardDifficulty difficulty);
200 void initializeCardOrder();
212 bool m_lastAnswerDisplayed;
224 void saveUpdatedDeck();
229 bool m_decksNeedReload =
false;
235 void endSession(
bool sessionComplete);
238 std::vector<int> m_difficultyCount = {0, 0, 0};
239 std::function<void()> m_goBack;
240 std::function<void(
const std::vector<int> &,
int,
bool)> m_showResults;
243 bool m_staticDrawn =
false;
246 std::string m_lastQuestionDisplayed;
273 const std::vector<int> &difficultyCount,
275 std::function<
void()> goToMainMenu,
276 std::function<
void()> goToDeckSelection,
277 std::function<
void()> goToGame,
278 bool sessionComplete);
279 void init()
override;
294 void render(std::shared_ptr<ConsoleUI::ConsoleWindow> window)
override;
312 std::vector<int> m_difficultyCount;
313 std::function<void()> m_goToMainMenu;
314 std::function<void()> m_goToDeckSelection;
315 std::function<void()> m_goToGame;
319 bool m_staticDrawn =
false;
320 bool m_sessionComplete;
Defines variables containg ASCII artwork.
Defines a UI scene.
Definition: menu.h:629
Defines the UI manager.
Definition: menu.h:675
Class that defines a "deck" of flashcards.
Definition: deck.h:113
A scene for browsing and selecting flashcard decks.
Definition: flashcard_scene.h:42
void setStaticDrawn(bool staticDrawn) override
Sets the static drawn state of the scene.
Definition: flashcard_scene.cpp:76
void update() override
Update the scene state.
Definition: flashcard_scene.cpp:71
void init() override
Initialize the scene.
Definition: flashcard_scene.cpp:65
void render(std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
Render the scene to the console window.
Definition: flashcard_scene.cpp:81
std::vector< FlashCardDeck > m_decks
Vector of loaded flashcard decks.
Definition: flashcard_scene.h:109
size_t m_selectedDeckIndex
Index of the currently selected deck.
Definition: flashcard_scene.h:110
void handleInput() override
Handle user input for the scene.
Definition: flashcard_scene.cpp:160
void loadDecks()
Load available flashcard decks from storage.
Definition: flashcard_scene.cpp:28
BrowseDecksScene(ConsoleUI::UIManager &uiManager, std::function< void()> goBack, std::function< void(const FlashCardDeck &)> openDeck, StudySettings &settings)
Construct a new BrowseDecksScene object.
Definition: flashcard_scene.cpp:17
int m_currentPage
Current page number when viewing deck contents.
Definition: flashcard_scene.h:111
A scene for studying flashcards from a selected deck.
Definition: flashcard_scene.h:141
bool m_showAnswer
Flag indicating whether the answer is currently visible.
Definition: flashcard_scene.h:211
size_t m_currentCardIndex
Index of the current flashcard being shown.
Definition: flashcard_scene.h:210
void render(std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
Render the scene to the console window.
Definition: flashcard_scene.cpp:373
void handleInput() override
Handle user input for the scene.
Definition: flashcard_scene.cpp:465
void nextCard()
Move to the next flashcard in the deck.
Definition: flashcard_scene.cpp:574
void update() override
Update the scene state.
Definition: flashcard_scene.cpp:347
FlashcardScene(ConsoleUI::UIManager &uiManager, const FlashCardDeck &deck, std::function< void()> goBack, std::function< void()> goToDeckSelection, std::function< void(const std::vector< int > &, int, bool)> showResults, StudySettings &studySettings)
Construct a new FlashcardScene object.
Definition: flashcard_scene.cpp:266
std::vector< size_t > m_cardOrder
Randomized order of flashcards for the session.
Definition: flashcard_scene.h:208
void setStaticDrawn(bool staticDrawn) override
Sets the static drawn state of the scene.
Definition: flashcard_scene.cpp:368
FlashCardDeck m_deck
The flashcard deck being studied.
Definition: flashcard_scene.h:209
void init() override
Initialize the scene.
Definition: flashcard_scene.cpp:363
A scene for displaying the results of a flashcard study session.
Definition: flashcard_scene.h:261
void update() override
Update the scene state.
Definition: flashcard_scene.cpp:640
void setStaticDrawn(bool staticDrawn) override
Sets the static drawn state of the scene.
Definition: flashcard_scene.cpp:645
void handleInput() override
Handle user input for the scene.
Definition: flashcard_scene.cpp:739
void render(std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
Render the scene to the console window.
Definition: flashcard_scene.cpp:651
ResultsScene(ConsoleUI::UIManager &uiManager, const std::vector< int > &difficultyCount, int score, std::function< void()> goToMainMenu, std::function< void()> goToDeckSelection, std::function< void()> goToGame, bool sessionComplete)
Construct a new ResultsScene object.
Definition: flashcard_scene.cpp:599
void init() override
Initialise the scene.
Definition: flashcard_scene.cpp:635
Object for the settings relating to the study sessions component.
Definition: settings_scene.h:27
Functions and classes relating to flashcards.
CardDifficulty
The possible difficulties for a flashcard.
Definition: deck.h:35
Classes and functions that are used in the UI scene for editing flashcards.
The menu and settings for the over all game.
Contains useful helper functions.