Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
6e942211
Commit
6e942211
authored
Mar 25, 2009
by
Max-Wilhelm Bruker
Browse files
improved appearance
parent
8782438f
Changes
20
Hide whitespace changes
Inline
Side-by-side
cockatrice/cockatrice.pro
View file @
6e942211
...
...
@@ -12,5 +12,5 @@ QT += network
#
QTPLUGIN
+=
qjpeg
#
Input
HEADERS
+=
src
/
counter
.
h
src
/
dlg_games
.
h
src
/
dlg_creategame
.
h
src
/
dlg_connect
.
h
src
/
gamesmodel
.
h
src
/
client
.
h
src
/
window
.
h
src
/
servergame
.
h
src
/
servereventdata
.
h
src
/
serverresponse
.
h
src
/
pendingcommand
.
h
src
/
zonelist
.
h
src
/
counterlist
.
h
src
/
cardzone
.
h
src
/
player
.
h
src
/
cardlist
.
h
src
/
carditem
.
h
src
/
tablezone
.
h
src
/
handzone
.
h
src
/
playerlist
.
h
src
/
game
.
h
src
/
carddatabase
.
h
src
/
gameview
.
h
src
/
decklistmodel
.
h
src
/
dlg_startgame
.
h
src
/
cardinfowidget
.
h
src
/
messagelogwidget
.
h
src
/
serverzonecard
.
h
src
/
zoneviewzone
.
h
src
/
zoneviewwidget
.
h
src
/
libraryzone
.
h
src
/
gravezone
.
h
src
/
rfgzone
.
h
src
/
sideboardzone
.
h
src
/
carddragitem
.
h
src
/
zoneclosebutton
.
h
src
/
zoneviewlayout
.
h
SOURCES
+=
src
/
counter
.
cpp
src
/
dlg_games
.
cpp
src
/
dlg_creategame
.
cpp
src
/
dlg_connect
.
cpp
src
/
client
.
cpp
src
/
main
.
cpp
src
/
window
.
cpp
src
/
servereventdata
.
cpp
src
/
gamesmodel
.
cpp
src
/
player
.
cpp
src
/
cardzone
.
cpp
src
/
zonelist
.
cpp
src
/
counterlist
.
cpp
src
/
cardlist
.
cpp
src
/
carditem
.
cpp
src
/
tablezone
.
cpp
src
/
handzone
.
cpp
src
/
playerlist
.
cpp
src
/
game
.
cpp
src
/
carddatabase
.
cpp
src
/
gameview
.
cpp
src
/
decklistmodel
.
cpp
src
/
dlg_startgame
.
cpp
src
/
cardinfowidget
.
cpp
src
/
messagelogwidget
.
cpp
src
/
zoneviewzone
.
cpp
src
/
zoneviewwidget
.
cpp
src
/
libraryzone
.
cpp
src
/
gravezone
.
cpp
src
/
rfgzone
.
cpp
src
/
sideboardzone
.
cpp
src
/
carddragitem
.
cpp
src
/
zoneclosebutton
.
cpp
src
/
zoneviewlayout
.
cpp
HEADERS
+=
src
/
counter
.
h
src
/
dlg_games
.
h
src
/
dlg_creategame
.
h
src
/
dlg_connect
.
h
src
/
gamesmodel
.
h
src
/
client
.
h
src
/
window
.
h
src
/
servergame
.
h
src
/
servereventdata
.
h
src
/
serverresponse
.
h
src
/
pendingcommand
.
h
src
/
zonelist
.
h
src
/
counterlist
.
h
src
/
cardzone
.
h
src
/
player
.
h
src
/
cardlist
.
h
src
/
carditem
.
h
src
/
tablezone
.
h
src
/
handzone
.
h
src
/
playerlist
.
h
src
/
game
.
h
src
/
carddatabase
.
h
src
/
gameview
.
h
src
/
decklistmodel
.
h
src
/
dlg_startgame
.
h
src
/
cardinfowidget
.
h
src
/
messagelogwidget
.
h
src
/
serverzonecard
.
h
src
/
zoneviewzone
.
h
src
/
zoneviewwidget
.
h
src
/
libraryzone
.
h
src
/
gravezone
.
h
src
/
rfgzone
.
h
src
/
sideboardzone
.
h
src
/
carddragitem
.
h
src
/
zoneclosebutton
.
h
src
/
zoneviewlayout
.
h
src
/
playerarea
.
h
SOURCES
+=
src
/
counter
.
cpp
src
/
dlg_games
.
cpp
src
/
dlg_creategame
.
cpp
src
/
dlg_connect
.
cpp
src
/
client
.
cpp
src
/
main
.
cpp
src
/
window
.
cpp
src
/
servereventdata
.
cpp
src
/
gamesmodel
.
cpp
src
/
player
.
cpp
src
/
cardzone
.
cpp
src
/
zonelist
.
cpp
src
/
counterlist
.
cpp
src
/
cardlist
.
cpp
src
/
carditem
.
cpp
src
/
tablezone
.
cpp
src
/
handzone
.
cpp
src
/
playerlist
.
cpp
src
/
game
.
cpp
src
/
carddatabase
.
cpp
src
/
gameview
.
cpp
src
/
decklistmodel
.
cpp
src
/
dlg_startgame
.
cpp
src
/
cardinfowidget
.
cpp
src
/
messagelogwidget
.
cpp
src
/
zoneviewzone
.
cpp
src
/
zoneviewwidget
.
cpp
src
/
libraryzone
.
cpp
src
/
gravezone
.
cpp
src
/
rfgzone
.
cpp
src
/
sideboardzone
.
cpp
src
/
carddragitem
.
cpp
src
/
zoneclosebutton
.
cpp
src
/
zoneviewlayout
.
cpp
src
/
playerarea
.
cpp
cockatrice/src/carddragitem.cpp
View file @
6e942211
...
...
@@ -82,13 +82,13 @@ void CardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
if
(
dropZone
)
{
dropZone
->
handleDropEvent
(
id
,
startZone
,
(
sp
-
dropZone
->
p
os
()).
toPoint
());
dropZone
->
handleDropEvent
(
id
,
startZone
,
(
sp
-
dropZone
->
sceneP
os
()).
toPoint
());
QList
<
QGraphicsItem
*>
childList
=
childItems
();
for
(
int
i
=
0
;
i
<
childList
.
size
();
i
++
)
{
CardDragItem
*
c
=
qgraphicsitem_cast
<
CardDragItem
*>
(
childList
.
at
(
i
));
if
(
!
c
)
QMessageBox
::
critical
(
0
,
"fehler"
,
"null"
);
dropZone
->
handleDropEvent
(
c
->
id
,
startZone
,
(
sp
-
dropZone
->
p
os
()
+
c
->
pos
()).
toPoint
());
dropZone
->
handleDropEvent
(
c
->
id
,
startZone
,
(
sp
-
dropZone
->
sceneP
os
()
+
c
->
pos
()).
toPoint
());
}
}
else
QMessageBox
::
critical
(
0
,
"fehler"
,
"fehler"
);
...
...
cockatrice/src/cardzone.h
View file @
6e942211
...
...
@@ -10,6 +10,7 @@ class QMenu;
class
CardZone
:
public
QGraphicsItem
{
protected:
QPixmap
*
image
;
Player
*
player
;
QString
name
;
CardList
*
cards
;
...
...
cockatrice/src/game.cpp
View file @
6e942211
...
...
@@ -99,15 +99,7 @@ Game::~Game()
Player
*
Game
::
addPlayer
(
int
playerId
,
const
QString
&
playerName
,
QPointF
base
,
bool
local
)
{
Player
*
newPlayer
=
new
Player
(
playerName
,
playerId
,
base
,
local
,
db
,
client
);
const
ZoneList
*
const
z
=
newPlayer
->
getZones
();
for
(
int
i
=
0
;
i
<
z
->
size
();
i
++
)
scene
->
addItem
(
z
->
at
(
i
));
const
CounterList
*
const
c
=
newPlayer
->
getCounters
();
for
(
int
i
=
0
;
i
<
c
->
size
();
i
++
)
scene
->
addItem
(
c
->
at
(
i
));
Player
*
newPlayer
=
new
Player
(
playerName
,
playerId
,
base
,
local
,
db
,
client
,
scene
);
connect
(
newPlayer
,
SIGNAL
(
hoverCard
(
QString
)),
this
,
SIGNAL
(
hoverCard
(
QString
)));
connect
(
newPlayer
,
SIGNAL
(
sigShowCardMenu
(
QPoint
)),
this
,
SLOT
(
showCardMenu
(
QPoint
)));
...
...
cockatrice/src/gravezone.cpp
View file @
6e942211
...
...
@@ -4,15 +4,15 @@
#include
"client.h"
#include
"zoneviewzone.h"
GraveZone
::
GraveZone
(
Player
*
_p
)
:
CardZone
(
_p
,
"grave"
)
GraveZone
::
GraveZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"grave"
,
parent
)
{
cards
=
new
CardList
(
true
);
}
QRectF
GraveZone
::
boundingRect
()
const
{
return
QRectF
(
0
,
0
,
50
,
50
);
return
QRectF
(
0
,
0
,
CARD_WIDTH
,
CARD_HEIGHT
);
}
void
GraveZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
...
...
@@ -20,10 +20,15 @@ void GraveZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
painter
->
save
();
painter
->
fillRect
(
boundingRect
(),
QColor
(
"yellow"
));
painter
->
setFont
(
QFont
(
"Times"
,
20
,
QFont
::
Bold
));
painter
->
setFont
(
QFont
(
"Times"
,
32
,
QFont
::
Bold
));
painter
->
setPen
(
QPen
(
QColor
(
"black"
)));
painter
->
setBackground
(
QBrush
(
QColor
(
255
,
255
,
255
,
100
)));
painter
->
setBackgroundMode
(
Qt
::
OpaqueMode
);
painter
->
drawText
(
boundingRect
(),
Qt
::
AlignCenter
,
QString
::
number
(
cards
->
size
()));
painter
->
restore
();
}
...
...
cockatrice/src/gravezone.h
View file @
6e942211
...
...
@@ -6,7 +6,7 @@
class
GraveZone
:
public
CardZone
{
private:
public:
GraveZone
(
Player
*
_p
);
GraveZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
addCard
(
CardItem
*
card
,
bool
reorganize
=
true
,
int
x
=
0
,
int
y
=
-
1
);
...
...
cockatrice/src/handzone.cpp
View file @
6e942211
...
...
@@ -3,8 +3,8 @@
#include
"player.h"
#include
"client.h"
HandZone
::
HandZone
(
Player
*
_p
)
:
CardZone
(
_p
,
"hand"
)
HandZone
::
HandZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"hand"
,
parent
)
{
cards
=
new
CardList
(
player
->
getLocal
());
}
...
...
cockatrice/src/handzone.h
View file @
6e942211
...
...
@@ -6,7 +6,7 @@
class
HandZone
:
public
CardZone
{
private:
public:
HandZone
(
Player
*
_p
);
HandZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
addCard
(
CardItem
*
card
,
bool
reorganize
=
true
,
int
x
=
-
1
,
int
y
=
-
1
);
...
...
cockatrice/src/libraryzone.cpp
View file @
6e942211
...
...
@@ -6,16 +6,19 @@
#include
"carddragitem.h"
#include
"zoneviewzone.h"
LibraryZone
::
LibraryZone
(
Player
*
_p
)
:
CardZone
(
_p
,
"deck"
)
LibraryZone
::
LibraryZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"deck"
,
parent
)
{
cards
=
new
CardList
(
false
);
setCursor
(
Qt
::
OpenHandCursor
);
setCacheMode
(
DeviceCoordinateCache
);
image
=
player
->
getDb
()
->
getCard
()
->
getPixmap
();
}
QRectF
LibraryZone
::
boundingRect
()
const
{
return
QRectF
(
0
,
0
,
50
,
50
);
return
QRectF
(
0
,
0
,
CARD_WIDTH
,
CARD_HEIGHT
);
}
void
LibraryZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
...
...
@@ -23,10 +26,17 @@ void LibraryZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
painter
->
save
();
painter
->
fillRect
(
boundingRect
(),
QColor
(
"red"
));
painter
->
setFont
(
QFont
(
"Times"
,
20
,
QFont
::
Bold
));
QRectF
foo
=
option
->
matrix
.
mapRect
(
boundingRect
());
QPixmap
bar
=
image
->
scaled
((
int
)
foo
.
width
(),
(
int
)
foo
.
height
(),
Qt
::
IgnoreAspectRatio
,
Qt
::
SmoothTransformation
);
painter
->
drawPixmap
(
boundingRect
(),
bar
,
bar
.
rect
());
painter
->
setFont
(
QFont
(
"Times"
,
32
,
QFont
::
Bold
));
painter
->
setPen
(
QPen
(
QColor
(
"black"
)));
painter
->
setBackground
(
QBrush
(
QColor
(
255
,
255
,
255
,
100
)));
painter
->
setBackgroundMode
(
Qt
::
OpaqueMode
);
painter
->
drawText
(
boundingRect
(),
Qt
::
AlignCenter
,
QString
::
number
(
cards
->
size
()));
painter
->
restore
();
}
...
...
cockatrice/src/libraryzone.h
View file @
6e942211
...
...
@@ -6,7 +6,7 @@
class
LibraryZone
:
public
CardZone
{
private:
public:
LibraryZone
(
Player
*
_p
);
LibraryZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
addCard
(
CardItem
*
card
,
bool
reorganize
=
true
,
int
x
=
0
,
int
y
=
-
1
);
...
...
cockatrice/src/player.cpp
View file @
6e942211
#include
"player.h"
#include
"client.h"
#include
"handzone.h"
#include
"tablezone.h"
#include
"libraryzone.h"
#include
"gravezone.h"
#include
"rfgzone.h"
#include
"sideboardzone.h"
#include
"cardzone.h"
#include
"playerarea.h"
#include
<QGraphicsScene>
#include
<QMenu>
Player
::
Player
(
const
QString
&
_name
,
int
_id
,
QPointF
_base
,
bool
_local
,
CardDatabase
*
_db
,
Client
*
_client
)
Player
::
Player
(
const
QString
&
_name
,
int
_id
,
QPointF
_base
,
bool
_local
,
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
)
:
QObject
(),
defaultNumberTopCards
(
3
),
name
(
_name
),
id
(
_id
),
base
(
_base
),
local
(
_local
),
db
(
_db
),
client
(
_client
)
{
LibraryZone
*
deck
=
new
LibraryZone
(
this
);
deck
->
setPos
(
_base
);
// XXX
qreal
foo
=
deck
->
boundingRect
().
height
();
GraveZone
*
grave
=
new
GraveZone
(
this
);
grave
->
setPos
(
_base
+
QPointF
(
0
,
foo
));
RfgZone
*
rfg
=
new
RfgZone
(
this
);
rfg
->
setPos
(
_base
+
QPointF
(
0
,
2
*
foo
));
SideboardZone
*
sb
=
new
SideboardZone
(
this
);
sb
->
setPos
(
_base
+
QPointF
(
0
,
3
*
foo
));
area
=
new
PlayerArea
(
this
);
area
->
setPos
(
_base
);
_scene
->
addItem
(
area
);
Counter
*
life
=
new
Counter
(
this
,
"life"
);
life
->
setPos
(
_base
+
QPointF
(
-
50
,
5
*
foo
));
_base
+=
QPointF
(
deck
->
boundingRect
().
width
(),
0
);
CardZone
*
hand
=
new
HandZone
(
this
);
hand
->
setPos
(
_base
);
_base
+=
QPointF
(
hand
->
boundingRect
().
width
(),
0
);
CardZone
*
table
=
new
TableZone
(
this
);
table
->
setPos
(
_base
);
life
->
setPos
(
_base
+
QPointF
(
-
50
,
500
));
aMoveHandToTopLibrary
=
new
QAction
(
tr
(
"Move to &top of library"
),
this
);
connect
(
aMoveHandToTopLibrary
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actMoveHandToTopLibrary
()));
...
...
@@ -66,24 +43,24 @@ Player::Player(const QString &_name, int _id, QPointF _base, bool _local, CardDa
QMenu
*
handMenu
=
playerMenu
->
addMenu
(
tr
(
"&Hand"
));
handMenu
->
addAction
(
aMoveHandToTopLibrary
);
handMenu
->
addAction
(
aMoveHandToBottomLibrary
);
hand
->
setMenu
(
handMenu
);
zones
.
findZone
(
"
hand
"
)
->
setMenu
(
handMenu
);
QMenu
*
libraryMenu
=
playerMenu
->
addMenu
(
tr
(
"&Library"
));
libraryMenu
->
addAction
(
aViewLibrary
);
libraryMenu
->
addAction
(
aViewTopCards
);
deck
->
setMenu
(
libraryMenu
);
zones
.
findZone
(
"
deck
"
)
->
setMenu
(
libraryMenu
);
QMenu
*
graveMenu
=
playerMenu
->
addMenu
(
tr
(
"&Graveyard"
));
graveMenu
->
addAction
(
aViewGraveyard
);
grave
->
setMenu
(
graveMenu
);
zones
.
findZone
(
"
grave
"
)
->
setMenu
(
graveMenu
);
QMenu
*
rfgMenu
=
playerMenu
->
addMenu
(
tr
(
"&Removed cards"
));
rfgMenu
->
addAction
(
aViewRfg
);
rfg
->
setMenu
(
rfgMenu
);
zones
.
findZone
(
"
rfg
"
)
->
setMenu
(
rfgMenu
);
QMenu
*
sbMenu
=
playerMenu
->
addMenu
(
tr
(
"&Sideboard"
));
sbMenu
->
addAction
(
aViewSideboard
);
sb
->
setMenu
(
sbMenu
);
zones
.
findZone
(
"sb"
)
->
setMenu
(
sbMenu
);
}
Player
::~
Player
()
...
...
@@ -95,6 +72,8 @@ Player::~Player()
for
(
int
i
=
0
;
i
<
counters
.
size
();
i
++
)
delete
counters
.
at
(
i
);
delete
area
;
}
void
Player
::
actMoveHandToTopLibrary
()
...
...
cockatrice/src/player.h
View file @
6e942211
...
...
@@ -11,6 +11,7 @@ class Client;
class
CardDatabase
;
class
QMenu
;
class
QAction
;
class
PlayerArea
;
class
Player
:
public
QObject
{
Q_OBJECT
...
...
@@ -42,6 +43,8 @@ private:
QAction
*
aMoveHandToTopLibrary
,
*
aMoveHandToBottomLibrary
,
*
aViewLibrary
,
*
aViewTopCards
,
*
aViewGraveyard
,
*
aViewRfg
,
*
aViewSideboard
;
PlayerArea
*
area
;
int
defaultNumberTopCards
;
QString
name
;
int
id
;
...
...
@@ -54,7 +57,7 @@ public:
Client
*
client
;
void
addZone
(
CardZone
*
z
);
void
addCounter
(
Counter
*
c
);
Player
(
const
QString
&
_name
,
int
_id
,
QPointF
_base
,
bool
_local
,
CardDatabase
*
_db
,
Client
*
_client
);
Player
(
const
QString
&
_name
,
int
_id
,
QPointF
_base
,
bool
_local
,
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
);
~
Player
();
QMenu
*
getPlayerMenu
()
const
{
return
playerMenu
;
}
int
getId
()
const
{
return
id
;
}
...
...
cockatrice/src/playerarea.cpp
0 → 100644
View file @
6e942211
#include
"playerarea.h"
#include
"player.h"
#include
"tablezone.h"
#include
"handzone.h"
#include
"libraryzone.h"
#include
"gravezone.h"
#include
"rfgzone.h"
#include
"sideboardzone.h"
#include
<QPainter>
PlayerArea
::
PlayerArea
(
Player
*
_player
,
QGraphicsItem
*
parent
)
:
QGraphicsItem
(
parent
),
player
(
_player
)
{
QPointF
base
=
QPointF
(
20
,
50
);
LibraryZone
*
deck
=
new
LibraryZone
(
_player
,
this
);
deck
->
setPos
(
base
);
qreal
h
=
deck
->
boundingRect
().
height
()
+
20
;
GraveZone
*
grave
=
new
GraveZone
(
_player
,
this
);
grave
->
setPos
(
base
+
QPointF
(
0
,
h
));
RfgZone
*
rfg
=
new
RfgZone
(
_player
,
this
);
rfg
->
setPos
(
base
+
QPointF
(
0
,
2
*
h
));
SideboardZone
*
sb
=
new
SideboardZone
(
_player
,
this
);
sb
->
setVisible
(
false
);
base
=
QPointF
(
deck
->
boundingRect
().
width
()
+
40
,
0
);
CardZone
*
hand
=
new
HandZone
(
_player
,
this
);
hand
->
setPos
(
base
);
base
+=
QPointF
(
hand
->
boundingRect
().
width
(),
0
);
CardZone
*
table
=
new
TableZone
(
_player
,
this
);
table
->
setPos
(
base
);
bRect
=
QRectF
(
0
,
0
,
base
.
x
()
+
table
->
boundingRect
().
width
(),
base
.
y
()
+
table
->
boundingRect
().
height
());
}
PlayerArea
::~
PlayerArea
()
{
}
QRectF
PlayerArea
::
boundingRect
()
const
{
return
bRect
;
}
void
PlayerArea
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
painter
->
save
();
painter
->
fillRect
(
boundingRect
(),
QColor
(
200
,
200
,
200
));
painter
->
setFont
(
QFont
(
"Times"
,
16
,
QFont
::
Bold
));
painter
->
setPen
(
QPen
(
QColor
(
"black"
)));
painter
->
drawText
(
QRectF
(
0
,
0
,
CARD_WIDTH
+
40
,
40
),
Qt
::
AlignCenter
,
player
->
getName
());
painter
->
restore
();
}
cockatrice/src/playerarea.h
0 → 100644
View file @
6e942211
#ifndef PLAYERAREA_H
#define PLAYERAREA_H
#include
"carditem.h"
class
Player
;
class
PlayerArea
:
public
QGraphicsItem
{
private:
QRectF
bRect
;
Player
*
player
;
public:
enum
{
Type
=
typeOther
};
int
type
()
const
{
return
Type
;
}
PlayerArea
(
Player
*
_player
,
QGraphicsItem
*
parent
=
0
);
~
PlayerArea
();
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
};
#endif
cockatrice/src/rfgzone.cpp
View file @
6e942211
...
...
@@ -4,15 +4,15 @@
#include
"client.h"
#include
"zoneviewzone.h"
RfgZone
::
RfgZone
(
Player
*
_p
)
:
CardZone
(
_p
,
"rfg"
)
RfgZone
::
RfgZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"rfg"
,
parent
)
{
cards
=
new
CardList
(
true
);
}
QRectF
RfgZone
::
boundingRect
()
const
{
return
QRectF
(
0
,
0
,
50
,
50
);
return
QRectF
(
0
,
0
,
CARD_WIDTH
,
CARD_HEIGHT
);
}
void
RfgZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
...
...
@@ -20,10 +20,15 @@ void RfgZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
painter
->
save
();
painter
->
fillRect
(
boundingRect
(),
QColor
(
"white"
));
painter
->
setFont
(
QFont
(
"Times"
,
20
,
QFont
::
Bold
));
painter
->
fillRect
(
boundingRect
(),
QColor
(
"yellow"
));
painter
->
setFont
(
QFont
(
"Times"
,
32
,
QFont
::
Bold
));
painter
->
setPen
(
QPen
(
QColor
(
"black"
)));
painter
->
setBackground
(
QBrush
(
QColor
(
255
,
255
,
255
,
100
)));
painter
->
setBackgroundMode
(
Qt
::
OpaqueMode
);
painter
->
drawText
(
boundingRect
(),
Qt
::
AlignCenter
,
QString
::
number
(
cards
->
size
()));
painter
->
restore
();
}
...
...
cockatrice/src/rfgzone.h
View file @
6e942211
...
...
@@ -6,7 +6,7 @@
class
RfgZone
:
public
CardZone
{
private:
public:
RfgZone
(
Player
*
_p
);
RfgZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
addCard
(
CardItem
*
card
,
bool
reorganize
=
true
,
int
x
=
0
,
int
y
=
-
1
);
...
...
cockatrice/src/sideboardzone.cpp
View file @
6e942211
...
...
@@ -4,8 +4,8 @@
#include
"client.h"
#include
"zoneviewzone.h"
SideboardZone
::
SideboardZone
(
Player
*
_p
)
:
CardZone
(
_p
,
"sb"
)
SideboardZone
::
SideboardZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"sb"
,
parent
)
{
cards
=
new
CardList
(
false
);
}
...
...
cockatrice/src/sideboardzone.h
View file @
6e942211
...
...
@@ -6,7 +6,7 @@
class
SideboardZone
:
public
CardZone
{
private:
public:
SideboardZone
(
Player
*
_p
);
SideboardZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
addCard
(
CardItem
*
card
,
bool
reorganize
=
true
,
int
x
=
0
,
int
y
=
-
1
);
...
...
cockatrice/src/tablezone.cpp
View file @
6e942211
...
...
@@ -3,8 +3,8 @@
#include
"player.h"
#include
"client.h"
TableZone
::
TableZone
(
Player
*
_p
)
:
CardZone
(
_p
,
"table"
),
width
(
700
),
height
(
500
)
TableZone
::
TableZone
(
Player
*
_p
,
QGraphicsItem
*
parent
)
:
CardZone
(
_p
,
"table"
,
parent
),
width
(
700
),
height
(
500
)
{
cards
=
new
CardList
(
true
);
hasCardAttr
=
true
;
...
...
@@ -19,7 +19,7 @@ void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
{
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
painter
->
fillRect
(
boundingRect
(),
QColor
(
"blue"
));
painter
->
fillRect
(
boundingRect
(),
QColor
(
0
,
0
,
100
));
}
void
TableZone
::
addCard
(
CardItem
*
card
,
bool
reorganize
,
int
x
,
int
y
)
...
...
@@ -31,10 +31,12 @@ void TableZone::addCard(CardItem *card, bool reorganize, int x, int y)
y
=
height
-
CARD_HEIGHT
-
y
;
card
->
setPos
(
x
,
y
);
}
qDebug
(
QString
(
"zValue = %1, x = %2, y = %3"
).
arg
((
y
+
CARD_HEIGHT
)
*
width
+
x
+
1000
).
arg
(
x
).
arg
(
y
).
toLatin1
());
card
->
setZValue
((
y
+
CARD_HEIGHT
)
*
width
+
x
+
1000
);
card
->
setParentItem
(
this
);
card
->
setVisible
(
true
);
card
->
update
(
card
->
boundingRect
());
}
void
TableZone
::
handleDropEvent
(
int
cardId
,
CardZone
*
startZone
,
const
QPoint
&
dropPoint
)
...
...
cockatrice/src/tablezone.h
View file @
6e942211
...
...
@@ -10,7 +10,7 @@ class TableZone : public CardZone {
private:
int
width
,
height
;
public:
TableZone
(
Player
*
_p
);
TableZone
(
Player
*
_p
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
addCard
(
CardItem
*
card
,
bool
reorganize
=
true
,
int
x
=
-
1
,
int
y
=
-
1
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment