roulette-payout/PlayerAreaModel.h

81 lines
1.7 KiB
C
Raw Permalink Normal View History

#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
2024-06-09 13:25:58 +01:00
/* The name under which this "global variable" will be known in QML files */
QML_NAMED_ELEMENT(PlayerAreaModel)
QML_SINGLETON
Q_PROPERTY(uint focusedPlayer READ focusedPlayer WRITE setFocusedPlayer NOTIFY focusedPlayerChanged)
public:
explicit PlayerAreaModel(QObject *parent = nullptr);
2024-06-01 13:19:32 +01:00
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);
2024-05-31 12:34:47 +01:00
public slots:
void setPlayerName(QString s, int n);
void bet(BetType b, int n, int bet);
void removeBet(BetType b, int n);
2024-06-01 13:19:32 +01:00
QString getPlayerName(int n);
void cancelBet(BetType b, int n);
2024-06-07 18:03:22 +01:00
void payout();
2024-06-01 13:19:32 +01:00
2024-05-31 12:34:47 +01:00
private:
struct Bet {
uint betValue = 0;
BetType betType = NONE;
uint betSpot = 0;
};
struct Player {
QString playerName = "";
2024-06-09 13:25:58 +01:00
QList<Bet> bets;
2024-06-08 00:41:25 +01:00
int payout;
};
QList<Player> players;
int focusedPlayer_;
2024-06-08 00:41:25 +01:00
/* bitmaps */
int64_t redNumbers = 45857548629;
int64_t column3 = 9817068105;
int64_t column2 = 19634136210;
int64_t column1 = 39268272420;
};