You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.6 KiB
C++
70 lines
1.6 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
#include <vector>
|
|
|
|
#include <QDebug>
|
|
#include <QDir>
|
|
#include <QGenericMatrix>
|
|
#include <QLineEdit>
|
|
#include <QMainWindow>
|
|
#include <QMessageBox>
|
|
#include <QPushButton>
|
|
#include <QSettings>
|
|
#include <QStandardPaths>
|
|
#include <QTextStream>
|
|
|
|
#include "samegame.hpp"
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui { class MainWindow; }
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
void initialiseGame();
|
|
void initialiseGameGrid();
|
|
void initialiseWindow();
|
|
void initialiseMenuBar();
|
|
void clearConnected(std::set<std::vector<int>> *connected);
|
|
void refreshButtonGrid();
|
|
void refreshSizes();
|
|
void checkColumn(int column);
|
|
bool checkLeftoverMoves();
|
|
void bubbleRight(int column);
|
|
void bubbleUp(int row, int column);
|
|
void bubbleBoxes(std::set<std::vector<int>> *connected);
|
|
void setPalettes();
|
|
void gameOver();
|
|
|
|
void processHighscore();
|
|
void readHighscore();
|
|
QMap<QPair<QString, QDateTime>, int> newEntry();
|
|
|
|
private slots:
|
|
void button_clicked(int row, int column);
|
|
void newGame_triggered();
|
|
void showHighscore_triggered();
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
const int rows;
|
|
const int columns;
|
|
const QString csv_name = "highscore.csv";
|
|
double max_width;
|
|
double max_height;
|
|
SameGame *game;
|
|
std::vector<std::vector<QPushButton *>> buttonGrid;
|
|
QMap<QPair<QString, QDateTime>, int> highscore;
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|