void UpDownCamera::SetArrowControlPosition(int x, int y, int areaSize)
{
#if defined(_VISION_WIIU)
  float fXScale = ((float)Vision::Video.GetXRes() / (float)Vision::Video.GetVideoConfig()->uiDRCRenderWidth);
  float fYScale = ((float)Vision::Video.GetYRes() / (float)Vision::Video.GetVideoConfig()->uiDRCRenderHeight);
  m_spArrows->SetPos((float)x * fXScale, (float)y * fYScale);
  m_spArrows->SetTargetSize((float)areaSize * fXScale, (float)areaSize * fXScale);
#else
  m_spArrows->SetPos((float)x, (float)y);
  m_spArrows->SetTargetSize((float)areaSize, (float)areaSize);
#endif

  int btnSize = areaSize>>2;
 
  GetInputMap()->UnmapInput(VFreeCamera::CONTROL_MOVE_FORWARD);
  GetInputMap()->UnmapInput(VFreeCamera::CONTROL_MOVE_BACKWARD);
  GetInputMap()->UnmapInput(VFreeCamera::CONTROL_MOVE_LEFT);
  GetInputMap()->UnmapInput(VFreeCamera::CONTROL_MOVE_RIGHT);

  VTouchArea* pForwardArea = new VTouchArea(*m_pMultiTouchInput, VRectanglef((float)(x + btnSize), (float)y, (float)(x + 2*btnSize), (float)(y + btnSize)), -900.0f);
  VTouchArea* pBackwardArea = new VTouchArea(*m_pMultiTouchInput, VRectanglef((float)(x + btnSize), (float)(y + 2*btnSize), (float)(x + 2*btnSize), (float)(y + 3*btnSize)), -900.0f);
  VTouchArea* pLeftArea = new VTouchArea(*m_pMultiTouchInput, VRectanglef((float)x, (float)(y + btnSize), (float)(x + btnSize), (float)(y + 2*btnSize)), -900.0f);
  VTouchArea* pRightArea = new VTouchArea(*m_pMultiTouchInput, VRectanglef((float)(x + 2*btnSize), (float)(y + btnSize), (float)(x + 3*btnSize), (float)(y + 2*btnSize)), -900.0f);

  GetInputMap()->MapTrigger(VFreeCamera::CONTROL_MOVE_FORWARD, pForwardArea, CT_TOUCH_ANY);
  GetInputMap()->MapTrigger(VFreeCamera::CONTROL_MOVE_BACKWARD, pBackwardArea, CT_TOUCH_ANY);
  GetInputMap()->MapTrigger(VFreeCamera::CONTROL_MOVE_LEFT, pLeftArea, CT_TOUCH_ANY);
  GetInputMap()->MapTrigger(VFreeCamera::CONTROL_MOVE_RIGHT, pRightArea, CT_TOUCH_ANY);
}
void MenuController::AndroidMenu(VInputMap* inputMap){
	char* texturePaths[4]= {"\\Textures\\gravroom.png","\\Textures\\tod.png","\\Textures\\pr.png","\\Textures\\tumb.png"}; 
	int x = Vision::Video.GetXRes();
	int y = Vision::Video.GetYRes();
	
	//AddButton("\\GravityRoomGUI\\button.tga", width*.8, height/2-75, width, height/2+75);
	
		int pos =  y * 0/6 + y/20;
		VTouchArea* area = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef( 0, pos, x/2.0, pos+75), -900.0f);
		inputMap->MapTrigger(GR, area, CT_TOUCH_ANY, VInputOptions::Once());
		this->AddButton("\\Textures\\gravroom.png", 0, pos, 0, 0);
		pos =  y * 1/6 + y/20;
		VTouchArea* area2 = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef( 0, pos, x/2.0, pos+75), -900.0f);
		inputMap->MapTrigger(TOD, area2, CT_TOUCH_ANY, VInputOptions::Once());
		this->AddButton("\\Textures\\tod.png", 0, pos, 0, 0);
		pos =  y * 2/6 + y/20;
		VTouchArea* area3 = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef( 0, pos, x/2.0, pos+75), -900.0f);
		inputMap->MapTrigger(PR, area3, CT_TOUCH_ANY, VInputOptions::Once());
		this->AddButton("\\Textures\\pr.png", 0, pos, 0, 0);
		pos =  y * 3/6 + y/20;
		VTouchArea* area4 = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef( 0, pos, x/2.0, pos+75), -900.0f);
		inputMap->MapTrigger(TUM, area4, CT_TOUCH_ANY, VInputOptions::Once());
		this->AddButton("\\Textures\\tumb.png", 0, pos, 0, 0);
	
}
void WaterSimulationController::MapTriggers(VInputMap* inputMap){
#if defined(WIN32)
	inputMap->MapTrigger(CUSTOM_CONTROL_ONE, V_KEYBOARD, VInputControl::CT_KB_UP, VInputOptions::Once()); 
	inputMap->MapTrigger(CUSTOM_CONTROL_TWO, V_KEYBOARD, VInputControl::CT_KB_DOWN, VInputOptions::Once()); 
#endif

#if defined(_VISION_ANDROID)
	int width = Vision::Video.GetXRes();
	int height = Vision::Video.GetYRes();
	VTouchArea* addRagdollArea = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef((float)width *.8f, (float)height * 0 , (float)width , (float)height * .2f), -900.0f);
	inputMap->MapTrigger(CUSTOM_CONTROL_ONE, addRagdollArea, CT_TOUCH_ANY);

	VTouchArea* addCubeArea = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef(0.0f, (float)height*.8f, (float)width*.2f, (float)height), -900.0f);
	inputMap->MapTrigger(CUSTOM_CONTROL_TWO, addCubeArea, CT_TOUCH_ANY);
