void GameWorld::CreateGame() { // create the environment background_manager_ = BackgroundManager::create(); background_manager_->game_world_ = this; addChild(background_manager_, E_LAYER_BACKGROUND); // create & add the batch node sprite_batch_node_ = CCSpriteBatchNode::create("cjtexset_01.png", 128); game_object_layer_->addChild(sprite_batch_node_); CreateWall(); CreateClown(); CreateBasePlatform(); CreatePlatform(); CreateCollectibles(); CreateHUD(); // enable touch & accelerometer setTouchEnabled(true); setAccelerometerEnabled(true); // everything created, start updating scheduleUpdate(); }
pIvhAlgo Alg_Init(ALGO_NOTIFICATION AlgoNotication, ULONG sensori, ULONG* sensoro) { TraceLog(TRACE_LEVEL_INFORMATION, TRACE_ALGO, "%!FUNC! Entry"); // pIvhAlgo algo = (pIvhAlgo)SAFE_ALLOCATE_POOL(NonPagedPool, sizeof(IvhAlgo), IVH_SENSOR_ALGO_POOL_TAG); pIvhAlgo algo = &algostruct; /* if (algo) { // ZERO it! SAFE_FILL_MEM (algo, sizeof (IvhAlgo), 0); TraceLog(TRACE_LEVEL_INFORMATION, TRACE_ALGO, "malloc memory for algo"); } else { // No memory TraceLog(TRACE_LEVEL_ERROR, TRACE_ALGO, "not enough memory"); return NULL; } */ ///algo->dev = dev; //cjy...BackupRegistersInit(algo->dev); algo->platform = CreatePlatform(&algo->calibrated); ULONG ability = 0; int number = 0; pIvhSensor sensors[IVH_SENSOR_TYPE_FUSION]; if(sensori & IVH_PHYSICAL_SENSOR_ACCELEROMETER3D) { sensors[number] = algo->accelerometer = CreateSensorAccelerometer(algo->platform); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_ACCELEROMETER3D; } } if(sensori & IVH_PHYSICAL_SENSOR_GYROSCOPE3D) { sensors[number] = algo->gyrometer = CreateSensorGyroscope(algo->platform); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_GYROSCOPE3D; } } if((sensori & IVH_PHYSICAL_SENSOR_ACCELEROMETER3D) && (sensori & IVH_PHYSICAL_SENSOR_MAGNETOMETER3D)) { algo->magnetometer = CreateSensorMagnetometer(algo->platform, algo->accelerometer, algo->gyrometer); if(algo->magnetometer != NULL) { sensors[number] = algo->orientation = CreateSensorOrientation(algo->platform, algo->accelerometer, algo->gyrometer, algo->magnetometer); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_ORIENTATION; } } } if(algo->orientation != NULL) { //create inclimeter and compass sensor sensors[number] = algo->compass = CreateSensorCompass(algo->orientation); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_COMPASS; } sensors[number] = algo->inclinometer = CreateSensorInclinometer(algo->orientation); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_INCLINOMETER; } //create virtual gyroscope if physical gyroscope is not exist if((sensori & IVH_PHYSICAL_SENSOR_GYROSCOPE3D) == 0) { sensors[number] = algo->gyrometer6axis = CreateSensorGyroscope6Axis(algo->orientation); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_GYROSCOPE3D; } } } if(sensori & IVH_PHYSICAL_SENSOR_AMBIENTLIGHT) { sensors[number] = algo->ambientlight = CreateSensorAmbientlight(algo->platform); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_AMBIENTLIGHT; } } if(sensori & IVH_PHYSICAL_SENSOR_PROXIMITY) { sensors[number] = algo->proximity = CreateSensorBiometricProximity(algo->platform); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_PROXIMITY; } } if(sensori & IVH_PHYSICAL_SENSOR_THERMOMETER) { sensors[number] = algo->thermometer = CreateSensorTemperature(algo->platform); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_THERMOMETER; } } if(sensori & IVH_PHYSICAL_SENSOR_BAROMETER) { sensors[number] = algo->barometer = CreateSensorBarometer(algo->platform); if(sensors[number] != NULL) { number++; ability |= IVH_VIRTUAL_SENSOR_BAROMETER; } } algo->fusion = CreateSensorFusion(AlgoNotication, sensors, number); if(*sensoro == 0) { *sensoro = ability; } else { *sensoro &= ability; } TraceLog(TRACE_LEVEL_INFORMATION, TRACE_ALGO, "%!FUNC! Exit"); return algo; }
bool cWindowSFML::Create( WindowSettings Settings, ContextSettings Context ) { if ( mWindow.Created ) return false; sf::VideoMode mode = sf::VideoMode::getDesktopMode(); mWindow.WindowConfig = Settings; mWindow.ContextConfig = Context; mWindow.DesktopResolution = eeSize( mode.width, mode.height ); if ( mWindow.WindowConfig.Style & WindowStyle::Titlebar ) mWindow.Flags |= sf::Style::Titlebar; if ( mWindow.WindowConfig.Style & WindowStyle::Resize ) mWindow.Flags |= sf::Style::Resize; if ( mWindow.WindowConfig.Style & WindowStyle::NoBorder ) mWindow.Flags = sf::Style::None; if ( mWindow.WindowConfig.Style & WindowStyle::UseDesktopResolution ) { mWindow.WindowConfig.Width = mode.width; mWindow.WindowConfig.Height = mode.height; } Uint32 TmpFlags = mWindow.Flags; if ( mWindow.WindowConfig.Style & WindowStyle::Fullscreen ) TmpFlags |= sf::Style::Fullscreen; mSFMLWindow.create( sf::VideoMode( Settings.Width, Settings.Height, Settings.BitsPerPixel ), mWindow.WindowConfig.Caption, TmpFlags, sf::ContextSettings( Context.DepthBufferSize, Context.StencilBufferSize ) ); mSFMLWindow.setVerticalSyncEnabled( Context.VSync ); if ( NULL == cGL::ExistsSingleton() ) { cGL::CreateSingleton( mWindow.ContextConfig.Version ); cGL::instance()->Init(); } CreatePlatform(); GetMainContext(); CreateView(); Setup2D(); mWindow.Created = true; mVisible = true; if ( "" != mWindow.WindowConfig.Icon ) { Icon( mWindow.WindowConfig.Icon ); } /// Init the clipboard after the window creation reinterpret_cast<cClipboardSFML*> ( mClipboard )->Init(); /// Init the input after the window creation reinterpret_cast<cInputSFML*> ( mInput )->Init(); LogSuccessfulInit( GetVersion() ); return true; }