[dasher: 7/21] Turbo mode!
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 7/21] Turbo mode!
- Date: Thu, 14 Jul 2011 17:31:44 +0000 (UTC)
commit 7a12b2d33e441b2df6a3ede13fa649e9045d1580
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Thu Jun 30 18:41:20 2011 +0100
Turbo mode!
Hold other mouse button / key1 to go 75% faster in DefaultFilter/StylusFilter
Src/DasherCore/DefaultFilter.cpp | 17 +++++++++++++++--
Src/DasherCore/DefaultFilter.h | 2 ++
Src/DasherCore/Parameters.cpp | 1 +
Src/DasherCore/Parameters.h | 2 +-
Src/DasherCore/StylusFilter.cpp | 6 ++++--
5 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/Src/DasherCore/DefaultFilter.cpp b/Src/DasherCore/DefaultFilter.cpp
index 4e349bb..0be7b5b 100644
--- a/Src/DasherCore/DefaultFilter.cpp
+++ b/Src/DasherCore/DefaultFilter.cpp
@@ -25,7 +25,7 @@ bool CDefaultFilter::GetSettings(SModuleSettings **sets, int *iCount) {
}
CDefaultFilter::CDefaultFilter(CSettingsUser *pCreator, CDasherInterfaceBase *pInterface, CFrameRate *pFramerate, ModuleID_t iID, const char *szName)
- : CDynamicFilter(pCreator, pInterface, pFramerate, iID, szName), CSettingsObserver(pCreator) {
+ : CDynamicFilter(pCreator, pInterface, pFramerate, iID, szName), CSettingsObserver(pCreator), m_bTurbo(false) {
m_pStartHandler = 0;
m_pAutoSpeedControl = new CAutoSpeedControl(this, pInterface);
@@ -127,7 +127,8 @@ bool CDefaultFilter::Timer(unsigned long Time, CDasherView *pView, CDasherInput
}
}
- const double dSpeedMul(SlowStartSpeedMul(Time));
+ double dSpeedMul(SlowStartSpeedMul(Time));
+ if (m_bTurbo) dSpeedMul*=1.75;
OneStepTowards(m_pDasherModel, m_iLastX,m_iLastY, Time, dSpeedMul);
bDidSomething = true;
@@ -162,17 +163,29 @@ void CDefaultFilter::KeyDown(unsigned long iTime, int iId, CDasherView *pDasherV
m_pInterface->Stop();
}
break;
+ case 101: case 102: //Other mouse buttons, if platforms support?
+ case 1: //button 1
+ if (GetBoolParameter(BP_TURBO_MODE)) {
+ m_bTurbo = true;
+ }
default:
break;
}
}
+void CDefaultFilter::KeyUp(unsigned long iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel) {
+ if (iId==101 || iId==1)
+ m_bTurbo=false;
+}
+
void CDefaultFilter::HandleEvent(int iParameter) {
switch (iParameter) {
case BP_CIRCLE_START:
case BP_MOUSEPOS_MODE:
CreateStartHandler();
break;
+ case BP_TURBO_MODE:
+ m_bTurbo &= GetBoolParameter(BP_TURBO_MODE);
}
}
diff --git a/Src/DasherCore/DefaultFilter.h b/Src/DasherCore/DefaultFilter.h
index 8be3fb9..d64a9b3 100644
--- a/Src/DasherCore/DefaultFilter.h
+++ b/Src/DasherCore/DefaultFilter.h
@@ -19,6 +19,7 @@ class CDefaultFilter : public CDynamicFilter, public CSettingsObserver {
virtual bool DecorateView(CDasherView *pView, CDasherInput *pInput);
virtual bool Timer(unsigned long Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, CExpansionPolicy **pol);
virtual void KeyDown(unsigned long iTime, int iId, CDasherView *pDasherView, CDasherInput *pInput, CDasherModel *pModel, CUserLogBase *pUserLog);
+ virtual void KeyUp(unsigned long iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel);
virtual void Activate();
virtual void Deactivate();
bool GetSettings(SModuleSettings **, int *);
@@ -38,6 +39,7 @@ private:
myint m_iSum;
CStartHandler *m_pStartHandler;
int m_iCounter;
+ bool m_bTurbo;
};
}
/// @}
diff --git a/Src/DasherCore/Parameters.cpp b/Src/DasherCore/Parameters.cpp
index a461cea..b65e9a1 100644
--- a/Src/DasherCore/Parameters.cpp
+++ b/Src/DasherCore/Parameters.cpp
@@ -21,6 +21,7 @@ const bp_table boolparamtable[] = {
{BP_COLOUR_MODE, "ColourMode", PERS, true, "ColourMode"},
{BP_MOUSEPOS_MODE, "StartOnMousePosition", PERS, false, "StartOnMousePosition"},
{BP_PALETTE_CHANGE, "PaletteChange", PERS, true, "PaletteChange"},
+ {BP_TURBO_MODE, "TurboMode", PERS, true, "Boost speed when holding key1 or right mouse button"},
{BP_AUTOCALIBRATE, "Autocalibrate", PERS, true, "Automatically learn TargetOffset e.g. gazetracking"},
{BP_REMAP_XTREME, "RemapXtreme", PERS, false, "Pointer at extreme Y translates more and zooms less"},
{BP_DASHER_PAUSED, "DasherPaused", !PERS, true, "Dasher Paused"},
diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
index f98d867..58b6c98 100644
--- a/Src/DasherCore/Parameters.h
+++ b/Src/DasherCore/Parameters.h
@@ -32,7 +32,7 @@ enum {
BP_SHOW_SLIDER, BP_START_MOUSE,
BP_START_SPACE, BP_STOP_IDLE, BP_CONTROL_MODE,
BP_COLOUR_MODE, BP_MOUSEPOS_MODE,
- BP_PALETTE_CHANGE,
+ BP_PALETTE_CHANGE, BP_TURBO_MODE,
BP_AUTOCALIBRATE, BP_REMAP_XTREME, BP_DASHER_PAUSED,
BP_GAME_MODE, BP_LM_DICTIONARY,
BP_LM_LETTER_EXCLUSION, BP_AUTO_SPEEDCONTROL,
diff --git a/Src/DasherCore/StylusFilter.cpp b/Src/DasherCore/StylusFilter.cpp
index 83835bd..edc4a3e 100644
--- a/Src/DasherCore/StylusFilter.cpp
+++ b/Src/DasherCore/StylusFilter.cpp
@@ -27,7 +27,8 @@ void CStylusFilter::KeyDown(unsigned long iTime, int iId, CDasherView *pView, CD
pModel->ClearScheduledSteps();
Unpause(iTime);
m_iKeyDownTime = iTime;
- }
+ } else
+ CDefaultFilter::KeyDown(iTime, iId, pView, pInput, pModel, pUserLog);
}
void CStylusFilter::KeyUp(unsigned long iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel) {
@@ -39,7 +40,8 @@ void CStylusFilter::KeyUp(unsigned long iTime, int iId, CDasherView *pView, CDas
} else {
m_pInterface->Stop();
}
- }
+ } else
+ CDefaultFilter::KeyUp(iTime, iId, pView, pInput, pModel);
}
void CStylusFilter::ApplyClickTransform(myint &iDasherX, myint &iDasherY, CDasherView *pView) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]