#endif 
}
void VFreeCamera::CreateVirtualThumbStick()
{
  if (m_pVirtualThumbStick != NULL)
    return;

  VASSERT_MSG(m_pInputMap != NULL, "Make sure to initialize the free camera before creating the virtual thumb stick.");

  // Virtual Thumb Stick
  m_pVirtualThumbStick = new VVirtualThumbStick();
  Vision::Callbacks.OnVideoChanged += this; // update valid area when resolution changes

  m_pInputMap->MapTrigger(CONTROL_MOVE_LEFT, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_LEFT, VInputOptions::DeadZone(0.2f));
  m_pInputMap->MapTrigger(CONTROL_MOVE_RIGHT, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.2f));
  m_pInputMap->MapTrigger(CONTROL_MOVE_FORWARD, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_UP, VInputOptions::DeadZone(0.2f));
  m_pInputMap->MapTrigger(CONTROL_MOVE_BACKWARD, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_DOWN, VInputOptions::DeadZone(0.2f));

  // Look Touch Area
  VASSERT(m_spLookTouchArea == NULL);
  m_spLookTouchArea = new VTouchArea(VInputManager::GetTouchScreen(), VRectanglef(), -2000.0f);
  m_pInputMap->MapTrigger(CONTROL_HORIZONTAL_LOOK, m_spLookTouchArea, CT_TOUCH_ABS_DELTA_X, VInputOptions::Sensitivity(0.25f / Vision::Video.GetDeviceDpi()));
  m_pInputMap->MapTrigger(CONTROL_VERTICAL_LOOK,   m_spLookTouchArea, CT_TOUCH_ABS_DELTA_Y, VInputOptions::Sensitivity(0.25f / Vision::Video.GetDeviceDpi()));

  m_pInputMap->MapTrigger(CONTROL_TAP_X, m_spLookTouchArea, CT_TOUCH_TAP_X);
  m_pInputMap->MapTrigger(CONTROL_TAP_Y, m_spLookTouchArea, CT_TOUCH_TAP_Y);
}
void ParticleRainController::MapTriggers(VInputMap* inputMap){
#if defined(WIN32)
	inputMap->MapTrigger(CUSTOM_CONTROL_ONE, V_KEYBOARD, VInputControl::CT_KB_UP, VInputOptions::Once());
	inputMap->MapTrigger(CUSTOM_CONTROL_TWO, V_KEYBOARD, VInputControl::CT_KB_DOWN, VInputOptions::Once());

#endif

#if defined(_VISION_ANDROID)
	int width = Vision::Video.GetXRes();
	int height = Vision::Video.GetYRes();
	
	VTouchArea* addBallsArea = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef(0.0f, (float)height * 0.5f, (float)width, (float)height), -900.0f);
	inputMap->MapTrigger(CUSTOM_CONTROL_ONE, addBallsArea, CT_TOUCH_ANY);
	VTouchArea* toggleCamera = new VTouchArea(VInputManager::GetTouchScreen(),VRectanglef(0.0f, 0.0f, (float)width, (float)height * 0.5f), -900.0f);
	inputMap->MapTrigger(CUSTOM_CONTROL_TWO, toggleCamera, CT_TOUCH_ANY);

