Advertisement
Ember

wfeafef

Feb 17th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. // Application initialization ---------------------------------------------------------
  2. bool Game::Initialize()
  3. {
  4.     bool result;
  5.  
  6.     // Initialize R3D
  7.     R3D::Initialize();
  8.  
  9.     // Set the frame time
  10.     mFrameTime = floor(1000 / 60); // 60 FPS target (66.6 fps effectively)
  11.  
  12.     Window::Description windowDesc;
  13.     // Setup the window
  14.     windowDesc.Width = 960;
  15.     windowDesc.Height = 640;
  16.     windowDesc.Flags.Format = Texture::Format::RGB10A2UNorm;
  17.  
  18.     // Create a window and begin initialization
  19.     result = mWindow.Create(windowDesc);
  20.     if(!result) { return false; }
  21.  
  22.     // Prepare the resource manager
  23.     Resource::Manager* resourceManager = Resource::Manager::Singleton;
  24.     resourceManager->AddResourceLocation("/Resources/");
  25.     resourceManager->InitializeResources();
  26.  
  27.     // Prepare the scene manager
  28.     Scene::Manager* sceneManager = Scene::Manager::Singleton;
  29.     sceneManager->Initialize();
  30.  
  31.     // Create a floor and a box
  32.     Resource::Model floor, box;
  33.     floor = resourceManager->GetModel("R3D/Plane");
  34.     floor.Material = resourceManager->GetMaterial("Materials/Dirt");
  35.     box = resourceManager->GetModel("R3D/Box");
  36.     box.Material = resourceManager->GetMaterial("Materials/Brick");
  37.  
  38.     // Create a scene node and attach the models to it
  39.     Scene::NodeID node;
  40.     node = sceneManager->CreateNode();
  41.     //--//
  42.     node->Attach(floor);
  43.     node->Attach(box);
  44.     //--//
  45.     node->Scale(10, 10, 10);
  46.  
  47.     return true;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement