Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Application initialization ---------------------------------------------------------
- bool Game::Initialize()
- {
- bool result;
- // Initialize R3D
- R3D::Initialize();
- // Set the frame time
- mFrameTime = floor(1000 / 60); // 60 FPS target (66.6 fps effectively)
- Window::Description windowDesc;
- // Setup the window
- windowDesc.Width = 960;
- windowDesc.Height = 640;
- windowDesc.Flags.Format = Texture::Format::RGB10A2UNorm;
- // Create a window and begin initialization
- result = mWindow.Create(windowDesc);
- if(!result) { return false; }
- // Prepare the resource manager
- Resource::Manager* resourceManager = Resource::Manager::Singleton;
- resourceManager->AddResourceLocation("/Resources/");
- resourceManager->InitializeResources();
- // Prepare the scene manager
- Scene::Manager* sceneManager = Scene::Manager::Singleton;
- sceneManager->Initialize();
- // Create a floor and a box
- Resource::Model floor, box;
- floor = resourceManager->GetModel("R3D/Plane");
- floor.Material = resourceManager->GetMaterial("Materials/Dirt");
- box = resourceManager->GetModel("R3D/Box");
- box.Material = resourceManager->GetMaterial("Materials/Brick");
- // Create a scene node and attach the models to it
- Scene::NodeID node;
- node = sceneManager->CreateNode();
- //--//
- node->Attach(floor);
- node->Attach(box);
- //--//
- node->Scale(10, 10, 10);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement