summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/oyatzee/main.cpp12
-rw-r--r--noncore/games/oyatzee/opie-oyatzee.control2
-rw-r--r--noncore/games/oyatzee/oyatzee.h1
-rw-r--r--noncore/games/oyatzee/oyatzee.pro4
4 files changed, 5 insertions, 14 deletions
diff --git a/noncore/games/oyatzee/main.cpp b/noncore/games/oyatzee/main.cpp
index 1fd51f6..a5c19f0 100644
--- a/noncore/games/oyatzee/main.cpp
+++ b/noncore/games/oyatzee/main.cpp
@@ -1,13 +1,5 @@
#include "oyatzee.h"
-#include <qpe/qpeapplication.h>
+#include <opie2/oapplicationfactory.h>
-int main( int argc, char ** argv )
-{
- QPEApplication a( argc, argv );
-
- OYatzee mw;
- a.showMainWidget(&mw);
-
- return a.exec();
-}
+OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<OYatzee> )
diff --git a/noncore/games/oyatzee/opie-oyatzee.control b/noncore/games/oyatzee/opie-oyatzee.control
index 8249fed..4eb096c 100644
--- a/noncore/games/oyatzee/opie-oyatzee.control
+++ b/noncore/games/oyatzee/opie-oyatzee.control
@@ -1,11 +1,11 @@
Package: opie-oyatzee
-Files: bin/oyatzee apps/Games/oyatzee.desktop pics/oyatzee
+Files: plugins/applications/liboyatzee.so* bin/oyatzee apps/Games/oyatzee.desktop pics/oyatzee
Priority: optional
Section: opie/games
Maintainer: Carsten Niehaus <cniehaus@handhelds.org>
Architecture: arm
Depends: task-opie-minimal
Description: Yatzee-like game
A Yatzee game for the Opie environment.
Play against the computer or human opponents.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/games/oyatzee/oyatzee.h b/noncore/games/oyatzee/oyatzee.h
index 048a733..a38182d 100644
--- a/noncore/games/oyatzee/oyatzee.h
+++ b/noncore/games/oyatzee/oyatzee.h
@@ -1,218 +1,219 @@
#ifndef WORDGAME_H
#define WORDGAME_H
#include <qmainwindow.h>
#include <qlabel.h>
#include <qlist.h>
#include <qmap.h>
#include <qsplitter.h>
#include <stdlib.h> // rand() function
#include <qdatetime.h> // seed for rand()
class Dice;
class Game;
class Scoreboard;
class DiceWidget;
class Resultboard;
class Player;
class QPoint;
typedef QList<Dice> dicesList;
typedef QList<Resultboard> resultboardList;
typedef QValueList<int> QValueListInt;
typedef QList<Player> playerList;
typedef QMap<int,int> pointMap;
class OYatzee : public QMainWindow {
Q_OBJECT
public:
OYatzee( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~OYatzee();
+ static QString appName() { return QString::fromLatin1("oyatzee"); }
Game *g();
DiceWidget *dw;
Scoreboard *sb;
QValueListInt posibilities;
playerList ps;
void setPlayerNumber( const int num );
void setRoundsNumber( const int num );
enum { Ones = 1,
Twos = 2,
Threes = 3,
Fours = 4,
Fives = 5,
Sixes = 6,
ThreeOfAKind = 9, //12444
FourOfAKind = 10, //14444
FullHouse = 11, //22555
SStraight = 12, //13456
LStraight = 13, //12345
Yatzee = 14, //55555
Chance = 15};
public slots:
void slotStartGame();
void slotRollDices();
void slotEndRound( int );
private:
int numOfPlayers;
int numOfRounds;
int currentPlayer; /* the number of the current player */
int oakPoints;
void nextPlayer();
bool lastPlayerFinished;
/*
* Check what posibilities the player currently has
*/
void detectPosibilities();
void displayPossibilites();
int getPoints( const int , QValueListInt );
void startGame();
void stopGame();
};
class Dice : public QFrame
{
Q_OBJECT
public:
Dice( QWidget* parent = 0, const char* name = 0 );
bool isSelected;
const int hasValue() const;
void roll();
private:
int Value;
private slots:
void slotSelected();
signals:
void selected();
protected:
void paintEvent( QPaintEvent *e );
void paintNumber( QPainter *p );
virtual void mousePressEvent( QMouseEvent* );
};
class DiceWidget : public QWidget
{
Q_OBJECT
public:
DiceWidget( QWidget *parent = 0, const char* name = 0 );
QPushButton *rollButton;
dicesList diceList;
};
class Board : public QWidget
{
Q_OBJECT
public:
Board( QWidget *parent = 0, const char* name = 0 );
signals:
void clicked( QPoint );
void item( int );
protected:
virtual void mousePressEvent( QMouseEvent* );
};
class Possibilityboard : public Board
{
Q_OBJECT
public:
Possibilityboard( QWidget *parent = 0, const char* name = 0 );
QValueListInt list;
void setIntlist( QValueListInt& );
private:
QStringList begriffe;
private slots:
/*
* this slot returns the item the user has selected
*/
virtual void slotClicked(QPoint);
protected:
virtual void paintEvent( QPaintEvent *e );
};
class Resultboard : public Board
{
Q_OBJECT
public:
Resultboard( QString playerName = 0 , QWidget *parent = 0, const char* name = 0 );
QString pName;
pointMap pMap;
void updateMap( int, int );
protected:
virtual void paintEvent( QPaintEvent *e );
};
class Scoreboard : public QWidget
{
Q_OBJECT
public:
Scoreboard( playerList ps, QWidget *parent = 0, const char* name = 0 );
Possibilityboard *pb;
resultboardList rbList;
playerList ps_;
void createResultboards(const int);
Resultboard* nextRB(int);
protected:
void paintEvent( QPaintEvent *e );
};
class Player
{
public:
Player( QString name );
QString playerName;
int totalPoints;
void setResults( const int , const int );
int turn;
void updateTotalPoints( QMap<int,int> );
private:
QValueListInt pResults; /* the individual results of the player */
void setupResultList(); /* only in the ctor */
};
#endif // WORDGAME_H
diff --git a/noncore/games/oyatzee/oyatzee.pro b/noncore/games/oyatzee/oyatzee.pro
index f505c66..208535a 100644
--- a/noncore/games/oyatzee/oyatzee.pro
+++ b/noncore/games/oyatzee/oyatzee.pro
@@ -1,11 +1,9 @@
-TEMPLATE = app
-CONFIG = qt warn_on
-DESTDIR = $(OPIEDIR)/bin
+CONFIG = qt quick-app
HEADERS = oyatzee.h
SOURCES = main.cpp oyatzee.cpp
TARGET = oyatzee
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2
include ( $(OPIEDIR)/include.pro )