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
611544b8
Commit
611544b8
authored
Jun 11, 2009
by
Max-Wilhelm Bruker
Browse files
bounds checking for card movement
parent
2fbfddf8
Changes
2
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/libraryzone.cpp
View file @
611544b8
...
@@ -81,8 +81,7 @@ void LibraryZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -81,8 +81,7 @@ void LibraryZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
setCursor
(
Qt
::
OpenHandCursor
);
setCursor
(
Qt
::
OpenHandCursor
);
}
}
void
LibraryZone
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
LibraryZone
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*/
*
event
*/
)
{
{
Q_UNUSED
(
event
);
setCursor
(
Qt
::
OpenHandCursor
);
setCursor
(
Qt
::
OpenHandCursor
);
}
}
cockatrice/src/tablezone.cpp
View file @
611544b8
...
@@ -14,10 +14,8 @@ QRectF TableZone::boundingRect() const
...
@@ -14,10 +14,8 @@ QRectF TableZone::boundingRect() const
return
QRectF
(
0
,
0
,
width
,
height
);
return
QRectF
(
0
,
0
,
width
,
height
);
}
}
void
TableZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
void
TableZone
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*/
*
option
*/
,
QWidget
*/
*
widget
*/
)
{
{
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
painter
->
fillRect
(
boundingRect
(),
QColor
(
0
,
0
,
100
));
painter
->
fillRect
(
boundingRect
(),
QColor
(
0
,
0
,
100
));
}
}
...
@@ -38,7 +36,17 @@ void TableZone::addCardImpl(CardItem *card, int x, int y)
...
@@ -38,7 +36,17 @@ void TableZone::addCardImpl(CardItem *card, int x, int y)
void
TableZone
::
handleDropEvent
(
int
cardId
,
CardZone
*
startZone
,
const
QPoint
&
dropPoint
,
bool
faceDown
)
void
TableZone
::
handleDropEvent
(
int
cardId
,
CardZone
*
startZone
,
const
QPoint
&
dropPoint
,
bool
faceDown
)
{
{
player
->
client
->
moveCard
(
cardId
,
startZone
->
getName
(),
getName
(),
dropPoint
.
x
(),
dropPoint
.
y
(),
faceDown
);
int
x
=
dropPoint
.
x
();
int
y
=
dropPoint
.
y
();
if
(
x
<
0
)
x
=
0
;
if
(
y
<
0
)
y
=
0
;
if
(
x
>
width
-
CARD_WIDTH
)
x
=
width
-
CARD_WIDTH
;
if
(
y
>
height
-
CARD_HEIGHT
)
y
=
height
-
CARD_HEIGHT
;
player
->
client
->
moveCard
(
cardId
,
startZone
->
getName
(),
getName
(),
x
,
y
,
faceDown
);
}
}
void
TableZone
::
reorganizeCards
()
void
TableZone
::
reorganizeCards
()
...
...
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