mirror of
https://github.com/ENSL/NS.git
synced 2025-03-13 22:22:51 +00:00
o fixed commander keyboard scrolling ( +scrollleft, +scrollright, +scrollup and +scrolldown )
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@586 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
c2a52e69cb
commit
ac055a0b50
3 changed files with 80 additions and 8 deletions
|
@ -720,17 +720,17 @@ void AvHHud::AddCommands()
|
||||||
gEngfuncs.pfnAddCommand ("-mousepopupmenu", AvHPieMenuHandler::ClosePieMenu);
|
gEngfuncs.pfnAddCommand ("-mousepopupmenu", AvHPieMenuHandler::ClosePieMenu);
|
||||||
|
|
||||||
// Add scrolling commands
|
// Add scrolling commands
|
||||||
gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::ScrollUp);
|
gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::KeyScrollUp);
|
||||||
gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::StopScroll);
|
gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::KeyScrollUpStop);
|
||||||
|
|
||||||
gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::ScrollDown);
|
gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::KeyScrollDown);
|
||||||
gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::StopScroll);
|
gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::KeyScrollDownStop);
|
||||||
|
|
||||||
gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::ScrollLeft);
|
gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::KeyScrollLeft);
|
||||||
gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::StopScroll);
|
gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::KeyScrollLeftStop);
|
||||||
|
|
||||||
gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::ScrollRight);
|
gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::KeyScrollRight);
|
||||||
gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::StopScroll);
|
gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::KeyScrollRightStop);
|
||||||
|
|
||||||
gEngfuncs.pfnAddCommand ("toggleeditps", AvHParticleEditorHandler::ToggleEdit);
|
gEngfuncs.pfnAddCommand ("toggleeditps", AvHParticleEditorHandler::ToggleEdit);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "mod/AvHActionButtons.h"
|
#include "mod/AvHActionButtons.h"
|
||||||
#include "ui/UIUtil.h"
|
#include "ui/UIUtil.h"
|
||||||
|
|
||||||
|
|
||||||
int AvHScrollHandler::sScrollX = 0;
|
int AvHScrollHandler::sScrollX = 0;
|
||||||
int AvHScrollHandler::sScrollY = 0;
|
int AvHScrollHandler::sScrollY = 0;
|
||||||
int AvHScrollHandler::sScrollZ = 0;
|
int AvHScrollHandler::sScrollZ = 0;
|
||||||
|
@ -18,9 +19,11 @@ int AvHScrollHandler::sLastMouseUpX = 0;
|
||||||
int AvHScrollHandler::sLastMouseUpY = 0;
|
int AvHScrollHandler::sLastMouseUpY = 0;
|
||||||
bool AvHScrollHandler::sMouseOneDown = false;
|
bool AvHScrollHandler::sMouseOneDown = false;
|
||||||
bool AvHScrollHandler::sMouseTwoDown = false;
|
bool AvHScrollHandler::sMouseTwoDown = false;
|
||||||
|
int AvHScrollHandler::sKeyDown = 0;
|
||||||
|
|
||||||
AvHScrollHandler::AvHScrollHandler()
|
AvHScrollHandler::AvHScrollHandler()
|
||||||
{
|
{
|
||||||
|
sKeyDown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvHScrollHandler::GetMouseOneDown() const
|
bool AvHScrollHandler::GetMouseOneDown() const
|
||||||
|
@ -63,6 +66,62 @@ void AvHScrollHandler::ClearScrollHeight()
|
||||||
sScrollZ = 0;
|
sScrollZ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollLeft()
|
||||||
|
{
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sKeyDown++;
|
||||||
|
ScrollLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollRight()
|
||||||
|
{
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sKeyDown++;
|
||||||
|
ScrollRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollUp()
|
||||||
|
{
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sKeyDown++;
|
||||||
|
ScrollUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollDown()
|
||||||
|
{
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sKeyDown++;
|
||||||
|
ScrollDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollDownStop()
|
||||||
|
{
|
||||||
|
sKeyDown--;
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
ScrollDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollLeftStop()
|
||||||
|
{
|
||||||
|
sKeyDown--;
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sScrollX=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollRightStop()
|
||||||
|
{
|
||||||
|
sKeyDown--;
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sScrollX=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHScrollHandler::KeyScrollUpStop()
|
||||||
|
{
|
||||||
|
sKeyDown--;
|
||||||
|
if ( sKeyDown < 0 ) sKeyDown=0;
|
||||||
|
sScrollY=0;
|
||||||
|
}
|
||||||
|
|
||||||
void AvHScrollHandler::ScrollLeft()
|
void AvHScrollHandler::ScrollLeft()
|
||||||
{
|
{
|
||||||
sScrollX = -1;
|
sScrollX = -1;
|
||||||
|
@ -102,6 +161,9 @@ void AvHScrollHandler::StopScroll()
|
||||||
|
|
||||||
void AvHScrollHandler::cursorMoved(int x, int y, Panel* inPanel)
|
void AvHScrollHandler::cursorMoved(int x, int y, Panel* inPanel)
|
||||||
{
|
{
|
||||||
|
if ( sKeyDown > 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
char theMessage[256];
|
char theMessage[256];
|
||||||
int theRandNumber = rand() % 10;
|
int theRandNumber = rand() % 10;
|
||||||
sprintf(theMessage, "Cursor moved, %d, %d, rand = %d", x, y, theRandNumber);
|
sprintf(theMessage, "Cursor moved, %d, %d, rand = %d", x, y, theRandNumber);
|
||||||
|
|
|
@ -19,6 +19,14 @@ public:
|
||||||
bool GetMouseTwoDown() const;
|
bool GetMouseTwoDown() const;
|
||||||
|
|
||||||
static void ClearScrollHeight();
|
static void ClearScrollHeight();
|
||||||
|
static void KeyScrollLeft();
|
||||||
|
static void KeyScrollRight();
|
||||||
|
static void KeyScrollUp();
|
||||||
|
static void KeyScrollDown();
|
||||||
|
static void KeyScrollLeftStop();
|
||||||
|
static void KeyScrollRightStop();
|
||||||
|
static void KeyScrollUpStop();
|
||||||
|
static void KeyScrollDownStop();
|
||||||
static void ScrollLeft();
|
static void ScrollLeft();
|
||||||
static void ScrollRight();
|
static void ScrollRight();
|
||||||
static void ScrollUp();
|
static void ScrollUp();
|
||||||
|
@ -40,6 +48,7 @@ public:
|
||||||
virtual void keyFocusTicked(Panel* panel) {}
|
virtual void keyFocusTicked(Panel* panel) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static int sScrollX;
|
static int sScrollX;
|
||||||
static int sScrollY;
|
static int sScrollY;
|
||||||
static int sScrollZ;
|
static int sScrollZ;
|
||||||
|
@ -51,6 +60,7 @@ private:
|
||||||
static int sLastMouseUpY;
|
static int sLastMouseUpY;
|
||||||
static bool sMouseOneDown;
|
static bool sMouseOneDown;
|
||||||
static bool sMouseTwoDown;
|
static bool sMouseTwoDown;
|
||||||
|
static int sKeyDown;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue