Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Games
Palapeli
Commits
fb10761b
Commit
fb10761b
authored
Apr 05, 2010
by
Stefan Majewsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make piece shadow creation feel more responsive.
svn path=/trunk/KDE/kdegames/palapeli/; revision=1111399
parent
1052758a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
src/engine/piece.cpp
src/engine/piece.cpp
+1
-2
src/engine/scene.cpp
src/engine/scene.cpp
+11
-1
src/engine/scene.h
src/engine/scene.h
+3
-1
No files found.
src/engine/piece.cpp
View file @
fb10761b
...
...
@@ -201,8 +201,7 @@ void Palapeli::Piece::doMove()
if
(
scene
)
{
scene
->
validatePiecePosition
(
this
);
//TODO: savegame is updated multiple times at once when multiple pieces are moved
scene
->
updateSavegame
();
scene
->
invalidateSavegame
();
}
}
...
...
src/engine/scene.cpp
View file @
fb10761b
...
...
@@ -42,8 +42,12 @@ Palapeli::Scene::Scene(QObject* parent)
:
QGraphicsScene
(
parent
)
,
m_constrained
(
false
)
,
m_constraintVisualizer
(
new
Palapeli
::
ConstraintVisualizer
(
this
))
,
m_savegameTimer
(
new
QTimer
(
this
))
,
m_loadingPuzzle
(
false
)
{
m_savegameTimer
->
setInterval
(
500
);
//write savegame twice per second at most
m_savegameTimer
->
setSingleShot
(
true
);
connect
(
m_savegameTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateSavegame
()));
connect
(
&
m_metadataLoader
,
SIGNAL
(
finished
()),
this
,
SLOT
(
continueLoading
()));
}
...
...
@@ -332,10 +336,16 @@ void Palapeli::Scene::pieceMoved()
mergeCandidates
<<
piece
;
}
searchConnections
(
mergeCandidates
);
up
dateSavegame
();
invali
dateSavegame
();
emit
reportProgress
(
m_atomicPieceCount
,
m_pieces
.
count
());
}
void
Palapeli
::
Scene
::
invalidateSavegame
()
{
if
(
!
m_savegameTimer
->
isActive
())
m_savegameTimer
->
start
();
}
void
Palapeli
::
Scene
::
updateSavegame
()
{
//save piece positions
...
...
src/engine/scene.h
View file @
fb10761b
...
...
@@ -48,7 +48,7 @@ namespace Palapeli
void
loadPuzzle
(
const
QModelIndex
&
index
);
void
restartPuzzle
();
void
setConstrained
(
bool
constrained
);
void
up
dateSavegame
();
void
invali
dateSavegame
();
Q_SIGNALS:
void
constrainedChanged
(
bool
constrained
);
void
puzzleStarted
();
...
...
@@ -57,6 +57,7 @@ namespace Palapeli
private
Q_SLOTS
:
void
pieceMoved
();
void
pieceInstanceTransaction
(
const
QList
<
Palapeli
::
Piece
*>&
deletedPieces
,
const
QList
<
Palapeli
::
Piece
*>&
createdPieces
);
void
updateSavegame
();
void
playVictoryAnimation
();
void
playVictoryAnimation2
();
void
playVictoryAnimation3
();
...
...
@@ -77,6 +78,7 @@ namespace Palapeli
QString
m_identifier
;
QPointer
<
Palapeli
::
Puzzle
>
m_puzzle
;
QList
<
Palapeli
::
Piece
*>
m_pieces
;
QTimer
*
m_savegameTimer
;
int
m_atomicPieceCount
;
//some stuff needed for loading puzzles
bool
m_loadingPuzzle
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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