Extra2D/examples/flappy_bird/GameOverLayer.h

59 lines
1.2 KiB
C
Raw Normal View History

// ============================================================================
// GameOverLayer.h - 游戏结束层
// 描述: 显示游戏结束界面、得分和奖牌
// ============================================================================
#pragma once
#include <extra2d/extra2d.h>
namespace flappybird {
/**
* @brief
*
*/
class GameOverLayer : public extra2d::Node {
public:
/**
* @brief
* @param score
*/
GameOverLayer(int score);
/**
* @brief
*/
void onEnter() override;
/**
* @brief
* @param dt
*/
void onUpdate(float dt) override;
private:
/**
* @brief
* @param score
* @param screenHeight
*/
void initPanel(int score, float screenHeight);
/**
* @brief
*/
void initButtons();
/**
* @brief
* @param score
* @return
*/
extra2d::Ptr<extra2d::SpriteFrame> getMedal(int score);
int score_ = 0; // 本局得分
};
} // namespace flappybird