37 lines
672 B
C++
37 lines
672 B
C++
#pragma once
|
|
|
|
#include "head.h"
|
|
|
|
class GameMatch : public UI::Scene
|
|
{
|
|
public:
|
|
GameMatch();
|
|
~GameMatch();
|
|
|
|
void Init();
|
|
void Update() override;
|
|
void Render() override;
|
|
|
|
private:
|
|
void GenerateBoard();
|
|
void CheckMatches();
|
|
void RemoveMatches();
|
|
void DropItems();
|
|
void RefillBoard();
|
|
|
|
bool CanSwap(int x1, int y1, int x2, int y2);
|
|
void SwapItems(int x1, int y1, int x2, int y2);
|
|
|
|
struct Item
|
|
{
|
|
int type = 0;
|
|
bool matched = false;
|
|
};
|
|
|
|
static constexpr int BOARD_SIZE = 8;
|
|
Item _board[BOARD_SIZE][BOARD_SIZE];
|
|
|
|
Position _selectedPos = { -1, -1 };
|
|
int _score = 0;
|
|
gcText _txt;
|
|
}; |