mirror of
https://github.com/OpenTrespasser/JurassicParkTrespasser.git
synced 2024-12-18 14:41:56 +00:00
Compare commits
13 Commits
040c99d81b
...
2c52f38fe8
Author | SHA1 | Date | |
---|---|---|---|
|
2c52f38fe8 | ||
|
89ee2be9b6 | ||
|
52ef160f5c | ||
|
e1c7e53ef4 | ||
|
9556230685 | ||
|
46ad924a5d | ||
|
1c9bb0d57a | ||
|
498130ed0d | ||
|
c448e9785b | ||
|
8e1860e8f8 | ||
|
0550c007ed | ||
|
21d07eef0d | ||
|
5bf9934591 |
@ -101,7 +101,7 @@
|
||||
|
||||
|
||||
|
||||
#if VER_LOG_MESSAGES
|
||||
#if 1
|
||||
|
||||
//******************************************************************************************
|
||||
void CMessage::WriteToLog() const
|
||||
|
@ -228,7 +228,7 @@ protected:
|
||||
//**************************************
|
||||
|
||||
|
||||
#if VER_LOG_MESSAGES
|
||||
#if 1
|
||||
|
||||
//******************************************************************************************
|
||||
//
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <list>
|
||||
#include "Lib/EntityDBase/PhysicsInfo.hpp"
|
||||
|
||||
#define VER_PARTITION_MAGNETS VER_TEST
|
||||
#define VER_PARTITION_MAGNETS 1
|
||||
|
||||
enum EMagnetFlag // Used for flags in CMagnet
|
||||
// Prefix: emf
|
||||
|
@ -843,7 +843,7 @@ void CUIListbox::DoFrame(POINT ptMouse)
|
||||
iThumbHeight = (m_rc.bottom - m_rc.top) - (2 + (2 * m_iScrollWidth));
|
||||
y = (ptMouse.y - m_rc.top) - (m_iScrollWidth + 1);
|
||||
|
||||
iNewTop = (int)((double)((y - m_iMouseFromTop) * m_vInfo.size()) / (double) iThumbHeight);
|
||||
iNewTop = (int)((double)((y - m_iMouseFromTop) * (int) m_vInfo.size()) / (double) iThumbHeight);
|
||||
if (iNewTop < 0)
|
||||
{
|
||||
iNewTop = 0;
|
||||
@ -1069,28 +1069,42 @@ BOOL CUIListbox::LButtonUp(int x, int y, UINT keyFlags)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CUIListbox::ScrollUp()
|
||||
{
|
||||
if ((m_iTop - 1) >= 0)
|
||||
{
|
||||
m_iTop--;
|
||||
m_bUpdate = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void CUIListbox::ScrollDown()
|
||||
{
|
||||
if ((m_iTop + 1) <= (m_vInfo.size() - m_iItemsMaxVis))
|
||||
{
|
||||
m_iTop++;
|
||||
m_bUpdate = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CUIListbox::MouseWheel(int x, int y, int zDelta, UINT keyFlags)
|
||||
{
|
||||
if (zDelta > 0)
|
||||
ScrollUp();
|
||||
else if (zDelta < 0)
|
||||
ScrollDown();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CUIListbox::UIButtonUp(CUIButton * pbutton)
|
||||
{
|
||||
int iNewTop;
|
||||
|
||||
if ((pbutton->GetID() == IDSCROLLUP) && (pbutton->GetActive()))
|
||||
{
|
||||
iNewTop = m_iTop - 1;
|
||||
if (iNewTop >= 0)
|
||||
{
|
||||
m_iTop = iNewTop;
|
||||
m_bUpdate = TRUE;
|
||||
}
|
||||
ScrollUp();
|
||||
}
|
||||
else if ((pbutton->GetID() == IDSCROLLDN) && (pbutton->GetActive()))
|
||||
{
|
||||
iNewTop = m_iTop + 1;
|
||||
if (iNewTop <= m_vInfo.size()- m_iItemsMaxVis)
|
||||
{
|
||||
m_iTop = iNewTop;
|
||||
m_bUpdate = TRUE;
|
||||
}
|
||||
ScrollDown();
|
||||
}
|
||||
|
||||
if (m_bUpdate)
|
||||
@ -2632,6 +2646,19 @@ BOOL CUISlider::LButtonUp(int x, int y, UINT keyFlags)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CUISlider::MouseWheel(int x, int y, int zDelta, UINT keyFlags)
|
||||
{
|
||||
//zDeltas are multiples of 120, see WM_MOUSEWHEEL documentation
|
||||
int scrollstep = static_cast<int>(std::round(static_cast<double>(m_iUnits) / 20));
|
||||
int scrolldistance = scrollstep * (zDelta / 120);
|
||||
m_iCurrUnit = std::clamp(m_iCurrUnit + scrolldistance, 0, m_iUnits);
|
||||
|
||||
m_pParent->UISliderChange(this, m_iCurrUnit);
|
||||
m_pParent->CtrlInvalidateRect(&m_rc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CUISlider::TokenLoad(HANDLE hFile)
|
||||
{
|
||||
BOOL bRet;
|
||||
|
@ -102,6 +102,7 @@ public:
|
||||
virtual void ReleaseCapture() {;}
|
||||
|
||||
virtual void MouseMove(int x, int y, UINT keyFlags);
|
||||
virtual BOOL MouseWheel(int x, int y, int zDelta, UINT keyFlags) { return FALSE; }
|
||||
virtual BOOL LButtonDown(int x, int y, BOOL bDoubleClick, UINT keyFlags);
|
||||
virtual BOOL LButtonUp(int x, int y, UINT keyFlags);
|
||||
|
||||
@ -211,6 +212,7 @@ public:
|
||||
|
||||
virtual BOOL LButtonDown(int x, int y, BOOL bDoubleClick, UINT keyFlags) override;
|
||||
virtual BOOL LButtonUp(int x, int y, UINT keyFlags) override;
|
||||
virtual BOOL MouseWheel(int x, int y, int zDelta, UINT keyFlags) override;
|
||||
|
||||
virtual BOOL TokenLoad(HANDLE hFile) override;
|
||||
|
||||
@ -305,6 +307,9 @@ private:
|
||||
|
||||
void Update();
|
||||
BOOL InitSurface();
|
||||
|
||||
void ScrollUp();
|
||||
void ScrollDown();
|
||||
};
|
||||
|
||||
|
||||
@ -437,6 +442,7 @@ public:
|
||||
virtual void MouseMove(int x, int y, UINT keyFlags) override;
|
||||
virtual BOOL LButtonDown(int x, int y, BOOL bDoubleClick, UINT keyFlags) override;
|
||||
virtual BOOL LButtonUp(int x, int y, UINT keyFlags) override;
|
||||
virtual BOOL MouseWheel(int x, int y, int zDelta, UINT keyFlags) override;
|
||||
|
||||
virtual BOOL TokenLoad(HANDLE hFile) override;
|
||||
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
void OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags);
|
||||
void OnChar(HWND hwnd, TCHAR ch, int cRepeat);
|
||||
void OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags);
|
||||
void OnMouseWheel(HWND hwnd, int x, int y, int zDelta, UINT fwKeys);
|
||||
void OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags);
|
||||
void OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags);
|
||||
void OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags);
|
||||
|
@ -237,6 +237,11 @@ void CMainWnd::OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags)
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWnd::OnMouseWheel(HWND hwnd, int x, int y, int zDelta, UINT fwKeys)
|
||||
{
|
||||
if (CUIWnd* puiwnd = m_pUIMgr->GetActiveUIWnd(); puiwnd && !puiwnd->m_bExitWnd)
|
||||
puiwnd->OnMouseWheel(x, y, zDelta, fwKeys);
|
||||
}
|
||||
|
||||
void CMainWnd::OnRButtonDown(HWND hwnd,
|
||||
BOOL fDoubleClick,
|
||||
@ -723,6 +728,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
|
||||
HANDLE_MSG(hwnd, WM_KEYUP, g_pMainWnd->OnKey);
|
||||
HANDLE_MSG(hwnd, WM_CHAR, g_pMainWnd->OnChar);
|
||||
HANDLE_MSG(hwnd, WM_MOUSEMOVE, g_pMainWnd->OnMouseMove);
|
||||
HANDLE_MSG(hwnd, WM_MOUSEWHEEL, g_pMainWnd->OnMouseWheel);
|
||||
HANDLE_MSG(hwnd, WM_LBUTTONDOWN, g_pMainWnd->OnLButtonDown);
|
||||
HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK, g_pMainWnd->OnLButtonDown);
|
||||
HANDLE_MSG(hwnd, WM_LBUTTONUP, g_pMainWnd->OnLButtonUp);
|
||||
@ -730,6 +736,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
|
||||
HANDLE_MSG(hwnd, WM_ERASEBKGND, g_pMainWnd->OnEraseBkgnd);
|
||||
HANDLE_MSG(hwnd, WM_RBUTTONDOWN, g_pMainWnd->OnRButtonDown);
|
||||
HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK, g_pMainWnd->OnRButtonDown);
|
||||
HANDLE_MSG(hwnd, WM_MBUTTONDOWN, g_pMainWnd->OnMButtonDown);
|
||||
HANDLE_MSG(hwnd, WM_TIMER, g_pMainWnd->OnTimer);
|
||||
HANDLE_MSG(hwnd, WM_SYSCOMMAND, g_pMainWnd->OnSysCommand);
|
||||
}
|
||||
|
@ -1000,6 +1000,25 @@ void CUIWnd::OnMouseMove(int x, int y, UINT keyFlags)
|
||||
{
|
||||
}
|
||||
|
||||
void CUIWnd::OnMouseWheel(int x, int y, int zDelta, UINT fwKeys)
|
||||
{
|
||||
if (m_vUICtrls.empty())
|
||||
return;
|
||||
|
||||
for (auto i = m_vUICtrls.rbegin(); i != m_vUICtrls.rend() && *i; i++)
|
||||
{
|
||||
if (*i &&
|
||||
(*i)->HitTest(m_pUIMgr->m_ptMouse.x, m_pUIMgr->m_ptMouse.y) &&
|
||||
(*i)->MouseWheel(m_pUIMgr->m_ptMouse.x,
|
||||
m_pUIMgr->m_ptMouse.y,
|
||||
zDelta,
|
||||
fwKeys))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CUIWnd::OnLButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags)
|
||||
{
|
||||
if (m_vUICtrls.size() == 0)
|
||||
|
@ -143,6 +143,7 @@ public:
|
||||
virtual void OnKey(UINT vk, BOOL fDown, int cRepeat, UINT flags);
|
||||
virtual void OnChar(TCHAR ch, int cRepeat);
|
||||
virtual void OnMouseMove(int x, int y, UINT keyFlags);
|
||||
virtual void OnMouseWheel(int x, int y, int zDelta, UINT fwKeys);
|
||||
virtual void OnLButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags);
|
||||
virtual void OnLButtonUp(int x, int y, UINT keyFlags);
|
||||
virtual void OnRButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags);
|
||||
|
Loading…
Reference in New Issue
Block a user