#endif
}
void SaveGameSlot_cl::OnInitOneTime(int iSlotIndex)
{
  m_iSlotIndex = iSlotIndex;
  char pszSlotFile[64];
  sprintf(pszSlotFile, SAVESLOT_FILE, m_iSlotIndex + 1);

#if defined( _VISION_MOBILE )
  // Arrange in two columns, if the screen is too small
  bool bTwoColumns = Vision::Video.GetYRes() < 520;
  int iRows = bTwoColumns ? 2 : 4;

  float fPosX = Vision::Video.GetXRes() - 132.0f;
  if (bTwoColumns && (iSlotIndex < iRows))
    fPosX -= 132.0f;
  float fThumbnailPosY = 8.0f + ((m_iSlotIndex % iRows) * 128.0f);
  float fSlotPosY = fThumbnailPosY + 56.0f;

  VTouchArea* pSlotArea = new VTouchArea( VInputManager::GetTouchScreen(), 
    VRectanglef( fPosX, fThumbnailPosY, fPosX + 128.0f, fThumbnailPosY + 96.0f ), 
    0.0f );

  VAppImpl::GetInputMap()->MapTrigger( SERIALIZE_SLOT_1 + m_iSlotIndex, pSlotArea, CT_TOUCH_ANY, VInputOptions::Once() );
#else
  float fPosX = 8.0f + m_iSlotIndex * 132.0f;
  float fThumbnailPosY = Vision::Video.GetYRes() - 112.0f;
  float fSlotPosY = fThumbnailPosY + 56.0f;
#endif

  // screenmask for the slot number
  m_spSlotNumMask = new VisScreenMask_cl(pszSlotFile);
  m_spSlotNumMask->SetPos( fPosX, fSlotPosY );
  m_spSlotNumMask->SetTransparency(VIS_TRANSP_ALPHA);
  m_spSlotNumMask->SetColor(s_iOverlayColor);
  m_spSlotNumMask->SetOrder(100);
  m_spSlotNumMask->SetVisible(FALSE);

  // screenmask for either "No Preview" or "Free"
  m_spBackgroundMask = new VisScreenMask_cl("Serialization\\NoPreview.dds");
  m_spBackgroundMask->SetPos( fPosX, fThumbnailPosY );
  m_spBackgroundMask->SetTargetSize(128.f,96.f);
  m_spBackgroundMask->SetTransparency(VIS_TRANSP_ALPHA);
  m_spBackgroundMask->SetColor(s_iOverlayColor);
  m_spBackgroundMask->SetOrder(110);
  m_spBackgroundMask->SetVisible(FALSE);

  // screenmask for the level preview screenshot
  m_spPreviewMask = new VisScreenMask_cl();
  m_spPreviewMask->SetPos( fPosX, fThumbnailPosY );
  m_spPreviewMask->SetTargetSize(128.f,96.f);
  m_spPreviewMask->SetTransparency(VIS_TRANSP_ALPHA);
  m_spPreviewMask->SetColor(s_iOverlayColor);
  m_spPreviewMask->SetOrder(110);
  m_spPreviewMask->SetVisible(FALSE);
}
void RPG_GuiManager_VisionGUI::AddMinimapToParentDialog()
{
  InitializeMinimapDefinitions();

  const RPG_LevelInfo* levelInfo = RPG_GameManager::s_instance.GetLevelInfo();
  if (levelInfo)
  {
    // add minimap
    VASSERT(m_minimapTexture && m_minimapFrameTexture && m_minimapMaskTexture);
    {
      // Add minimap
      VASSERT(!m_minimap);
      m_minimap = new RPG_GuiMinimap_VisionGUI();
      VASSERT(m_minimap);

      m_minimap->SetMaskTexture(m_minimapMaskTexture);
      m_minimap->SetFadeColor(hkvVec4(1.f, 1.f, 1.f, 1.f));
      m_minimap->SetTransform(hkvVec4(m_minimapZoomFactor, m_minimapZoomFactor, 0.f, 0.f));
      m_minimap->Image().SetTexture(m_minimapTexture);
      m_minimap->Image().SetTransparency(VIS_TRANSP_ALPHA);
      m_minimap->SetPosition(m_minimapPosition.x, m_minimapPosition.y);
      m_minimap->SetSize(m_minimapSize.x, m_minimapSize.y);
      m_minimap->SetVisible(true);     
      m_parentDialog->AddControl(m_minimap);
      m_minimap->OnActivate();

      // Add minimap frame
      VASSERT(!m_minimapFrame);
      m_minimapFrame = new VImageControl();
      VASSERT(m_minimapFrame);

      m_minimapFrame->Image().SetTexture(m_minimapFrameTexture);
      m_minimapFrame->Image().SetTransparency(VIS_TRANSP_ALPHA);
      m_minimapFrame->SetPosition(m_minimapPosition.x, m_minimapPosition.y);
      m_minimapFrame->SetSize(m_minimapSize.x, m_minimapSize.y);
      m_minimapFrame->SetVisible(true);
      m_parentDialog->AddControl(m_minimapFrame);

      // Add minimap player icon
      VASSERT(!m_minimapPlayer);
      m_minimapPlayer = new VImageControl();
      VASSERT(m_minimapPlayer);

      m_minimapPlayer->Image().SetTexture(m_minimapPlayerTexture);
      m_minimapPlayer->Image().SetTransparency(VIS_TRANSP_ALPHA);
      m_minimapPlayer->Image().SetTextureRange(VRectanglef(-0.5f,-0.5f, 0.5f, 0.5f)); 
      m_minimapPlayer->SetPosition(m_minimapPosition.x + m_minimapSize.x / 2.f - 16.f, m_minimapPosition.y + m_minimapSize.y / 2.f - 16.f);
      m_minimapPlayer->SetSize(32.f, 32.f);
      m_minimapPlayer->SetVisible(true);
      m_parentDialog->AddControl(m_minimapPlayer);
    }
  }
}
Beispiel #8
0
  // called one time after Vision initialisation. Screenmasks are created here
  // Since we have a reference to them, they will survive a LoadWorld
  void OnInitOneTime(int iSlotIndex)
  {
    m_iSlotIndex = iSlotIndex;
    char pszSlotFile[64];
    sprintf(pszSlotFile, SAVESLOT_FILE, m_iSlotIndex + 1);

#if defined( _VISION_MOBILE )
    float fPosX = Vision::Video.GetXRes() - 132.0f;
    float fThumbnailPosY = 8.0f + m_iSlotIndex * 128.0f;
    float fSlotPosY = fThumbnailPosY + 56.0f;

    VTouchArea* pSlotArea = new VTouchArea( VInputManager::GetTouchScreen(), 
      VRectanglef( fPosX, fThumbnailPosY, fPosX + 128.0f, fThumbnailPosY + 96.0f ), 
      0.0f );

    VisSampleApp::GetInputMap()->MapTrigger( SERIALIZE_SLOT_1 + m_iSlotIndex, pSlotArea, CT_TOUCH_ANY, VInputOptions::Once() );
#else
    float fPosX = 8.0f + m_iSlotIndex * 132.0f;
    float fThumbnailPosY = Vision::Video.GetYRes() - 112.0f;
    float fSlotPosY = fThumbnailPosY + 56.0f;
#endif

    // screenmask for the slot number
    m_spSlotNumMask = new VisScreenMask_cl(pszSlotFile, TEXTURE_LOADING_FLAGS);
    m_spSlotNumMask->SetPos( fPosX, fSlotPosY );
    m_spSlotNumMask->SetTransparency(VIS_TRANSP_ALPHA);
    m_spSlotNumMask->SetColor(g_iOverlayColor);
    m_spSlotNumMask->SetOrder(100);
    m_spSlotNumMask->SetVisible(FALSE);
  
    // screenmask for either "No Preview" or "Free"
    m_spBackgroundMask = new VisScreenMask_cl("Serialization\\NoPreview.dds", TEXTURE_LOADING_FLAGS);
    m_spBackgroundMask->SetPos( fPosX, fThumbnailPosY );
    m_spBackgroundMask->SetTargetSize(128.f,96.f);
    m_spBackgroundMask->SetTransparency(VIS_TRANSP_ALPHA);
    m_spBackgroundMask->SetColor(g_iOverlayColor);
    m_spBackgroundMask->SetOrder(110);
    m_spBackgroundMask->SetVisible(FALSE);

    // screenmask for the level preview screenshot
    m_spPreviewMask = new VisScreenMask_cl();
    m_spPreviewMask->SetPos( fPosX, fThumbnailPosY );
    m_spPreviewMask->SetTargetSize(128.f,96.f);
    m_spPreviewMask->SetTransparency(VIS_TRANSP_ALPHA);
    m_spPreviewMask->SetColor(g_iOverlayColor);
    m_spPreviewMask->SetOrder(110);
    m_spPreviewMask->SetVisible(FALSE);
  }
void VSampleTouchButton::RecalculatePosition(VInputMap& InputMap)
{
    m_fPosX = m_pFather->GetPosX() + m_fRelPosX;
    m_fPosY = m_pFather->GetPosY() + m_fRelPosY;
    
    if(m_spActiveScreenMask)
    {
        m_spActiveScreenMask->SetPos(m_fPosX,m_fPosY);
    }
          
    m_spTouchArea = new VTouchArea(VInputManager::GetTouchScreen(), VRectanglef(m_fPosX, m_fPosY, m_fPosX + m_fWidth, m_fPosY + m_fHeight), 1000.0f);
 
    if(m_bSingleHit)
      m_iAlternative = InputMap.MapTrigger(m_iControlIndex, m_spTouchArea, CT_TOUCH_ANY, VInputOptions::OncePerFrame(ONCE_ON_PRESS, m_iAlternative));
    else
      m_iAlternative = InputMap.MapTrigger(m_iControlIndex, m_spTouchArea, CT_TOUCH_ANY, VInputOptions::Alternative(m_iAlternative, false));
}
void VFreeCamera::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
  // Input is processed once per frame, not once per simulation tick.
  if (pData->m_pSender == &Vision::Callbacks.OnFrameUpdatePreRender)
  {    
    VASSERT(GetThinkFunctionStatus() == TRUE);
    const float fTimeDiff = Vision::GetUITimer()->GetTimeDifference();
    ProcessInput(fTimeDiff);
  }
  else if (pData->m_pSender == &Vision::Callbacks.OnVideoChanged)
  {
#if defined(SUPPORTS_MULTITOUCH)
    // Re-initialize valid area
    if (m_pVirtualThumbStick != NULL)
      m_pVirtualThumbStick->SetValidArea(VRectanglef());
#endif
  }
}
void PlayerUIDialog::InitInputMap()
{
#ifdef SUPPORTS_MOUSE
  m_inputMap->MapTrigger(PI_PrimaryAction, V_MOUSE, CT_MOUSE_LEFT_BUTTON);
  m_inputMap->MapTrigger(PI_SecondaryAction, V_MOUSE, CT_MOUSE_RIGHT_BUTTON);
  m_inputMap->MapTrigger(PI_SpecialAction01, V_MOUSE, CT_MOUSE_MIDDLE_BUTTON);
#endif

#ifdef SUPPORTS_KEYBOARD
  // player actions
  m_inputMap->MapTrigger(PI_ShiftModifier, V_KEYBOARD, CT_KB_LSHIFT);
  m_inputMap->MapTrigger(PI_SecondaryShiftModifier, V_KEYBOARD, CT_KB_RSHIFT);
  m_inputMap->MapTrigger(PI_SpecialAction01, V_KEYBOARD, CT_KB_1, VInputOptions::Once());

  // gui
  m_inputMap->MapTrigger(PI_ToggleTestPattern, V_KEYBOARD, CT_KB_S, VInputOptions::Once());
  m_inputMap->MapTrigger(PI_ToggleCharacterDialog, V_KEYBOARD, CT_KB_C, VInputOptions::Once());
  m_inputMap->MapTrigger(PI_ToggleInventoryDialog, V_KEYBOARD, CT_KB_I, VInputOptions::Once());
  m_inputMap->MapTrigger(PI_ToggleMinimap, V_KEYBOARD, CT_KB_M, VInputOptions::Once());
  m_inputMap->MapTrigger(PI_ToggleHud, V_KEYBOARD, CT_KB_H, VInputOptions::Once());

  // testing
  m_inputMap->MapTrigger(PI_TestEffect, V_KEYBOARD, CT_KB_Z, VInputOptions::Once());
  m_inputMap->MapTrigger(PI_TestCameraShake, V_KEYBOARD, CT_KB_X, VInputOptions::Once());
  
  // cheats
  m_inputMap->MapTrigger(PI_CheatUnlimitedHealth, V_KEYBOARD, CT_KB_Z, VInputOptions::Once());
  m_inputMap->MapTrigger(PI_CheatUnlimitedMana, V_KEYBOARD, CT_KB_X, VInputOptions::Once());
#endif

#if defined(_VISION_MOBILE)
  // vPlayer app menu uses a priority of 2000
  // Explicitly config a lower priority for the touchscreen area
  // Though now the rest of the GUI probably doesn't work!
  float const priority = -950.0f;
  int const width = Vision::Video.GetXRes();
  int const height = Vision::Video.GetYRes();

  VTouchArea *touchScreen = new VTouchArea(VInputManager::GetTouchScreen(), VRectanglef(0.0f, 0.0f, width, height), priority);
  m_inputMap->MapTrigger(PI_PrimaryAction, touchScreen, CT_TOUCH_ANY);
  m_inputMap->MapTrigger(PI_PrimaryActionX, touchScreen, CT_TOUCH_ABS_X);
  m_inputMap->MapTrigger(PI_PrimaryActionY, touchScreen, CT_TOUCH_ABS_Y);
#endif
}
Beispiel #12
0
void VisMouseCamera_cl::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
  if (pData->m_pSender == &Vision::Callbacks.OnFrameUpdatePreRender)
  {
    // this function gets called once per frame, not once per simulation tick

    if (this->GetThinkFunctionStatus()) // take the same flag into account
    {
      float fTimeDiff = Vision::GetUITimer()->GetTimeDifference();
      TickFunction(fTimeDiff);
    }
  }
  else if (pData->m_pSender == &Vision::Callbacks.OnVideoChanged)
  {
#if defined(SUPPORTS_MULTITOUCH)
    // Re-initialize valid area
    if (m_pVirtualThumbStick != NULL)
      m_pVirtualThumbStick->SetValidArea(VRectanglef());
#endif
  }
}
// InitFunction: Reads places file and sets up initial screen masks,
//               including the used fonts.
void WorldLanguages_cl::InitFunction()
{
  // load one global font
  spGlobalFont = Vision::Fonts.LoadFont("\\Fonts\\Arial_22.fnt");

  // initialize miscellaneous variables
  m_pBrace = NULL;
  m_pPlaces = NULL;
  m_pHotSpot = NULL;
  m_iNumPlaces = 0;

  // read places file and set up places array
  ReadPlacesFile();
  
  // set up position data for the first place
  m_iCurrentPlace = Vision::Game.GetRand()%m_iNumPlaces;
  m_iOldPlace = -1;

  // find the earth globe
  m_pTheWorld = Vision::Game.SearchEntity("theWorld");
  
  // set up screen masks
  SetupMasks();
  
  // set up some keys
#ifdef SUPPORTS_KEYBOARD
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_PREV, V_KEYBOARD, CT_KB_BACKSP, VInputOptions::Once());
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_NEXT, V_KEYBOARD, CT_KB_SPACE,  VInputOptions::Once());
#endif

#if defined(SUPPORTS_MULTITOUCH)
  VTouchArea *pTouchArea
#if defined(WIN32) && !defined(_VISION_WINRT)
    = new VTouchArea(VInputManager::GetMultitouch(),  VRectanglef(0,0,(float)Vision::Video.GetXRes(),(float)Vision::Video.GetYRes()));
#else
    = new VTouchArea(VInputManager::GetTouchScreen());
const VRectanglef VLogoOverlay::GetScreenExtents() const
{
  return VRectanglef(0.0f, 0.0f, static_cast<float>(Vision::Video.GetXRes()), static_cast<float>(Vision::Video.GetYRes()));
}
Beispiel #15
0
// ---------------------------------------------------------------------------------
// Method: BaseInit
// Author: Fabian Roeken, Patrick Harms
// Notes: Base initialization code shared between InitFunction and Serialize
// ---------------------------------------------------------------------------------
void VisMouseCamera_cl::BaseInit()
{
  m_pInputMap = new VInputMap(API_CAMERA_CONTROL_LAST_ELEMENT+1+API_CAMERA_CONTROL_USER_SPACE, API_CAMERA_CONTROL_ALTERNATIVES);

#ifdef _VISION_XENON

  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  VInputManagerXenon::GetPad(0), CT_PAD_LEFT_THUMB_STICK_UP,    VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, VInputManagerXenon::GetPad(0), CT_PAD_LEFT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     VInputManagerXenon::GetPad(0), CT_PAD_LEFT_THUMB_STICK_LEFT,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    VInputManagerXenon::GetPad(0), CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.25f));

  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,   VInputManagerXenon::GetPad(0), CT_PAD_ANY_KEY);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,   VInputManagerXenon::GetPad(0), CT_PAD_LEFT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED, VInputManagerXenon::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);

  m_pInputMap->MapTriggerAxis(API_CAMERA_HORIZONTAL_LOOK, VInputManagerXenon::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_LEFT, CT_PAD_RIGHT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.15f, true));
  m_pInputMap->MapTriggerAxis(API_CAMERA_VERTICAL_LOOK,   VInputManagerXenon::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_UP,   CT_PAD_RIGHT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.15f, true));

  m_pInputMap->MapTrigger(API_CAMERA_ACTION_1, VInputManagerXenon::GetPad(0), CT_PAD_LEFT_SHOULDER,  VInputOptions::DeadZone(0.4f));
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_2, VInputManagerXenon::GetPad(0), CT_PAD_RIGHT_SHOULDER, VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_3, VInputManagerXenon::GetPad(0), CT_PAD_RIGHT_THUMB);

#endif

#ifdef _VISION_PS3
  
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  VInputManagerPS3::GetPad(0), CT_PAD_LEFT_THUMB_STICK_UP,    VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, VInputManagerPS3::GetPad(0), CT_PAD_LEFT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     VInputManagerPS3::GetPad(0), CT_PAD_LEFT_THUMB_STICK_LEFT,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    VInputManagerPS3::GetPad(0), CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.25f));

  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerPS3::GetPad(0), CT_PAD_ANY_KEY);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerPS3::GetPad(0), CT_PAD_LEFT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerPS3::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED,  VInputManagerPS3::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);

  m_pInputMap->MapTriggerAxis(API_CAMERA_HORIZONTAL_LOOK, VInputManagerPS3::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_LEFT, CT_PAD_RIGHT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.15f, true));
  m_pInputMap->MapTriggerAxis(API_CAMERA_VERTICAL_LOOK,   VInputManagerPS3::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_UP,   CT_PAD_RIGHT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.15f, true));

  m_pInputMap->MapTrigger(API_CAMERA_ACTION_1, VInputManagerPS3::GetPad(0), CT_PAD_LEFT_SHOULDER,  VInputOptions::DeadZone(0.4f));
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_2, VInputManagerPS3::GetPad(0), CT_PAD_RIGHT_SHOULDER, VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_3, VInputManagerPS3::GetPad(0), CT_PAD_RIGHT_THUMB);

#endif

#ifdef _VISION_PSP2

  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  VInputManagerPSP2::GetPad(0), CT_PAD_LEFT_THUMB_STICK_UP, VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, VInputManagerPSP2::GetPad(0), CT_PAD_LEFT_THUMB_STICK_DOWN, VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     VInputManagerPSP2::GetPad(0), CT_PAD_LEFT_THUMB_STICK_LEFT, VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    VInputManagerPSP2::GetPad(0), CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.25f));

  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerPSP2::GetPad(0), CT_PAD_ANY_KEY);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerPSP2::GetPad(0), CT_PAD_LEFT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerPSP2::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED,  VInputManagerPSP2::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);

  m_pInputMap->MapTriggerAxis(API_CAMERA_HORIZONTAL_LOOK, VInputManagerPSP2::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_LEFT, CT_PAD_RIGHT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.15f, true));
  m_pInputMap->MapTriggerAxis(API_CAMERA_VERTICAL_LOOK,   VInputManagerPSP2::GetPad(0), CT_PAD_RIGHT_THUMB_STICK_UP,   CT_PAD_RIGHT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.15f, true));

  m_pInputMap->MapTrigger(API_CAMERA_ACTION_1,   VInputManagerPSP2::GetPad(0), CT_PAD_LEFT_SHOULDER, VInputOptions::DeadZone(0.4f));
  //m_pInputMap->MapTrigger(API_CAMERA_ACTION_2, VInputManagerPSP2::GetPad(0), CT_PAD_RIGHT_TRIGGER);
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_3,   VInputManagerPSP2::GetPad(0), CT_PAD_RIGHT_SHOULDER, VInputOptions::DeadZone(0.25f));

#endif
  
#if defined(_VISION_MOBILE) || defined(_VISION_WINRT)
  
  VTouchArea* pCameraLookArea = new VTouchArea(VInputManager::GetTouchScreen(), VRectanglef(), -2000.0f);
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED,    pCameraLookArea, CT_TOUCH_ANY);

  m_pInputMap->MapTrigger(API_CAMERA_HORIZONTAL_LOOK, pCameraLookArea, CT_TOUCH_ABS_DELTA_X, VInputOptions::Sensitivity(0.25f / Vision::Video.GetDeviceDpi()));
  m_pInputMap->MapTrigger(API_CAMERA_VERTICAL_LOOK,   pCameraLookArea, CT_TOUCH_ABS_DELTA_Y, VInputOptions::Sensitivity(0.25f / Vision::Video.GetDeviceDpi()));
  
  m_pInputMap->MapTrigger(API_CAMERA_DOUBLE_TAP, pCameraLookArea, CT_TOUCH_DOUBLE_TAP, VInputOptions::OncePerFrame());
  m_pInputMap->MapTrigger(API_CAMERA_TAP_X, pCameraLookArea, CT_TOUCH_TAP_X);
  m_pInputMap->MapTrigger(API_CAMERA_TAP_Y, pCameraLookArea, CT_TOUCH_TAP_Y);
  
#endif

#ifdef SUPPORTS_KEYBOARD

  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  V_KEYBOARD, CT_KB_UP);
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, V_KEYBOARD, CT_KB_DOWN);
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     V_KEYBOARD, CT_KB_LEFT);
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    V_KEYBOARD, CT_KB_RIGHT);

  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    V_KEYBOARD, CT_KB_UNKNOWN);

#endif

#ifdef SUPPORTS_MOUSE
  
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED,  V_MOUSE, CT_MOUSE_DATA_CHANGED);

  m_pInputMap->MapTrigger(API_CAMERA_HORIZONTAL_LOOK, V_MOUSE, CT_MOUSE_ABS_DELTA_X, VInputOptions::Sensitivity(0.15f / Vision::Video.GetDeviceDpi()));
  m_pInputMap->MapTrigger(API_CAMERA_VERTICAL_LOOK,   V_MOUSE, CT_MOUSE_ABS_DELTA_Y, VInputOptions::Sensitivity(0.15f / Vision::Video.GetDeviceDpi()));

  m_pInputMap->MapTrigger(API_CAMERA_ACTION_1, V_MOUSE, CT_MOUSE_LEFT_BUTTON);
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_2, V_MOUSE, CT_MOUSE_RIGHT_BUTTON);
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_3, V_MOUSE, CT_MOUSE_MIDDLE_BUTTON);
#endif

#ifdef _VISION_WIIU

  // DRC mapping
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_LEFT_THUMB_STICK_UP,    VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_LEFT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_LEFT_THUMB_STICK_LEFT,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.25f));

  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_ANY_KEY);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_LEFT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_RIGHT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED,  VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_RIGHT_THUMB_STICK_CHANGED);

  m_pInputMap->MapTriggerAxis(API_CAMERA_HORIZONTAL_LOOK, VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_RIGHT_THUMB_STICK_LEFT, CT_PAD_RIGHT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.15f, true));
  m_pInputMap->MapTriggerAxis(API_CAMERA_VERTICAL_LOOK,   VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_RIGHT_THUMB_STICK_UP,   CT_PAD_RIGHT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.15f, true));

  m_pInputMap->MapTrigger(API_CAMERA_ACTION_2, VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_RIGHT_SHOULDER, VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_3, VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_LEFT_SHOULDER,  VInputOptions::DeadZone(0.4f));

  // Pro controller mapping
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  VInputManagerWiiU::GetRemote(0), CT_PAD_LEFT_THUMB_STICK_UP,    VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, VInputManagerWiiU::GetRemote(0), CT_PAD_LEFT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     VInputManagerWiiU::GetRemote(0), CT_PAD_LEFT_THUMB_STICK_LEFT,  VInputOptions::DeadZone(0.25f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    VInputManagerWiiU::GetRemote(0), CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.25f)); 

  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerWiiU::GetRemote(0), CT_PAD_ANY_KEY);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerWiiU::GetRemote(0), CT_PAD_LEFT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_ANY_ACTION,    VInputManagerWiiU::GetRemote(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);
  m_pInputMap->MapTrigger(API_CAMERA_LOOK_CHANGED,  VInputManagerWiiU::GetRemote(0), CT_PAD_RIGHT_THUMB_STICK_CHANGED);

  m_pInputMap->MapTriggerAxis(API_CAMERA_HORIZONTAL_LOOK, VInputManagerWiiU::GetRemote(0), CT_PAD_RIGHT_THUMB_STICK_LEFT, CT_PAD_RIGHT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.05f, true));
  m_pInputMap->MapTriggerAxis(API_CAMERA_VERTICAL_LOOK,   VInputManagerWiiU::GetRemote(0), CT_PAD_RIGHT_THUMB_STICK_UP,   CT_PAD_RIGHT_THUMB_STICK_DOWN,  VInputOptions::DeadZone(0.05f, true));

  m_pInputMap->MapTrigger(API_CAMERA_ACTION_2, VInputManagerWiiU::GetRemote(0), CT_PAD_RIGHT_SHOULDER, VInputOptions::DeadZone(0.1f));
  m_pInputMap->MapTrigger(API_CAMERA_ACTION_3, VInputManagerWiiU::GetRemote(0), CT_PAD_LEFT_SHOULDER,  VInputOptions::DeadZone(0.2f));

