00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "gameprivate.h"
00022 #include "scene.h"
00023
00024 #include <core/debughelper.h>
00025
00026 using namespace GluonEngine;
00027
00028 GamePrivate::GamePrivate()
00029 : gameRunning( false )
00030 , gamePaused( false )
00031 , currentScene( NULL )
00032 , resetScene( false )
00033 , gameProject( NULL )
00034 {
00035 }
00036
00037 GamePrivate::GamePrivate( const GamePrivate& other )
00038 : QSharedData( other )
00039 , time( other.time )
00040 , gameRunning( other.gameRunning )
00041 , gamePaused( other.gamePaused )
00042 , currentScene( other.currentScene )
00043 , resetScene( other.resetScene )
00044 , gameProject( other.gameProject )
00045 {
00046 }
00047
00048 GamePrivate::~GamePrivate()
00049 {
00050 }
00051
00052 QList<const GluonCore::GluonObject*>
00053 GamePrivate::listAllChildren( const GluonCore::GluonObject* root ) const
00054 {
00055 QList<const GluonCore::GluonObject*> list;
00056 if( root )
00057 {
00058 list.append( root );
00059 foreach( const QObject * child, root->children() )
00060 {
00061 list.append( listAllChildren( qobject_cast<const GluonCore::GluonObject*>( child ) ) );
00062 }
00063 }
00064 return list;
00065 }
00066
00067 Scene *
00068 GamePrivate::findSceneInChildren( QObject* object )
00069 {
00070 DEBUG_BLOCK
00071 foreach( QObject * child, object->children() )
00072 {
00073 DEBUG_TEXT( QString( "Checking child %1" ).arg( qobject_cast<GluonCore::GluonObject*>( child )->fullyQualifiedName() ) );
00074 Scene* scene = qobject_cast<Scene*>( child );
00075 if( scene )
00076 return scene;
00077 else
00078 {
00079 Scene* foundChild = findSceneInChildren( child );
00080 if( foundChild )
00081 return foundChild;
00082 }
00083 }
00084 return NULL;
00085 }