Пример #1
0
void
RoomBase::ToggleGUI()
{
	if (IsGUIShown())
		HideGUI();
	else
		ShowGUI();
}
Пример #2
0
Файл: VoxGUI.cpp Проект: rzh/Vox
void VoxGame::SetupGUI()
{
	m_pDeferredCheckBox->SetToggled(m_pVoxSettings->m_deferredRendering);
	m_pShadowsCheckBox->SetToggled(m_pVoxSettings->m_shadows);
	m_pSSAOCheckBox->SetToggled(m_pVoxSettings->m_ssao);
	m_pBlurCheckBox->SetToggled(m_pVoxSettings->m_blur);
	m_pDynamicLightingCheckBox->SetToggled(m_pVoxSettings->m_dynamicLighting);
	m_pMSAACheckBox->SetToggled(m_pVoxSettings->m_msaa);
	m_pInstanceRenderCheckBox->SetToggled(m_pVoxSettings->m_instancedParticles);
	m_pWireframeCheckBox->SetToggled(m_pVoxSettings->m_wireframeRendering);
	m_pDebugRenderCheckBox->SetToggled(m_pVoxSettings->m_debugRendering);
	m_pFaceMergingCheckbox->SetToggled(m_pVoxSettings->m_faceMerging);
	m_pStepUpdateCheckbox->SetToggled(m_pVoxSettings->m_stepUpdating);

	// Debug GUI
	if(m_pVoxSettings->m_showDebugGUI)
	{
		ShowGUI();
	}
	else
	{
		HideGUI();
	}

	// Game mode
	if (strcmp(m_pVoxSettings->m_gameMode.c_str(), "Debug") == 0)
	{
		m_pDebugOptionBox->SetToggled(true);
	}
	else if (strcmp(m_pVoxSettings->m_gameMode.c_str(), "Game") == 0)
	{
		m_previousCameraMode = CameraMode_MouseRotate;
		m_pGameOptionBox->SetToggled(true);
		m_pMouseRotateCameraOptionBox->SetToggled(true);

		// Supress exporting of files, since we are loading into a DEBUG configuration direct from bootstrap
		m_pInventoryManager->SetSupressExport(true);
		m_pActionBar->SetSupressExport(true);
		m_pPlayer->SetSupressStatsExport(true);
		// Load default inventory since we are loading directly into the game
		m_pInventoryManager->LoadInventory("", PlayerClass_Debug, false);
	}
	else if (strcmp(m_pVoxSettings->m_gameMode.c_str(), "FrontEnd") == 0)
	{
		m_pFrontEndOptionBox->SetToggled(true);
		m_pFrontendCameraOptionBox->SetToggled(true);
	}
	m_pVoxWindow->Update(m_deltaTime);
	GameModeChanged();
	CameraModeChanged();
}
Пример #3
0
/***********************************************************
update gui with info from server
***********************************************************/
void ContainerBoxHandler::Update(Ice::Long clientid, const LbaNet::GuiUpdateBasePtr &Update)
{
	LbaNet::GuiUpdateBase * ptr = Update.get();
	const std::type_info& info = typeid(*ptr);

	// LbaNet::UpdateInvContainer
	if(info == typeid(LbaNet::UpdateInvContainer))
	{
		LbaNet::UpdateInvContainer * castedptr = 
			dynamic_cast<LbaNet::UpdateInvContainer *>(ptr);

		UpdateContainer((long)clientid, castedptr->Taken, castedptr->Put);

		HideGUI(clientid);
	}
}
Пример #4
0
/***********************************************************
update gui with info from server
***********************************************************/
void ShopBoxHandler::Update(Ice::Long clientid, const LbaNet::GuiUpdateBasePtr &Update)
{
	LbaNet::GuiUpdateBase * ptr = Update.get();
	const std::type_info& info = typeid(*ptr);

	// LbaNet::BuyItemUpdate
	if(info == typeid(LbaNet::BuyItemUpdate))
	{
		LbaNet::BuyItemUpdate * castedptr =
			dynamic_cast<LbaNet::BuyItemUpdate *>(ptr);

		BuyItem((long)clientid, (long)castedptr->ItemId);
	}

	// LbaNet::GuiClosedUpdate
	if(info == typeid(LbaNet::GuiClosedUpdate))
	{
		HideGUI(clientid);
	}
}
Пример #5
0
/***********************************************************
show the GUI for a certain player
***********************************************************/
void ShopBoxHandler::ShowGUI(Ice::Long clientid, const LbaNet::PlayerPosition &curPosition,
					boost::shared_ptr<ShowGuiParamBase> params)
{
	ShowGuiParamBase * ptr = params.get();
	ShopParam * castedptr =
		static_cast<ShopParam *>(params.get());


	if(HasOpenedGui(clientid))
	{
		//close already opened box
		HideGUI(clientid);
	}
	else
	{
		if(_owner)
		{
			EventsSeq toplayer;
			GuiParamsSeq seq;
			seq.push_back(new ShopGuiParameter(castedptr->_shopinventory,
														castedptr->_currencyitem.IconName));
			toplayer.push_back(new RefreshGameGUIEvent(SynchronizedTimeHandler::GetCurrentTimeDouble(),
													"ShopBox", seq, true, false));

			toplayer.push_back(UpdateMoney((long)castedptr->_currencyitem.Id, (long)clientid));

			_owner->SendEvents((long)clientid, toplayer);
		}


		// add gui to the list to be removed later
		AddOpenedGui(clientid, curPosition);

		// store container info
		_openedshops[(long)clientid] = *castedptr;
	}

}
Пример #6
0
/***********************************************************
show the GUI for a certain player
***********************************************************/
void ContainerBoxHandler::ShowGUI(Ice::Long clientid, const LbaNet::PlayerPosition &curPosition,
					boost::shared_ptr<ShowGuiParamBase> params)
{
	ShowGuiParamBase * ptr = params.get();
	ContainerParam * castedptr = 
		static_cast<ContainerParam *>(params.get());

	if(HasOpenedGui(clientid))
	{
		//close already opened box
		HideGUI(clientid);
	}
	else
	{
		if(_owner)
		{
			EventsSeq toplayer;
			GuiParamsSeq seq;
			seq.push_back(new ContainerGuiParameter(castedptr->_InventorySize,
														castedptr->_sharedinfo->ContainerItems,
														castedptr->_inventory));
			toplayer.push_back(new RefreshGameGUIEvent(SynchronizedTimeHandler::GetCurrentTimeDouble(), 
													"ContainerBox", seq, true, false));

			_owner->SendEvents((long)clientid, toplayer);
		}


		// add gui to the list to be removed later
		AddOpenedGui(clientid, curPosition);

		// store container info
		_openedcontainers[(long)clientid] = castedptr->_sharedinfo;
	}

}
Пример #7
0
void VoxGame::KeyReleased(int key, int scancode, int mods)
{
	m_pGUI->KeyReleased(key, mods);

	if (m_pGUI->IsKeyboardInteractingWithGUIComponent() && key != GLFW_KEY_ESCAPE)
	{
		return;  // For textbox entry
	}

	switch (key)
	{
		// Player movement
		case GLFW_KEY_W:
		{
			m_bKeyboardForward = false;
			break;
		}
		case GLFW_KEY_S:
		{
			m_bKeyboardBackward = false;
			break;
		}
		case GLFW_KEY_A:
		{
			m_bKeyboardLeft = false;
			m_bKeyboardStrafeLeft = false;
			break;
		}
		case GLFW_KEY_D:
		{
			m_bKeyboardRight = false;
			m_bKeyboardStrafeRight = false;
			break;
		}
		case GLFW_KEY_F:
		{
			m_bKeyboardUp = false;
			break;
		}
		case GLFW_KEY_V:
		{
			m_bKeyboardDown = false;
			break;
		}
		case GLFW_KEY_SPACE:
		{
			m_bKeyboardSpace = false;
			break;
		}
		case GLFW_KEY_ESCAPE:
		{
			m_bKeyboardMenu = false;
			break;
		}
		case GLFW_KEY_O:
		{
			if (STEAM_BUILD == false)
			{
				m_pDebugCameraOptionBox->SetToggled(true);
				CameraModeChanged();
			}
			break;
		}
		case GLFW_KEY_L:
		{
			if (STEAM_BUILD == false)
			{
				SetPaused(!IsPaused());
			}
			break;
		}
		case GLFW_KEY_P:
		{
			if (STEAM_BUILD == false)
			{
				if (m_pGUI->IsKeyboardInteractingWithGUIComponent() == false)
				{
					if (m_pMainWindow->IsVisible() == false)
					{
						ShowGUI();
					}
					else
					{
						HideGUI();
					}
				}
			}
			break;
		}

		// Game GUI
		case GLFW_KEY_I:
		{
			if (GetGameMode() == GameMode_Game)
			{
				if (m_pPlayer->IsDead() == false)
				{
					if (m_pInventoryGUI->IsLoaded())
					{
						m_pInventoryGUI->Unload();

						if (VoxGame::GetInstance()->IsGUIWindowStillDisplayed() == false)
						{
							TurnCursorOff(false);
						}
					}
					else if (m_pFrontendManager->GetFrontendScreen() == FrontendScreen_None)
					{
						m_pInventoryGUI->Load();

						m_pPlayer->StopMoving();

						TurnCursorOn(false, false);
					}
				}
			}
			break;
		}
		case GLFW_KEY_C:
		{
			if (GetGameMode() == GameMode_Game)
			{
				if (m_pPlayer->IsDead() == false)
				{
					if (m_pCharacterGUI->IsLoaded())
					{
						m_pCharacterGUI->Unload();

						if (VoxGame::GetInstance()->IsGUIWindowStillDisplayed() == false)
						{
							TurnCursorOff(false);
						}
					}
					else if (m_pFrontendManager->GetFrontendScreen() == FrontendScreen_None)
					{
						m_pCharacterGUI->Load();

						m_pPlayer->StopMoving();

						TurnCursorOn(false, false);
					}
				}
			}
			break;
		}
		case GLFW_KEY_K:
		{
			if (GetGameMode() == GameMode_Game)
			{
				if (m_pPlayer->IsDead() == false)
				{
					if (m_pQuestGUI->IsLoaded())
					{
						m_pQuestGUI->Unload();

						if (VoxGame::GetInstance()->IsGUIWindowStillDisplayed() == false)
						{
							TurnCursorOff(false);
						}
					}
					else if (m_pFrontendManager->GetFrontendScreen() == FrontendScreen_None)
					{
						m_pQuestGUI->Load();

						m_pPlayer->StopMoving();

						TurnCursorOn(false, false);
					}
				}
			}
			break;
		}

		// Number keys
		case GLFW_KEY_1:
		{
			m_pActionBar->UseActionBarslot(0);
			break;
		}		
		case GLFW_KEY_2:
		{
			m_pActionBar->UseActionBarslot(1);
			break;
		}
		case GLFW_KEY_3:
		{
			m_pActionBar->UseActionBarslot(2);
			break;
		}
		case GLFW_KEY_4:
		{
			m_pActionBar->UseActionBarslot(3);
			break;
		}
		case GLFW_KEY_5:
		{
			m_pActionBar->UseActionBarslot(4);
			break;
		}
		case GLFW_KEY_6:
		{
			m_pActionBar->UseActionBarslot(5);
			break;
		}
		case GLFW_KEY_7:
		{
			m_pActionBar->UseActionBarslot(6);
			break;
		}
		case GLFW_KEY_8:
		{
			m_pActionBar->UseActionBarslot(7);
			break;
		}
		case GLFW_KEY_9:
		{
			m_pActionBar->UseActionBarslot(8);
			break;
		}
		case GLFW_KEY_0:
		{
			m_pActionBar->UseActionBarslot(9);
			break;
		}
	}
}