Fixed: #1034 Implement CCustomMouse for Linux

This commit is contained in:
kervala 2010-11-04 22:14:47 +01:00
parent 6f0fef6808
commit b443693334
9 changed files with 28 additions and 8 deletions

View file

@ -173,7 +173,7 @@ CDriverD3D::CDriverD3D()
_CurrRot = 0; _CurrRot = 0;
_CurrHotSpotX = 0; _CurrHotSpotX = 0;
_CurrHotSpotY = 0; _CurrHotSpotY = 0;
_CursorScale = 0.85f; _CursorScale = 1.f;
_UserViewMtx.identity(); _UserViewMtx.identity();
_UserModelMtx.identity(); _UserModelMtx.identity();

View file

@ -923,14 +923,15 @@ public:
// see if system cursor is currently captured // see if system cursor is currently captured
virtual bool isSystemCursorCaptured(); virtual bool isSystemCursorCaptured();
virtual void setHardwareCursorScale(float scale) { _CursorScale = scale; }
// Add a new cursor (name is case unsensitive) // Add a new cursor (name is case unsensitive)
virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap); virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap);
// Display a cursor from its name (case unsensitive) // Display a cursor from its name (case unsensitive)
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false); virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false);
// Change default scale for all cursors
virtual void setCursorScale(float scale);
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive); virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive);
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable); virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable);
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager(); virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager();

View file

@ -300,6 +300,12 @@ void CDriverD3D::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot
} }
// *************************************************************************************
void CDriverD3D::setCursorScale(float scale)
{
_CursorScale = scale;
}
// ************************************************************************************* // *************************************************************************************
nlCursor CDriverD3D::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY) nlCursor CDriverD3D::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY)
{ {

View file

@ -223,7 +223,7 @@ CDriverGL::CDriverGL()
_CurrRot = 0; _CurrRot = 0;
_CurrHotSpotX = 0; _CurrHotSpotX = 0;
_CurrHotSpotY = 0; _CurrHotSpotY = 0;
_CursorScale = 0.85f; _CursorScale = 1.f;
_MouseCaptured = false; _MouseCaptured = false;
_NeedToRestaureGammaRamp = false; _NeedToRestaureGammaRamp = false;

View file

@ -523,14 +523,15 @@ public:
// see if system cursor is currently captured // see if system cursor is currently captured
virtual bool isSystemCursorCaptured(); virtual bool isSystemCursorCaptured();
virtual void setHardwareCursorScale(float scale) { _CursorScale = scale; }
// Add a new cursor (name is case unsensitive) // Add a new cursor (name is case unsensitive)
virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap); virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap);
// Display a cursor from its name (case unsensitive) // Display a cursor from its name (case unsensitive)
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false); virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false);
// Change default scale for all cursors
virtual void setCursorScale(float scale);
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive); virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive);
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable); virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable);

View file

@ -367,6 +367,12 @@ void CDriverGL::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot,
} }
// *************************************************************************************
void CDriverGL::setCursorScale(float scale)
{
_CursorScale = scale;
}
// ************************************************************************************* // *************************************************************************************
nlCursor CDriverGL::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY) nlCursor CDriverGL::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY)
{ {

View file

@ -1664,6 +1664,13 @@ void CDriverUser::setCursor(const std::string &name, NLMISC::CRGBA col, uint8
_Driver->setCursor(name, col, rot, hotSpotX, hotSpotY, forceRebuild); _Driver->setCursor(name, col, rot, hotSpotX, hotSpotY, forceRebuild);
} }
void CDriverUser::setCursorScale(float scale)
{
NL3D_HAUTO_UI_DRIVER;
_Driver->setCursorScale(scale);
}
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// Async Texture loading mgt // Async Texture loading mgt

View file

@ -157,7 +157,6 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
_MouseButtonsReleased = noButton; _MouseButtonsReleased = noButton;
_MouseButtonsState = noButton; _MouseButtonsState = noButton;
_Focus = false; _Focus = false;
// Driver->setFocus(false);
if (!_SkipInterfaceManager) if (!_SkipInterfaceManager)
{ {

View file

@ -729,7 +729,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
_GlobalTextures.push_back (gt); _GlobalTextures.push_back (gt);
// Driver->setHardwareCursorScale(ClientCfg.HardwareCursorScale); Driver->setCursorScale(ClientCfg.HardwareCursorScale);
char bufTmp[256], tgaName[256]; char bufTmp[256], tgaName[256];
string sTGAname; string sTGAname;