Study Dungeon  1.0.0
A group project for COSC345
Public Member Functions | Data Fields
FlashcardApp::FlashcardScene Class Reference

A scene for studying flashcards from a selected deck. More...

#include <flashcard_scene.h>

Inheritance diagram for FlashcardApp::FlashcardScene:
ConsoleUI::Scene

Public Member Functions

 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. More...
 
void init () override
 Initialize the scene. More...
 
void update () override
 Update the scene state. More...
 
void render (std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
 Render the scene to the console window. More...
 
void handleInput () override
 Handle user input for the scene. More...
 
void setStaticDrawn (bool staticDrawn) override
 Sets the static drawn state of the scene. More...
 
void setDecksNeedReload (bool needReload)
 
void updateCardDifficulty (size_t cardIndex, CardDifficulty difficulty)
 
void initializeCardOrder ()
 
void nextCard ()
 Move to the next flashcard in the deck.
 
- Public Member Functions inherited from ConsoleUI::Scene
virtual ~Scene ()=default
 Destroy the Scene object.
 

Data Fields

std::vector< size_t > m_cardOrder
 Randomized order of flashcards for the session.
 
FlashCardDeck m_deck
 The flashcard deck being studied.
 
size_t m_currentCardIndex = 0
 Index of the current flashcard being shown.
 
bool m_showAnswer = false
 Flag indicating whether the answer is currently visible.
 
bool m_lastAnswerDisplayed
 

Detailed Description

A scene for studying flashcards from a selected deck.

This class represents a user interface scene that allows users to go through flashcards in a selected deck, view questions and answers, and rate the difficulty of each card.

Constructor & Destructor Documentation

◆ FlashcardScene()

FlashcardApp::FlashcardScene::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.

Parameters
uiManagerThe UI manager responsible for handling the user interface.
deckThe flashcard deck to study.
goBackA function to be called when the user wants to go back to the previous scene.
showResultsA function to be called when the study session ends, passing difficulty counts.

Member Function Documentation

◆ handleInput()

void FlashcardApp::FlashcardScene::handleInput ( )
overridevirtual

Handle user input for the scene.

This function processes keyboard input to show answers, select difficulty, and navigate through flashcards.

Implements ConsoleUI::Scene.

◆ init()

void FlashcardApp::FlashcardScene::init ( )
overridevirtual

Initialize the scene.

This function is called when the Scene changes to another. Currently, it doesn't perform any actions as the scene doesn't require initialization.

Implements ConsoleUI::Scene.

◆ render()

void FlashcardApp::FlashcardScene::render ( std::shared_ptr< ConsoleUI::ConsoleWindow window)
overridevirtual

Render the scene to the console window.

Parameters
windowThe console window to render the scene onto.

Implements ConsoleUI::Scene.

◆ setStaticDrawn()

void FlashcardApp::FlashcardScene::setStaticDrawn ( bool  staticDrawn)
overridevirtual

Sets the static drawn state of the scene.

Parameters
staticDrawnBoolean indicating whether the static elements have been drawn.

Implements ConsoleUI::Scene.

◆ update()

void FlashcardApp::FlashcardScene::update ( )
overridevirtual

Update the scene state.

This function is called every frame to update the scene's state. Currently, it doesn't perform any actions as the scene doesn't require continuous updates.

Implements ConsoleUI::Scene.


The documentation for this class was generated from the following files: