summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.pro38
-rw-r--r--noncore/games/backgammon/backgammonview.h3
-rw-r--r--noncore/games/backgammon/moveengine.cpp2
3 files changed, 22 insertions, 21 deletions
diff --git a/noncore/games/backgammon/backgammon.pro b/noncore/games/backgammon/backgammon.pro
index 6f77a14..4be9491 100644
--- a/noncore/games/backgammon/backgammon.pro
+++ b/noncore/games/backgammon/backgammon.pro
@@ -1,34 +1,34 @@
1 TEMPLATE = app 1 TEMPLATE = app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 3
4HEADERS = backgammon.h \ 4HEADERS = backgammon.h \
5 canvasimageitem.h \ 5 backgammonview.h \
6 themedialog.h \ 6 canvasimageitem.h \
7 moveengine.h \ 7 themedialog.h \
8 filedialog.h \ 8 moveengine.h \
9 playerdialog.h \ 9 filedialog.h \
10 aidialog.h \ 10 playerdialog.h \
11 rulesdialog.h \ 11 aidialog.h \
12 displaydialog.h \ 12 rulesdialog.h \
13 definition.h 13 definition.h
14 14
15SOURCES = main.cpp \ 15SOURCES = main.cpp \
16 backgammon.cpp \ 16 backgammon.cpp \
17 canvasimageitem.cpp \ 17 backgammonview.cpp \
18 themedialog.cpp \ 18 canvasimageitem.cpp \
19 moveengine.cpp \ 19 themedialog.cpp \
20 filedialog.cpp \ 20 moveengine.cpp \
21 playerdialog.cpp \ 21 filedialog.cpp \
22 aidialog.cpp \ 22 playerdialog.cpp \
23 rulesdialog.cpp \ 23 aidialog.cpp \
24 displaydialog.cpp \ 24 rulesdialog.cpp \
25 definition.cpp 25 definition.cpp
26 26
27 TARGET = backgammon 27 TARGET = backgammon
28 INCLUDEPATH+= $(OPIEDIR)/include 28 INCLUDEPATH+= $(OPIEDIR)/include
29 DEPENDPATH+= $(OPIEDIR)/include 29 DEPENDPATH+= $(OPIEDIR)/include
30 LIBS += -lqpe -lstdc++ 30 LIBS += -lqpe -lstdc++
31 DESTDIR = $(OPIEDIR)/bin 31 DESTDIR = $(OPIEDIR)/bin
32 32
33 33
34include ( $(OPIEDIR)/include.pro ) 34include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/backgammon/backgammonview.h b/noncore/games/backgammon/backgammonview.h
index 52508e2..81f1973 100644
--- a/noncore/games/backgammon/backgammonview.h
+++ b/noncore/games/backgammon/backgammonview.h
@@ -1,18 +1,19 @@
1#ifndef BACKGAMMON_VIEW_H 1#ifndef BACKGAMMON_VIEW_H
2#define BACKGAMMON_VIEW_H 2#define BACKGAMMON_VIEW_H
3 3
4#include <qcanvas.h> 4#include <qcanvas.h>
5 5
6class BackGammonView : public QCanvasView 6class BackGammonView : public QCanvasView
7{ 7{
8 Q_OBJECT 8 Q_OBJECT
9public: 9public:
10 BackGammonView(QCanvas* canvas,QWidget* parent); 10 BackGammonView(QCanvas* canvas,QWidget* parent);
11 ~BackGammonView(); 11 ~BackGammonView();
12signals: 12signals:
13 void mouse(int,int); 13 void mouse(int,int);
14private: 14private:
15 void contentsMousePressEvent(QMouseEvent* e); 15 void contentsMousePressEvent(QMouseEvent* e);
16}; 16};
17 17
18#endif //BACKGAMMON_VIEW_H \ No newline at end of file 18#endif //BACKGAMMON_VIEW_H
19
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index 009c449..37b73a6 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -1,101 +1,101 @@
1#include "moveengine.h" 1#include "moveengine.h"
2 2
3#include <qmessagebox.h> 3#include <qmessagebox.h>
4
5#include <qtimer.h> 4#include <qtimer.h>
5#include <stdlib.h>
6 6
7MoveEngine::MoveEngine() 7MoveEngine::MoveEngine()
8 : QObject() 8 : QObject()
9{ 9{
10 int offset=7; 10 int offset=7;
11 int a=0; //counter variable 11 int a=0; //counter variable
12 int xfill[]={210,185,170,155,140,125,110,85,70,55,40,25,10,10,25,40,55,70,85,110,125,140,155,170,185,210}; 12 int xfill[]={210,185,170,155,140,125,110,85,70,55,40,25,10,10,25,40,55,70,85,110,125,140,155,170,185,210};
13 for(a=0;a<26;a++) 13 for(a=0;a<26;a++)
14 { 14 {
15 x_coord[a]=xfill[a]; 15 x_coord[a]=xfill[a];
16 } 16 }
17 17
18 int yfill[]={10,25,40,55,70,10+offset,25+offset,40+offset,55+offset,25,40,55, 25+offset,40+offset,40}; 18 int yfill[]={10,25,40,55,70,10+offset,25+offset,40+offset,55+offset,25,40,55, 25+offset,40+offset,40};
19 int zfill[]={1,1,1,1,1,2,2,2,2,3,3,3,4,4,5}; 19 int zfill[]={1,1,1,1,1,2,2,2,2,3,3,3,4,4,5};
20 for(a=0;a<15;a++) 20 for(a=0;a<15;a++)
21 { 21 {
22 yup_coord[a]=yfill[a]; 22 yup_coord[a]=yfill[a];
23 ylow_coord[a]=185-(yfill[a]); 23 ylow_coord[a]=185-(yfill[a]);
24 z_coord[a]=zfill[a]; 24 z_coord[a]=zfill[a];
25 } 25 }
26 for(a=0;a<5;a++) 26 for(a=0;a<5;a++)
27 { 27 {
28 if(a<3) 28 if(a<3)
29 { 29 {
30 x_fin1[a]=65+a*15; 30 x_fin1[a]=65+a*15;
31 x_fin2[a]=155-a*15; 31 x_fin2[a]=155-a*15;
32 } 32 }
33 y_fin[a]=225-a*5; 33 y_fin[a]=225-a*5;
34 } 34 }
35 z_fin=1; 35 z_fin=1;
36 36
37 reset(); 37 reset();
38} 38}
39 39
40MoveEngine::~MoveEngine() 40MoveEngine::~MoveEngine()
41{} 41{}
42 42
43void MoveEngine::position(Pieces& pieces,bool non_qte) 43void MoveEngine::position(Pieces& pieces,bool non_qte)
44{ 44{
45 int player1_counter=0; 45 int player1_counter=0;
46 int player2_counter=0; 46 int player2_counter=0;
47 47
48 //non qte styles are smaller !! 48 //non qte styles are smaller !!
49 int offset=(non_qte) ? 5 : 0; 49 int offset=(non_qte) ? 5 : 0;
50 50
51 for(int a=0;a<28;a++) 51 for(int a=0;a<28;a++)
52 { 52 {
53 for(int b=0;b<abs(population[a].total);b++) 53 for(int b=0;b<abs(population[a].total);b++)
54 { 54 {
55 if(population[a].total>0) //player 1 pieces 55 if(population[a].total>0) //player 1 pieces
56 { 56 {
57 pieces.player1[player1_counter].x=x_coord[a]-offset; 57 pieces.player1[player1_counter].x=x_coord[a]-offset;
58 if(a>=0 && a<13) 58 if(a>=0 && a<13)
59 { 59 {
60 pieces.player1[player1_counter].y=yup_coord[b]-offset; 60 pieces.player1[player1_counter].y=yup_coord[b]-offset;
61 pieces.player1[player1_counter].z=z_coord[b]; 61 pieces.player1[player1_counter].z=z_coord[b];
62 pieces.player1[player1_counter].side=false; 62 pieces.player1[player1_counter].side=false;
63 player1_counter++; 63 player1_counter++;
64 } 64 }
65 else if(a>12 && a<26) 65 else if(a>12 && a<26)
66 { 66 {
67 pieces.player1[player1_counter].y=ylow_coord[b]-offset; 67 pieces.player1[player1_counter].y=ylow_coord[b]-offset;
68 pieces.player1[player1_counter].z=z_coord[b]; 68 pieces.player1[player1_counter].z=z_coord[b];
69 pieces.player1[player1_counter].side=false; 69 pieces.player1[player1_counter].side=false;
70 player1_counter++; 70 player1_counter++;
71 } 71 }
72 else if(a==26) 72 else if(a==26)
73 { 73 {
74 if(b<5) 74 if(b<5)
75 { 75 {
76 pieces.player1[player1_counter].x=x_fin1[0]-offset; 76 pieces.player1[player1_counter].x=x_fin1[0]-offset;
77 pieces.player1[player1_counter].y=y_fin[b]-offset; 77 pieces.player1[player1_counter].y=y_fin[b]-offset;
78 pieces.player1[player1_counter].z=z_fin; 78 pieces.player1[player1_counter].z=z_fin;
79 } 79 }
80 else if(b>=5 && b<10) 80 else if(b>=5 && b<10)
81 { 81 {
82 pieces.player1[player1_counter].x=x_fin1[1]-offset; 82 pieces.player1[player1_counter].x=x_fin1[1]-offset;
83 pieces.player1[player1_counter].y=y_fin[b-5]-offset; 83 pieces.player1[player1_counter].y=y_fin[b-5]-offset;
84 pieces.player1[player1_counter].z=z_fin; 84 pieces.player1[player1_counter].z=z_fin;
85 } 85 }
86 else 86 else
87 { 87 {
88 pieces.player1[player1_counter].x=x_fin1[2]-offset; 88 pieces.player1[player1_counter].x=x_fin1[2]-offset;
89 pieces.player1[player1_counter].y=y_fin[b-10]-offset; 89 pieces.player1[player1_counter].y=y_fin[b-10]-offset;
90 pieces.player1[player1_counter].z=z_fin; 90 pieces.player1[player1_counter].z=z_fin;
91 } 91 }
92 pieces.player1[player1_counter].side=true; 92 pieces.player1[player1_counter].side=true;
93 player1_counter++; 93 player1_counter++;
94 94
95 } 95 }
96 } 96 }
97 97
98 else if(population[a].total<0) //player 2 pieces 98 else if(population[a].total<0) //player 2 pieces
99 { 99 {
100 pieces.player2[player2_counter].x=x_coord[a]-offset; 100 pieces.player2[player2_counter].x=x_coord[a]-offset;
101 if(a>=0 && a<13) 101 if(a>=0 && a<13)