-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RetroPlayer: Add manager for game controls
- Loading branch information
Showing
14 changed files
with
233 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
set(SOURCES GUIGameControl.cpp) | ||
set(SOURCES GUIGameControl.cpp | ||
GUIGameControlManager.cpp | ||
) | ||
|
||
set(HEADERS GUIGameControl.h) | ||
set(HEADERS GUIGameControl.h | ||
GUIGameControlManager.h | ||
) | ||
|
||
core_add_library(retroplayer_guicontrols) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
xbmc/cores/RetroPlayer/guicontrols/GUIGameControlManager.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2017 Team Kodi | ||
* http://kodi.tv | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with XBMC; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "GUIGameControlManager.h" | ||
#include "GUIGameControl.h" | ||
#include "cores/RetroPlayer/rendering/GUIRenderSettings.h" | ||
|
||
using namespace KODI; | ||
using namespace RETRO; | ||
|
||
void CGUIGameControlManager::SetActiveControl(CGUIGameControl *control) | ||
{ | ||
m_activeControl = control; | ||
} | ||
|
||
bool CGUIGameControlManager::IsControlActive() const | ||
{ | ||
return m_activeControl != nullptr; | ||
} | ||
|
||
void CGUIGameControlManager::ResetActiveControl() | ||
{ | ||
m_activeControl = nullptr; | ||
} | ||
|
||
const CGUIRenderSettings &CGUIGameControlManager::GetRenderSettings() const | ||
{ | ||
if (m_activeControl != nullptr) | ||
return m_activeControl->GetRenderSettings(); | ||
|
||
static const CGUIRenderSettings defaultSettings; | ||
return defaultSettings; | ||
} |
47 changes: 47 additions & 0 deletions
47
xbmc/cores/RetroPlayer/guicontrols/GUIGameControlManager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2017 Team Kodi | ||
* http://kodi.tv | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this Program; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include "guilib/GUIControl.h" | ||
#include "guilib/GUIInfoTypes.h" | ||
|
||
namespace KODI | ||
{ | ||
namespace RETRO | ||
{ | ||
class CGUIGameControl; | ||
class CGUIRenderSettings; | ||
|
||
class CGUIGameControlManager | ||
{ | ||
public: | ||
CGUIGameControlManager() = default; | ||
|
||
void SetActiveControl(CGUIGameControl *control); | ||
bool IsControlActive() const; | ||
void ResetActiveControl(); | ||
|
||
const CGUIRenderSettings &GetRenderSettings() const; | ||
|
||
private: | ||
CGUIGameControl *m_activeControl = nullptr; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) 2017 Team Kodi | ||
* http://kodi.tv | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this Program; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "GUIRenderSettings.h" | ||
#include "settings/GameSettings.h" | ||
#include "settings/MediaSettings.h" | ||
|
||
using namespace KODI; | ||
using namespace RETRO; | ||
|
||
void CGUIRenderSettings::Reset() | ||
{ | ||
m_viewMode = -1; | ||
m_scalingMethod = -1; | ||
} | ||
|
||
bool CGUIRenderSettings::operator==(const CGUIRenderSettings &rhs) const | ||
{ | ||
return m_viewMode == rhs.m_viewMode && | ||
m_scalingMethod == rhs.m_scalingMethod; | ||
} | ||
|
||
ViewMode CGUIRenderSettings::GetRenderViewMode() const | ||
{ | ||
if (HasRenderViewMode()) | ||
return static_cast<ViewMode>(m_viewMode); | ||
|
||
CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings(); | ||
return gameSettings.ViewMode(); | ||
} | ||
|
||
ESCALINGMETHOD CGUIRenderSettings::GetScalingMethod() const | ||
{ | ||
if (HasScalingMethod()) | ||
return static_cast<ESCALINGMETHOD>(m_scalingMethod); | ||
|
||
CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings(); | ||
return gameSettings.ScalingMethod(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.