[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames/kolf
From: Stefan Majewsky <majewsky () gmx ! net>
Date: 2010-10-31 23:23:43
Message-ID: 20101031232343.A4AA6AC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1191719 by majewsky:
Fix Ball simulation when ball is invisible.
M +2 -1 ball.cpp
M +2 -1 canvasitem.h
M +1 -1 game.cpp
--- trunk/KDE/kdegames/kolf/ball.cpp #1191718:1191719
@@ -61,7 +61,7 @@
void Ball::setState(BallState newState)
{
state = newState;
- if (state == Holed)
+ if (state == Holed || !EllipticalCanvasItem::isVisible())
setSimulationType(CanvasItem::NoSimulation);
else
setSimulationType(CanvasItem::DynamicSimulation);
@@ -210,6 +210,7 @@
void Ball::setVisible(bool yes)
{
EllipticalCanvasItem::setVisible(yes);
+ setState(state);
label->setVisible(yes && game && game->isInfoShowing());
}
--- trunk/KDE/kdegames/kolf/canvasitem.h #1191718:1191719
@@ -149,7 +149,8 @@
CollisionSimulation = CollisionFlag,
///The object moves according to its kinematic state.
KinematicSimulation = CollisionSimulation | KinematicSimulationFlag,
- ///Other objects can collide with the shape of this object.
+ ///This object collides with the shapes of other objects, and forces
+ ///can act on it.
DynamicSimulation = KinematicSimulation | DynamicSimulationFlag
};
--- trunk/KDE/kdegames/kolf/game.cpp #1191718:1191719
@@ -1277,13 +1277,13 @@
void BlackHole::eject(Ball *ball, double speed)
{
+ ball->setVisible(true);
//place ball 10 units after exit, and set exit velocity
const Vector direction = Vector::fromMagnitudeDirection(1, -deg2rad(exitDeg));
ball->setPos(exitItem->pos() + 10 * direction);
ball->setVelocity(speed * direction);
ball->setForceStillGoing(false);
- ball->setVisible(true);
ball->setState(Rolling);
runs++;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic