80 lines
1.6 KiB
C++
80 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <QQuickView>
|
|
#include <QtGui/qwindow.h>
|
|
#include <cstdint>
|
|
#include <qobject.h>
|
|
#include <qqmlintegration.h>
|
|
#include <qtmetamacros.h>
|
|
|
|
|
|
class PlayerAreaModel : public QObject
|
|
{
|
|
Q_OBJECT
|
|
QML_NAMED_ELEMENT(PlayerAreaModel)
|
|
QML_SINGLETON
|
|
|
|
Q_PROPERTY(uint focusedPlayer READ focusedPlayer WRITE setFocusedPlayer NOTIFY focusedPlayerChanged)
|
|
|
|
public:
|
|
explicit PlayerAreaModel(QObject *parent = nullptr);
|
|
|
|
uint focusedPlayer();
|
|
void setFocusedPlayer(int n);
|
|
|
|
enum BetType {
|
|
NONE,
|
|
RED,
|
|
BLACK,
|
|
ODD,
|
|
EVEN,
|
|
LOW,
|
|
HIGH,
|
|
DOZEN,
|
|
STREET,
|
|
SINGLE,
|
|
COLUMN,
|
|
SPLIT
|
|
};
|
|
Q_ENUM(BetType)
|
|
|
|
signals:
|
|
void focusedPlayerChanged(BetType b1, uint n1, BetType b2, uint n2);
|
|
void betChanged(BetType b, int n, int bet);
|
|
void betRemoved(BetType b, int n);
|
|
void betCanceled(BetType b, uint n);
|
|
void results(QString name, int n, int payout);
|
|
|
|
public slots:
|
|
void setPlayerName(QString s, int n);
|
|
void bet(BetType b, int n, int bet);
|
|
void removeBet(BetType b, int n);
|
|
QString getPlayerName(int n);
|
|
void cancelBet(BetType b, int n);
|
|
void payout();
|
|
|
|
|
|
private:
|
|
|
|
struct Bet {
|
|
uint betValue = 0;
|
|
BetType betType = NONE;
|
|
uint betSpot = 0;
|
|
};
|
|
|
|
struct Player {
|
|
QString playerName = "";
|
|
Bet bet1;
|
|
Bet bet2;
|
|
int payout;
|
|
};
|
|
|
|
QList<Player> players;
|
|
|
|
int focusedPlayer_;
|
|
|
|
int64_t redNumbers = 45857548629;
|
|
int64_t column3 = 9817068105;
|
|
int64_t column2 = 19634136210;
|
|
int64_t column1 = 39268272420;
|
|
};
|