[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/games/kolf-ng
From: Stefan Majewsky <majewsky () gmx ! net>
Date: 2009-09-18 7:59:46
Message-ID: 1253260786.309021.28177.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1025152 by majewsky:
Rename the ObjectFactory to ObjectRegistry (and the BIND_KOLF_OBJECT macro to \
REGISTER_KOLF_OBJECT), and add metadata to all Kolf::Object subclasses in this \
process. (This metadata is needed for the editor interface.)
M +1 -1 CMakeLists.txt
M +2 -2 elements/ball.cpp
M +3 -3 elements/managedobject.cpp
M +2 -2 elements/object-blackhole.cpp
M +2 -2 elements/object-circleblock.cpp
M +6 -6 elements/object-coursemeta.cpp
M +2 -2 elements/object-environment.cpp
M +2 -2 elements/object-hole.cpp
M +2 -2 elements/object-light.cpp
M +2 -2 elements/object-puddle.cpp
M +2 -2 elements/object-rectblock.cpp
M +2 -2 elements/object-wall.cpp
M +1 -1 elements/object.h
D elements/objectfactory.cpp
D elements/objectfactory.h
A elements/objectregistry.cpp [License: GPL (v2+)]
A elements/objectregistry.h [License: GPL (v2+)]
--- trunk/playground/games/kolf-ng/CMakeLists.txt #1025151:1025152
@@ -60,7 +60,7 @@
elements/object-puddle.cpp
elements/object-rectblock.cpp
elements/object-wall.cpp
- elements/objectfactory.cpp
+ elements/objectregistry.cpp
elements/overlay.cpp
elements/overlayareaitem.cpp
elements/overlay-blackhole.cpp
--- trunk/playground/games/kolf-ng/elements/ball.cpp #1025151:1025152
@@ -18,7 +18,7 @@
#include "ball.h"
#include "geometry-sphere.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-empty.h"
#include <QBrush>
@@ -29,7 +29,7 @@
const int Kolf::Ball::BallRadius = 10;
-BIND_KOLF_OBJECT(Kolf::Ball)
+REGISTER_KOLF_OBJECT(Kolf::Ball, ki18n("Ball (start position for all players)"), \
KIcon())
namespace Kolf
{
--- trunk/playground/games/kolf-ng/elements/managedobject.cpp #1025151:1025152
@@ -18,7 +18,7 @@
#include "managedobject.h"
#include "object.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "scene.h"
#include <KConfigGroup>
@@ -54,7 +54,7 @@
Kolf::ManagedObject::State* currentState = m_states[m_currentStateIndex];
if (!m_object && !currentState->isEmpty())
{
- m_object = Kolf::ObjectFactory::create(currentState->className(), m_scene);
+ m_object = Kolf::ObjectRegistry::createObject(currentState->className(), m_scene);
if (m_object)
{
currentState->applyToObject(m_object);
@@ -143,7 +143,7 @@
if (!toState->isEmpty())
{
//create object
- m_object = Kolf::ObjectFactory::create(toState->className(), m_scene);
+ m_object = Kolf::ObjectRegistry::createObject(toState->className(), m_scene);
if (m_object)
toState->applyToObject(m_object);
emit objectCreated(this);
--- trunk/playground/games/kolf-ng/elements/object-blackhole.cpp #1025151:1025152
@@ -20,7 +20,7 @@
#include "ball.h"
#include "geometry-sphere.h"
#include "object-hole.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-blackhole.h"
#include <cmath>
@@ -29,7 +29,7 @@
#include <QPen>
#include <QTimer>
-BIND_KOLF_OBJECT(Kolf::BlackHoleObject)
+REGISTER_KOLF_OBJECT(Kolf::BlackHoleObject, ki18n("Black hole"), KIcon())
const qreal Kolf::BlackHoleObject::ExitHalfLength = 20;
--- trunk/playground/games/kolf-ng/elements/object-circleblock.cpp #1025151:1025152
@@ -18,14 +18,14 @@
#include "object-circleblock.h"
#include "geometry-cylinder.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-circle.h"
#include <QBrush>
#include <QGraphicsEllipseItem>
#include <QPen>
-BIND_KOLF_OBJECT(Kolf::CircleBlockObject)
+REGISTER_KOLF_OBJECT(Kolf::CircleBlockObject, ki18n("Circular block"), KIcon())
Kolf::CircleBlockObject::CircleBlockObject(dWorldID worldID, dSpaceID spaceID)
: Kolf::Object(worldID, spaceID)
--- trunk/playground/games/kolf-ng/elements/object-coursemeta.cpp #1025151:1025152
@@ -17,12 +17,12 @@
***************************************************************************/
#include "object-coursemeta.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "object-wall.h"
#include "overlay-empty.h"
#include "scene.h"
-BIND_KOLF_OBJECT(Kolf::CourseMetaObject)
+REGISTER_KOLF_OBJECT(Kolf::CourseMetaObject, ki18n("Internal course \
representation"), KIcon())
Kolf::CourseMetaObject::CourseMetaObject(dWorldID worldID, dSpaceID spaceID)
: Kolf::Object(worldID, spaceID)
@@ -49,22 +49,22 @@
{
const QRectF sr = Kolf::Scene::SceneRect;
//upper wall
- Kolf::WallObject* wall = \
reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectFactory::create("Kolf::WallObject", \
this)); + Kolf::WallObject* wall = \
reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectRegistry::createObject("Kolf::WallObject", \
this)); //FIXME: ugly wall->setExtent(sr.topLeft(), sr.topRight());
m_courseBoundaryComponents << wall;
addSubObject(wall);
//lower wall
- wall = reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectFactory::create("Kolf::WallObject", \
this)); + wall = reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectRegistry::createObject("Kolf::WallObject", \
this)); wall->setExtent(sr.bottomLeft(), sr.bottomRight());
m_courseBoundaryComponents << wall;
addSubObject(wall);
//left wall
- wall = reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectFactory::create("Kolf::WallObject", \
this)); + wall = reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectRegistry::createObject("Kolf::WallObject", \
this)); wall->setExtent(sr.topLeft(), sr.bottomLeft());
m_courseBoundaryComponents << wall;
addSubObject(wall);
//right wall
- wall = reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectFactory::create("Kolf::WallObject", \
this)); + wall = reinterpret_cast<Kolf::WallObject*>(Kolf::ObjectRegistry::createObject("Kolf::WallObject", \
this)); wall->setExtent(sr.topRight(), sr.bottomRight());
m_courseBoundaryComponents << wall;
addSubObject(wall);
--- trunk/playground/games/kolf-ng/elements/object-environment.cpp #1025151:1025152
@@ -17,14 +17,14 @@
***************************************************************************/
#include "object-environment.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-empty.h"
#include "geometry-terrain.h"
#include <QPixmap>
#include <KStandardDirs>
-BIND_KOLF_OBJECT(Kolf::EnvironmentObject)
+REGISTER_KOLF_OBJECT(Kolf::EnvironmentObject, ki18n("Terrain"), KIcon())
namespace Kolf
{
--- trunk/playground/games/kolf-ng/elements/object-hole.cpp #1025151:1025152
@@ -19,14 +19,14 @@
#include "object-hole.h"
#include "ball.h"
#include "geometry-sphere.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-empty.h"
#include <QGraphicsEllipseItem>
const int Kolf::HoleObject::HoleRadius = 14; // = 1.4 * Kolf::Ball::BallRadius
-BIND_KOLF_OBJECT(Kolf::HoleObject)
+REGISTER_KOLF_OBJECT(Kolf::HoleObject, ki18n("Hole (target)"), KIcon())
Kolf::HoleObject::HoleObject(dWorldID worldID, dSpaceID spaceID)
: Kolf::Object(worldID, spaceID)
--- trunk/playground/games/kolf-ng/elements/object-light.cpp #1025151:1025152
@@ -17,10 +17,10 @@
***************************************************************************/
#include "object-light.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-empty.h"
-BIND_KOLF_OBJECT(Kolf::LightObject)
+REGISTER_KOLF_OBJECT(Kolf::LightObject, ki18n("Light source"), KIcon())
Kolf::LightObject::LightObject(dWorldID worldID, dSpaceID spaceID)
: Kolf::Object(worldID, spaceID)
--- trunk/playground/games/kolf-ng/elements/object-puddle.cpp #1025151:1025152
@@ -17,11 +17,11 @@
***************************************************************************/
#include "object-puddle.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-empty.h"
#include <KStandardDirs>
-BIND_KOLF_OBJECT(Kolf::PuddleObject)
+REGISTER_KOLF_OBJECT(Kolf::PuddleObject, ki18n("Puddle"), KIcon())
namespace Kolf
{
--- trunk/playground/games/kolf-ng/elements/object-rectblock.cpp #1025151:1025152
@@ -18,14 +18,14 @@
#include "object-rectblock.h"
#include "geometry-cuboid.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-rect.h"
#include <QBrush>
#include <QGraphicsRectItem>
#include <QPen>
-BIND_KOLF_OBJECT(Kolf::RectBlockObject)
+REGISTER_KOLF_OBJECT(Kolf::RectBlockObject, ki18n("Rectangular block"), KIcon())
Kolf::RectBlockObject::RectBlockObject(dWorldID worldID, dSpaceID spaceID)
: Kolf::Object(worldID, spaceID)
--- trunk/playground/games/kolf-ng/elements/object-wall.cpp #1025151:1025152
@@ -18,12 +18,12 @@
#include "object-wall.h"
#include "geometry-wall.h"
-#include "objectfactory.h"
+#include "objectregistry.h"
#include "overlay-wall.h"
#include <QPen>
-BIND_KOLF_OBJECT(Kolf::WallObject)
+REGISTER_KOLF_OBJECT(Kolf::WallObject, ki18n("Wall"), KIcon())
Kolf::WallObject::WallObject(dWorldID worldID, dSpaceID spaceID)
: Kolf::Object(worldID, spaceID)
--- trunk/playground/games/kolf-ng/elements/object.h #1025151:1025152
@@ -151,7 +151,7 @@
void propagateUpdate();
private:
friend class Geometry;
- friend class ObjectFactory;
+ friend class ObjectRegistry;
dBodyID m_bodyID;
dWorldID m_worldID;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic