Exemple #1
0
void MyGame::Start(){
    // Execute System class startup
    GameSystem::Start();
    
    // Create the message
    CreateText();
    
    // Finally subscribe to the update event. Note that by subscribing events at this point we have already missed some events
    // like the ScreenMode event sent by the Graphics subsystem when opening the application window. To catch those as well we
    // could subscribe in the constructor instead.
    SubscribeToEvents();
}
Exemple #2
0
void HelloWorld::Start()
{
    // Execute base class startup
    Sample::Start();

    // Create "Hello World" Text
    CreateText();

    // Finally subscribe to the update event. Note that by subscribing events at this point we have already missed some events
    // like the ScreenMode event sent by the Graphics subsystem when opening the application window. To catch those as well we
    // could subscribe in the constructor instead.
    SubscribeToEvents();

    // Set the mouse mode to use in the sample
    Sample::InitMouseMode(MM_FREE);
}
void SignedDistanceFieldText::Start()
{
    // Execute base class startup
    Sample::Start();

    // Create the scene content
    CreateScene();

    // Create the UI content
    CreateInstructions();

    // Setup the viewport for displaying the scene
    SetupViewport();

    // Hook up to the frame update events
    SubscribeToEvents();
}
Exemple #4
0
void Ragdolls::Start()
{
    // Execute base class startup
    Sample::Start();

    // Create the scene content
    CreateScene();

    // Create the UI content
    CreateInstructions();

    // Setup the viewport for displaying the scene
    SetupViewport();

    // Hook up to the frame update and render post-update events
    SubscribeToEvents();
    Sample::InitMouseMode(MM_FREE);

}
void TacticsVictory::Start()
{
    gProfiler = GetSubsystem<Profiler>();
    PROFILER_FUNC_ENTER
    Application::Start();

    gTime = GetSubsystem<Time>();

    gLog = new Urho3D::Log(gContext);
    gLog->Open("log.txt");
    gLog->SetLevel(Urho3D::LOG_DEBUG);

    RegistrationFactories();

    CreateComponents();

    gCache->AddResourceDir(gFileSystem->GetProgramDir() + "../TVData");
    gFont = gCache->GetResource<Font>(SET::MENU::FONT::NAME);

    SetWindowTitleAndIcon();
    CreateConsoleAndDebugHud();

    XMLFile *style = gCache->GetResource<XMLFile>("UI/MainStyle.xml");
    gUIRoot->SetDefaultStyle(style);
    
    InitLocalizationSystem();

    gCamera = new lCamera();

    gGUI->Create();

    gFileSelector = new FileSelector(gContext);
    gFileSelector->GetWindow()->SetModal(false);
    gFileSelector->GetWindow()->SetVisible(false);

    SubscribeToEvents();

    CreateNewGame();

    PROFILER_FUNC_LEAVE
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
void TerminalTWT::Start()
{
    gLog = new Log(context_);
    gLog->SetLevel(Urho3D::LOG_INFO);
    gLog->Open("launcher.log");
    gGraphics = GetSubsystem<Graphics>();

    CreateUI();

    MakeWindow(StateWindow::Start);

    SubscribeToEvents();

    gContext = context_;

    CreateListFiles();

    thread.Run();

    thread.SetPriority(2);
}
void Urho2DPlatformer::Start()
{
    // Execute base class startup
    Sample::Start();

    sample2D_ = new Sample2D(context_);

    // Set filename for load/save functions
    sample2D_->demoFilename_ = "Platformer2D";

    // Create the scene content
    CreateScene();

    // Create the UI content
    sample2D_->CreateUIContent("PLATFORMER 2D DEMO", character2D_->remainingLifes_, character2D_->remainingCoins_);
    auto* ui = GetContext()->m_UISystem.get();
    Button* playButton = static_cast<Button*>(ui->GetRoot()->GetChild("PlayButton", true));
    playButton->released.Connect(this,&Urho2DPlatformer::HandlePlayButton);

    // Hook up to the frame update events
    SubscribeToEvents();
}
void HelloWorld::Start()
{
	Urho3D::Graphics* graphics = GetSubsystem<Urho3D::Graphics>();

	helloScene_ = new Urho3D::Scene(context_);
	helloScene_->CreateComponent<Urho3D::Octree>();
	
	auto objectNode = helloScene_->CreateChild();
	Urho3D::Node* lightNode = helloScene_->CreateChild();
	Urho3D::Node* cameraNode = helloScene_->CreateChild();
	//Urho3D::StaticModel* object = objectNode->CreateComponent<Urho3D::StaticModel>();
	//object->SetModel(GetSubsystem<Urho3D::ResourceCache>()->GetResource<Urho3D::Model>("Models/Mushroom.mdl"));
	//object->SetMaterial(GetSubsystem<Urho3D::ResourceCache>()->GetResource<Urho3D::Material>("Materials/Mushroom.xml"));
	Urho3D::Light* light = lightNode->CreateComponent<Urho3D::Light>();
	light->SetLightType(Urho3D::LIGHT_DIRECTIONAL);
	lightNode->SetDirection(Urho3D::Vector3(-1.0f, -1.0f, -1.0f));
	Urho3D::Camera* camera = cameraNode->CreateComponent<Urho3D::Camera>();
	camera->SetFarClip(10000.f);
	cameraNode->SetPosition(Urho3D::Vector3(0.0f, 0.f, 0.0f));
	cameraNode->SetRotation(Urho3D::Quaternion(5.f, Urho3D::Vector3(0.f, 1.f, 0.f)));
	Urho3D::Viewport* vp = new Urho3D::Viewport(context_, helloScene_, camera);
	GetSubsystem<Urho3D::Renderer>()->SetViewport(0, vp);
	//CreateText();
	SubscribeToEvents();

	//Urho3D::SharedPtr<Urho3D::RenderPath> effectRenderPath = vp->GetRenderPath()->Clone();
	//effectRenderPath->Append(GetSubsystem<Urho3D::ResourceCache>()->GetResource<Urho3D::XMLFile>("PostProcess/ColorCorrection.xml"));
	//effectRenderPath->Append(GetSubsystem<Urho3D::ResourceCache>()->GetResource<Urho3D::XMLFile>("PostProcess/FXAA3.xml"));
	//// Make the bloom mixing parameter more pronounced
	//effectRenderPath->SetShaderParameter("BloomMix", Urho3D::Vector2(0.9f, 0.6f));
	//effectRenderPath->SetEnabled("Bloom", false);
	//effectRenderPath->SetEnabled("FXAA3", false);
	//vp->SetRenderPath(effectRenderPath);

	Urho3D::Node* node = helloScene_->CreateChild();
	//node->SetPosition(Urho3D::Vector3(0.0f, 0.0f, 0.0f));
	//node->SetRotation(Urho3D::Quaternion(0.0f, 0.f, 0.0f));
	//node->CreateComponent<Urho3D::Rocket::RocketDocument2D>();

	// Left
	
	node = helloScene_->CreateChild();
	node->SetPosition(Urho3D::Vector3(0.0f, 0.0f, 250.0f));
	// This will orient the node to "billboard" the document
	node->SetWorldRotation(camera->GetFaceCameraRotation(node->GetPosition(), node->GetRotation(), Urho3D::FC_ROTATE_XYZ));
	//node->SetRotation(Urho3D::Quaternion(30.0f, -60.f, 0.0f));
	node->CreateComponent<Urho3D::Rocket::RocketDocument2D>();


	Urho3D::Node* zoneNode = helloScene_->CreateChild("Zone");
	Urho3D::Zone* zone = zoneNode->CreateComponent<Urho3D::Zone>();
	zone->SetBoundingBox(Urho3D::BoundingBox(-10000.0f, 10000.0f));
	zone->SetAmbientColor(Urho3D::Color(0.35f, 0.35f, 0.25f));
	zone->SetFogColor(Urho3D::Color(0.5f, 0.6f, 0.7f));
	zone->SetFogStart(100.0f);
//	zone->SetFogEnd(300.0f);
	zone->SetFogEnd(3000.0f);

	//node->LookAt(cameraNode->GetPosition());
	//Right
	//node = helloScene_->CreateChild();
	//node->SetPosition(Urho3D::Vector3(100.0f, 0.0f, 0.0f));
	//node->SetRotation(Urho3D::Quaternion(0.0f, 45.f, 0.0f));
	//node->CreateComponent<Urho3D::Rocket::RocketDocument3D>();

	//graphics->SetDefaultTextureFilterMode(Urho3D::FILTER_ANISOTROPIC);
}