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

A scene for browsing and selecting flashcard decks. More...

#include <flashcard_scene.h>

Inheritance diagram for FlashcardApp::BrowseDecksScene:
ConsoleUI::Scene

Public Member Functions

 BrowseDecksScene (ConsoleUI::UIManager &uiManager, std::function< void()> goBack, std::function< void(const FlashCardDeck &)> openDeck, StudySettings &settings)
 Construct a new BrowseDecksScene 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 loadDecks ()
 Load available flashcard decks from storage. More...
 
void setStaticDrawn (bool staticDrawn) override
 Sets the static drawn state of the scene. More...
 
void setDecksNeedReload (bool needReload)
 
void drawBookshelf (std::shared_ptr< ConsoleUI::ConsoleWindow > window)
 
- Public Member Functions inherited from ConsoleUI::Scene
virtual ~Scene ()=default
 Destroy the Scene object.
 

Data Fields

std::vector< FlashCardDeckm_decks
 Vector of loaded flashcard decks.
 
size_t m_selectedDeckIndex = 0
 Index of the currently selected deck.
 
int m_currentPage = 0
 Current page number when viewing deck contents.
 

Detailed Description

A scene for browsing and selecting flashcard decks.

This class represents a user interface scene that allows users to browse through available flashcard decks, view their contents, and select a deck to study or edit.

Constructor & Destructor Documentation

◆ BrowseDecksScene()

FlashcardApp::BrowseDecksScene::BrowseDecksScene ( ConsoleUI::UIManager uiManager,
std::function< void()>  goBack,
std::function< void(const FlashCardDeck &)>  openDeck,
StudySettings settings 
)

Construct a new BrowseDecksScene object.

Parameters
uiManagerThe UI manager responsible for handling the user interface.
goBackA function to be called when the user wants to go back to the previous scene.
openDeckA function to be called when the user selects a deck to open.

Member Function Documentation

◆ handleInput()

void FlashcardApp::BrowseDecksScene::handleInput ( )
overridevirtual

Handle user input for the scene.

This function processes keyboard input to navigate through decks, change pages, select a deck, or go back to the previous scene.

Implements ConsoleUI::Scene.

◆ init()

void FlashcardApp::BrowseDecksScene::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.

◆ loadDecks()

void FlashcardApp::BrowseDecksScene::loadDecks ( )

Load available flashcard decks from storage.

This function reads flashcard decks from the "Decks/" directory and populates the m_decks vector with the loaded decks.

◆ render()

void FlashcardApp::BrowseDecksScene::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::BrowseDecksScene::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::BrowseDecksScene::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: