Commit 4e4008ca authored by Gerhard Stein's avatar Gerhard Stein

Prepared some code for vpad configuration overlay

parent 971c8b52
......@@ -347,6 +347,12 @@ void CInput::render()
if(!mpVirtPad)
return;
if(mVPadConfigState)
{
mpVirtPad->renderConfig();
return;
}
if(!mpVirtPad->active())
return;
......@@ -669,6 +675,12 @@ void CInput::pollEvents()
// Semaphore
SDL_SemWait( pollSem );
if(mpVirtPad && mVPadConfigState)
{
mpVirtPad->processConfig();
return;
}
if(remapper.mappingInput)
{
readNewEvent();
......
......@@ -297,6 +297,15 @@ public:
// One virtual input overlay can be active be processed. This is useful for game to ported on mobile devices
std::unique_ptr<GsVirtualInput> mpVirtPad;
/**
* @brief setInVPadConfigState Want to open the vpad configuration?
* Then open this!
*/
void setInVPadConfigState()
{
mVPadConfigState = true;
}
private:
// Input Events
......@@ -326,6 +335,8 @@ private:
int m_cmdpulse;
short m_joydeadzone;
bool mVPadConfigState = false;
bool immediate_keytable[KEYTABLE_SIZE];
bool last_immediate_keytable[KEYTABLE_SIZE];
bool firsttime_immediate_keytable[KEYTABLE_SIZE];
......
......@@ -146,7 +146,7 @@ void GsAppEventSink::pumpEvent(const CEvent *evPtr)
void GsApp::pollEvents()
{
{
if( gInput.getExitEvent() )
{
mpCurEngine.release();
......
......@@ -131,6 +131,17 @@ public:
*/
virtual void flush() = 0;
/**
* @brief renderConfig Render configuration dialog of the dialog
*/
virtual void processConfig() = 0;
/**
* @brief renderConfig Render configuration dialog of the dialog
*/
virtual void renderConfig() = 0;
/**
* @brief render is called when it's time to render this object
* @param sfc Reference to surface on which it can be rendered.
......
......@@ -157,6 +157,13 @@ bool CGameLauncher::setupMenu()
0.75f ),
GsRect<float>(0.0f, 0.0f, 0.069f, 0.069f) );
mLauncherDialog.addControl(new GsButton( "VPad", new OpenVGamePadSettingsEvent(),
GsControl::Style::NONE,
0.75f,
1.0f,
1.0f ),
GsRect<float>(0.75f, 0.0f, 0.17f, 0.069f) );
mLauncherDialog.addControl(new GsButton( "|", new OpenSettingsMenuEvent(),
GsControl::Style::NONE,
0.75f,
......@@ -635,10 +642,15 @@ void CGameLauncher::pumpEvent(const CEvent *evPtr)
{
gEventManager.add( new OpenMenuEvent(
new SettingsMenu(GsControl::Style::NONE) ) );
}
else if( dynamic_cast<const OpenVGamePadSettingsEvent*>(evPtr) )
{
gInput.setInVPadConfigState();
}
// Check Scroll events happening on this Launcher
if( const MouseWheelEvent *mwe = dynamic_cast<const MouseWheelEvent*>(evPtr) )
{
......
......@@ -221,6 +221,19 @@ bool VirtualKeenControl::ponder()
return true;
}
void VirtualKeenControl::processConfig()
{
assert(0);
}
void VirtualKeenControl::renderConfig()
{
assert(0);
}
void VirtualKeenControl::hideEverything()
{
mPadBackground.invisible = true;
......
......@@ -31,6 +31,18 @@ public:
bool ponder() override;
/**
* @brief renderConfig Render configuration dialog of the dialog
*/
void processConfig() override;
/**
* @brief renderConfig Render configuration dialog of the dialog
*/
void renderConfig() override;
/**
* @brief render is called when it's time to render this object
* @param sfc Reference to surface on which it can be rendered.
......
......@@ -18,5 +18,7 @@ public:
struct OpenSettingsMenuEvent : public CEvent {};
struct OpenVGamePadSettingsEvent : public CEvent {};
#endif /* GALAXY_SETTINGSMENU_H_INCLUDED */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment