grid.h
来自「Source code (C++) of the Amoebax game fo」· C头文件 代码 · 共 570 行 · 第 1/2 页
H
570 行
/// Tell if we are waiting for the initial 3 pairs. bool m_WaitingInitialAmoebas; /// The ghost amoebas waiting to fall to the grid. std::vector<Amoeba *> m_WaitingGhostAmoebas; /// The number of ghost amoebas waiting. Max. is 30. uint8_t m_WaitingGhostAmoebasNumber; /// The X position of where the ghost amoebas wait. uint16_t m_WaitingGhostPositionX; /// The Y position of where the ghost amoebas wait. uint16_t m_WaitingGhostPositionY; }; /// /// \brief Gets the list of the active amoebas. /// /// The active amoebas are those amoebas that are currently /// on the game field. They are the alredy fallen amoebas and the /// falling pair. The two pairs waiting to fall are not active, are /// queued. \see getQueuedAmoebas() for more information. /// /// \return The list of amoebas that are active. /// inline const std::list<Amoeba *> & Grid::getActiveAmoebas (void) const { return m_ActiveAmoebas; } /// /// \brief Gets the amoeba's size. /// /// \return The size (both height and width, as they are equal) of the /// amoebas. /// inline uint16_t Grid::getAmoebaSize (void) const { return m_AmoebaSize; } /// /// \brief Gets the list of chain labels. /// /// \return The list of chain labels to show to the user. /// inline const std::list<ChainLabel *> & Grid::getChainLabels (void) const { return m_ChainLabels; } /// /// \brief Gets the current step chain. /// /// \return The current step chain value, starting from 0. /// inline uint8_t Grid::getCurrentStepChain (void) const { return m_CurrentStepChain; } /// /// \brief Gets the grid's top-left corner X position. /// /// \return The X position of grid's top-left corner. /// inline uint16_t Grid::getGridPositionX (void) const { return m_GridPositionX; } /// /// \brief Gets the grid's top-left corner Y position. /// /// \return The Y position of grid's top-left corner. /// inline uint16_t Grid::getGridPositionY (void) const { return m_GridPositionY; } /// /// \brief Gets the layout. /// /// \return the current grid layout. /// inline Grid::Layout Grid::getLayout (void) const { return m_Layout; } /// /// \brief Gets the number of waiting ghosts. /// /// \return The number of ghosts amoebas that are waiting to fall into /// the grid. /// inline uint8_t Grid::getNumberOfWaitingGhosts (void) const { return m_WaitingGhostAmoebasNumber; } /// /// \brief Gets the number of ghost amoebas to send to the opponent. /// /// \return The number of ghost amoebas for the opponent. /// inline uint8_t Grid::getOpponentGhostAmoebas (void) const { return m_OpponentGhostAmoebas; } /// /// \brief Gets the list of the queued amoebas. /// /// The active amoebas are the two pairs of amoebas waiting to fall. /// /// \return The list of amoebas that are active. /// inline const std::list<Amoeba *> & Grid::getQueuedAmoebas (void) const { return m_QueuedAmoebas; } /// /// \brief Gets the current player's score. /// /// \return The current player's score. /// inline uint32_t Grid::getScore (void) const { return m_Score; } /// /// \brief Gets the current sihouette frame. /// /// \return The current silhouette frame. /// inline int8_t Grid::getSilhouetteFrame (void) const { return m_SilhouetteFrame; } /// /// \brief Gets the list of the waiting ghost amoebas. /// /// The list of waiting amoebas is just 6 amoebas, but each amoeba's /// neighbour state indicates how many ghost amoebas will fall. The /// maximum number of ghost to fall for each one is 5, hence the /// maximum ghosts to fall is 30. /// /// \return The vector of 6 ghost amoebas with it's "weight" state. /// inline const std::vector<Amoeba *> & Grid::getWaitingGhostAmoebas (void) const { return m_WaitingGhostAmoebas; } /// /// \brief Tells if the falling pair is new. /// /// A falling pair is new when at the last call to update() /// the previous falling pair felt and there was not floating amoebas. /// Of course, every time a new falling pair starts to fall, this /// function returns \a true. /// /// \return \a true if at the previous call to update() a new pair /// started to fall, \a false otherwise. /// inline bool Grid::hasNewFallingPair (void) const { return m_HasNewFallingPair; } /// /// \brief Increments the current step chain. /// /// \param amount The amount to increment the current step chain. /// inline void Grid::incrementCurrentStepChain (uint8_t amount) { setCurrentStepChain (getCurrentStepChain () + amount); } /// /// \brief Increments the current score. /// /// \param amount The amount increments the score. /// inline void Grid::incrementScore (uint16_t amount) { setScore (getScore () + amount); } /// /// \brief Tells if the grid is filled. /// /// The grid is considered filled when the falling pair can't /// fall because the grid's position (3, 0) has a non-floating /// amoeba (i.e., the falling amoebas can't fall inside the /// grid.) /// /// When the grid is filled, the game is over and the player /// lost. /// /// \return \a true if the grid is filled, \a false otherwise. /// inline bool Grid::isFilled (void) const { return m_Filled; } /// /// \brief Sets the current step chain. /// /// \param stepChain The new step chain to set. /// inline void Grid::setCurrentStepChain (uint8_t stepChain) { m_CurrentStepChain = stepChain; } /// /// \brief Sets the number of waiting ghosts. /// /// \param number The new number of ghosts amoebas that are waiting /// to fall into the grid. It can't be greater than 30, /// if it's then it gets clapped. /// inline void Grid::setNumberOfWaitingGhosts (uint8_t number) { if ( number > 30 ) { m_WaitingGhostAmoebasNumber = 30; } else { m_WaitingGhostAmoebasNumber = number; } } /// /// \brief Sets the number of amoebas to send to the opponent grid. /// /// \param ghostAmoebas The number of ghost amoebas to send. /// inline void Grid::setOpponentGhostAmoebas (uint8_t ghostAmoebas) { m_OpponentGhostAmoebas = ghostAmoebas; } /// /// \brief Sets the score of the grid. /// /// \param score The new score value. /// inline void Grid::setScore (uint32_t score) { m_Score = score; }}#endif // !AMOEBAX_GRID_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?