void Test::Init() { // Register the spaces that should be updated with this system. RegisterSpace("Game World"); // Set which space this gamestate's Update() function should be used with. SetLogicalSpace("Game World"); // Register for drawable objects RegisterComponent(MC_Transform); RegisterComponent(MC_Sprite); RegisterComponent(MC_Particle); switch (DemoToUse) { case (Demo::Pretzel): PretzelInit(200); break; case (Demo::FireBall): FireBallInit(200); break; case Demo::Explosion: ExplosionInit(200); break; default: break; } }
void Test::FireBallInit(unsigned count) { // Seed the RNG srand(static_cast<unsigned>(time(NULL))); // Set the Particle Demo space as the logical space for this gamestate. SetLogicalSpace("Particle Demo"); // Register the Particle Demo space as a space that should be updated each frame. RegisterSpace("Particle Demo"); // We also won't be using the "Game World" space, so we can deregister it. DeRegisterSpace("Game World"); // Create the space for the demo to run in. SpacePtr particleDemo = ENGINE->CreateSpace("Particle Demo"); // Clear out any existing objects in the space, except the camera. particleDemo->Clear(); // Specify which systems should be updated for this demo. particleDemo->AddSystem(GETSYS(CameraSystem)); particleDemo->AddSystem(GETSYS(GLGraphics)); }
//============================================================ // <T>配置处理。</T> // // @return 处理结果 //============================================================ TResult FEwAssetConsole::Setup(){ // 获得应用路径 TCharC* pApplicationPath = RApplication::Instance().Parameters()->FindValue("-application"); SetDirectory(pApplicationPath); // 注册资源路径 TFsPath path; path.AssignFormat("%s/Asset", pApplicationPath); path.Replace('\\', '/'); RegisterSpace("asset", path); // 注册脚本路径 path.AssignFormat("%s/Script", pApplicationPath); path.Replace('\\', '/'); RegisterSpace("script", path); //............................................................ // 注册渲染器路径 TCharC* pSystemPath = RApplication::Instance().Parameters()->FindValue("-system"); if(pSystemPath == NULL){ pSystemPath = pApplicationPath; } path.AssignFormat("%s/Shader", pSystemPath); path.Replace('\\', '/'); RegisterSpace("shader", path); return ESuccess; }