#endif

#if defined(_VISION_ANDROID) 

  // Additional input possibilities for devices with playstation buttons
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD,  VInputManagerAndroid::GetKeyInput(), CT_PAD_UP,    VInputOptions::Alternative(1));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, VInputManagerAndroid::GetKeyInput(), CT_PAD_DOWN,  VInputOptions::Alternative(1));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT,     VInputManagerAndroid::GetKeyInput(), CT_PAD_LEFT,  VInputOptions::Alternative(1));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT,    VInputManagerAndroid::GetKeyInput(), CT_PAD_RIGHT, VInputOptions::Alternative(1));

#endif

#if defined(SUPPORTS_MULTITOUCH) && (defined(_VISION_MOBILE) || defined(_VISION_WINRT))
  VASSERT(m_pVirtualThumbStick == NULL);
  m_pVirtualThumbStick = new VVirtualThumbStick();
  Vision::Callbacks.OnVideoChanged += this; // update valid area when resolution changes

  m_pInputMap->MapTrigger(API_CAMERA_MOVE_LEFT, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_LEFT, VInputOptions::DeadZone(0.2f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_RIGHT, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_RIGHT, VInputOptions::DeadZone(0.2f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_FORWARD, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_UP, VInputOptions::DeadZone(0.2f));
  m_pInputMap->MapTrigger(API_CAMERA_MOVE_BACKWARD, *m_pVirtualThumbStick, CT_PAD_LEFT_THUMB_STICK_DOWN, VInputOptions::DeadZone(0.2f));
#endif

  // attach camera to entity
  Vision::Camera.AttachToEntity(this, hkvVec3::ZeroVector ());
}
Beispiel #16
0
 /// \brief Returns the rectangle around the cursor.
 inline VRectanglef GetCursorRect() const 
 {
   return VRectanglef(m_vHotSpot, m_vSize+m_vHotSpot);
 }
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_PREV, V_XENON_PAD(0), CT_PAD_A, VInputOptions::Once());
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_NEXT, V_XENON_PAD(0), CT_PAD_B, VInputOptions::Once());

#elif defined(_VISION_PS3)
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_PREV, V_PS3_PAD(0), CT_PAD_CROSS, VInputOptions::Once());
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_NEXT, V_PS3_PAD(0), CT_PAD_CIRCLE, VInputOptions::Once());

#elif defined(_VISION_PSP2)
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_PREV, V_PSP2_PAD(0), CT_PAD_CROSS, VInputOptions::Once());
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_NEXT, V_PSP2_PAD(0), CT_PAD_CIRCLE, VInputOptions::Once());

#elif defined(_VISION_MOBILE)
  int width = Vision::Video.GetXRes();
  int height = Vision::Video.GetYRes();
  
  VTouchArea* prevArea = new VTouchArea(VInputManager::GetTouchScreen(), VRectanglef(0, 0, 100, height), -950.0f);
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_PREV, prevArea, CT_TOUCH_ANY, VInputOptions::Once());    
  
  VTouchArea* nextArea = new VTouchArea(VInputManager::GetTouchScreen(), VRectanglef(width - 100, 0, width, height), -950.0f);
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_NEXT, nextArea, CT_TOUCH_ANY, VInputOptions::Once());

#elif defined(_VISION_WIIU)
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_PREV, VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_B, VInputOptions::Once());
  VisSampleApp::GetInputMap()->MapTrigger(WORLD_LANG_NEXT, VInputManagerWiiU::GetDRC(V_DRC_FIRST), CT_PAD_A, VInputOptions::Once());
  
#endif


  m_fCurrentAngle[0] = 0.0f;
  m_fCurrentAngle[1] = 0.0f;