Skip to content

Class i_2D::MainInterface

ClassList > i_2D > MainInterface

Represents the main interface for a 2D maze game. More...

  • #include <MainInterface.hpp>

Inherits the following classes: InterfaceBase

Public Functions

Type Name
void CheckLargerGrid ()
std::vector< std::string > CreateVectorMaze (const WorldGrid & grid, const type_options_t & type_options, const item_map_t & item_map, const agent_map_t & agent_map)
Creates a vector representation of the maze grid.
void DrawGrid (const WorldGrid & grid, const type_options_t & type_options, const item_map_t & item_map, const agent_map_t & agent_map)
Draws the maze grid and entities on the SFML window.
bool Initialize () override
Initializes the main interface.
MainInterface (size_t id, const std::string & name)
Constructs a MainInterface object.
void Notify (const std::string & message, const std::string &="none") override
notifies the world if the player have any progress message
size_t SelectAction (const WorldGrid & grid, const type_options_t & type_options, const item_map_t & item_map, const agent_map_t & agent_map) override
Handles user input for selecting actions.
void SetLargeGrid (bool b)
void setMInputWaitTime (double mInputWaitTime)
~MainInterface () = default
Destructor for the MainInterface class.

Detailed Description

This class inherits from InterfaceBase and provides functionality for creating and displaying a 2D maze game world, handling user input, and updating the graphical representation of the game.

Public Functions Documentation

function CheckLargerGrid

void i_2D::MainInterface::CheckLargerGrid () 

function CreateVectorMaze

Creates a vector representation of the maze grid.

std::vector< std::string > i_2D::MainInterface::CreateVectorMaze (
    const WorldGrid & grid,
    const type_options_t & type_options,
    const item_map_t & item_map,
    const agent_map_t & agent_map
) 

Parameters:

  • grid The WorldGrid representing the maze.
  • type_options The type options for symbols.
  • item_map The map of ids to items in the maze.
  • agent_map The map of ids to agents in the maze.

Returns:

A vector of strings representing the maze grid.

function DrawGrid

Draws the maze grid and entities on the SFML window.

void i_2D::MainInterface::DrawGrid (
    const WorldGrid & grid,
    const type_options_t & type_options,
    const item_map_t & item_map,
    const agent_map_t & agent_map
) 

Parameters:

  • grid The WorldGrid representing the maze.
  • type_options The type options for symbols.
  • item_map The map of ids to items in the maze.
  • agent_map The map of ids to agents in t

function Initialize

Initializes the main interface.

inline bool i_2D::MainInterface::Initialize () override

Returns:

True if initialization is successful; otherwise, false.

function MainInterface

Constructs a MainInterface object.

i_2D::MainInterface::MainInterface (
    size_t id,
    const std::string & name
) 

Parameters:

  • id The identifier for this interface.
  • name The name of this interface.

function Notify

notifies the world if the player have any progress message

inline void i_2D::MainInterface::Notify (
    const std::string & message,
    const std::string &="none"
) override

Parameters:

  • message that notifies the world

function SelectAction

Handles user input for selecting actions.

size_t i_2D::MainInterface::SelectAction (
    const WorldGrid & grid,
    const type_options_t & type_options,
    const item_map_t & item_map,
    const agent_map_t & agent_map
) override

Parameters:

  • grid The WorldGrid representing the maze.
  • type_options The type options for symbols.
  • item_map The map of ids to items in the maze.
  • agent_map The map of ids to agents in the maze.

function SetLargeGrid

inline void i_2D::MainInterface::SetLargeGrid (
    bool b
) 

function setMInputWaitTime

void i_2D::MainInterface::setMInputWaitTime (
    double mInputWaitTime
) 

Sets the inputwait time for netwrok interface

Parameters:

  • waitTime

function ~MainInterface

i_2D::MainInterface::~MainInterface () = default

The documentation for this class was generated from the following file source/Interfaces/MainInterface.hpp