コード例 #1
0
ファイル: UI.cpp プロジェクト: abandonrules/AtomicGameEngine
void UI::ToggleConsole()
{
    Console* console = GetSubsystem<Console>();

    if (!console)
        return;

    console->Toggle();
    consoleVisible_ = console->IsVisible();
}
コード例 #2
0
ファイル: GameMain.cpp プロジェクト: nonconforme/FH
void GameMain::HandleKeyDown(StringHash eventType, VariantMap& eventData)
{
	using namespace KeyDown;
	int key = eventData[P_KEY].GetInt();
	Input* input_ = GetSubsystem<Input>();
	UI* ui = GetSubsystem<UI>();
	UIElement* root = ui->GetRoot();


	if (key == KEY_ESC)
	{
		menu.isActive = !menu.isActive;

		Vector<SharedPtr<UIElement>> elements = root->GetChildren();
		
		for (unsigned int i = 0; i < elements.Size(); i++) 
		{
			if (elements[i]->GetVar("MENU").GetInt() == 1)
				elements[i]->SetVisible(menu.isActive);
		}
		
		input_->SetMouseVisible(menu.isActive);		
	}
	else if (key == KEY_F1) 
	{
		Console* console = GetSubsystem<Console>();
		console->Toggle();
	}

	if (key == KEY_F2) drawDebug_ = !drawDebug_;

	if (key == KEY_F3) GetSubsystem<DebugHud>()->ToggleAll();

	if (key == KEY_F) 
	{
		static bool flee = false;
		world.flyingShips.shipScript_->SetFlee(flee);
		flee = !flee;
	}

	if (key == KEY_G) 
	{

	}



}
コード例 #3
0
void UrhoQuickStart::HandleKeyDown(StringHash eventType, VariantMap& eventData)
{
	using namespace KeyDown;
	int key = eventData[P_KEY].GetInt();
	
	if (key == KEY_ESC)
	{
		Console* console = GetSubsystem<Console>();
		if (console->IsVisible())
			console->SetVisible(false);
		else

			engine_->Exit();
	}
	else if (key == KEY_F1) 
	{
		Console* console = GetSubsystem<Console>();
		console->Toggle();
	}

	if (key == KEY_F2) drawDebug_ = !drawDebug_;

	if (key == KEY_E) 
	{
		Vector3 hitPos;
		Drawable* hitDrawable;
		NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();

		if (Raycast(250.0f, hitPos, hitDrawable)) 
		{
			Vector3 pathPos = navMesh->FindNearestPoint(hitPos, Vector3(2.0f, 2.0f, 2.0f));
			
			botScript_->AddPath(botNode_->GetWorldPosition(), pathPos);
			
		}
	}
}