mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Merge branch 'minetest:master' into master
This commit is contained in:
commit
7c86c8507d
3 changed files with 26 additions and 19 deletions
|
@ -7583,9 +7583,12 @@ an itemstring, a table or `nil`.
|
|||
* `set_wear(wear)`: returns boolean indicating whether item was cleared
|
||||
* `wear`: number, unsigned 16 bit integer
|
||||
* `get_meta()`: returns ItemStackMetaRef. See section for more details
|
||||
* `get_metadata()`: (DEPRECATED) Returns metadata (a string attached to an item
|
||||
stack).
|
||||
* `set_metadata(metadata)`: (DEPRECATED) Returns true.
|
||||
* `get_metadata()`: **Deprecated.** Returns metadata (a string attached to an item stack).
|
||||
* If you need to access this to maintain backwards compatibility,
|
||||
use `stack:get_meta():get_string("")` instead.
|
||||
* `set_metadata(metadata)`: **Deprecated.** Returns true.
|
||||
* If you need to set this to maintain backwards compatibility,
|
||||
use `stack:get_meta():set_string("", metadata)` instead.
|
||||
* `get_description()`: returns the description shown in inventory list tooltips.
|
||||
* The engine uses this when showing item descriptions in tooltips.
|
||||
* Fields for finding the description, in order:
|
||||
|
|
|
@ -647,8 +647,9 @@ bool CIrrDeviceSDL::createWindowWithContext()
|
|||
if (ScaleX != 1.0f || ScaleY != 1.0f) {
|
||||
// The given window size is in pixels, not in screen coordinates.
|
||||
// We can only do the conversion now since we didn't know the scale before.
|
||||
SDL_SetWindowSize(Window, CreationParams.WindowSize.Width / ScaleX,
|
||||
CreationParams.WindowSize.Height / ScaleY);
|
||||
SDL_SetWindowSize(Window,
|
||||
static_cast<int>(CreationParams.WindowSize.Width / ScaleX),
|
||||
static_cast<int>(CreationParams.WindowSize.Height / ScaleY));
|
||||
// Re-center, otherwise large, non-maximized windows go offscreen.
|
||||
SDL_SetWindowPosition(Window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||
updateSizeAndScale();
|
||||
|
@ -717,10 +718,12 @@ bool CIrrDeviceSDL::run()
|
|||
|
||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||
MouseX = irrevent.MouseInput.X = SDL_event.motion.x * ScaleX;
|
||||
MouseY = irrevent.MouseInput.Y = SDL_event.motion.y * ScaleY;
|
||||
MouseXRel = SDL_event.motion.xrel * ScaleX;
|
||||
MouseYRel = SDL_event.motion.yrel * ScaleY;
|
||||
MouseX = irrevent.MouseInput.X =
|
||||
static_cast<s32>(SDL_event.motion.x * ScaleX);
|
||||
MouseY = irrevent.MouseInput.Y =
|
||||
static_cast<s32>(SDL_event.motion.y * ScaleY);
|
||||
MouseXRel = static_cast<s32>(SDL_event.motion.xrel * ScaleX);
|
||||
MouseYRel = static_cast<s32>(SDL_event.motion.yrel * ScaleY);
|
||||
irrevent.MouseInput.ButtonStates = MouseButtonStates;
|
||||
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
||||
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
||||
|
@ -752,8 +755,8 @@ bool CIrrDeviceSDL::run()
|
|||
SDL_Keymod keymod = SDL_GetModState();
|
||||
|
||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.X = SDL_event.button.x * ScaleX;
|
||||
irrevent.MouseInput.Y = SDL_event.button.y * ScaleY;
|
||||
irrevent.MouseInput.X = static_cast<s32>(SDL_event.button.x * ScaleX);
|
||||
irrevent.MouseInput.Y = static_cast<s32>(SDL_event.button.y * ScaleY);
|
||||
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
||||
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
||||
|
||||
|
@ -918,8 +921,8 @@ bool CIrrDeviceSDL::run()
|
|||
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||
irrevent.TouchInput.Event = ETIE_PRESSED_DOWN;
|
||||
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||
irrevent.TouchInput.X = static_cast<s32>(SDL_event.tfinger.x * Width);
|
||||
irrevent.TouchInput.Y = static_cast<s32>(SDL_event.tfinger.y * Height);
|
||||
CurrentTouchCount++;
|
||||
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||
|
||||
|
@ -930,8 +933,8 @@ bool CIrrDeviceSDL::run()
|
|||
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||
irrevent.TouchInput.Event = ETIE_MOVED;
|
||||
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||
irrevent.TouchInput.X = static_cast<s32>(SDL_event.tfinger.x * Width);
|
||||
irrevent.TouchInput.Y = static_cast<s32>(SDL_event.tfinger.y * Height);
|
||||
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
|
@ -941,8 +944,8 @@ bool CIrrDeviceSDL::run()
|
|||
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||
irrevent.TouchInput.Event = ETIE_LEFT_UP;
|
||||
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||
irrevent.TouchInput.X = static_cast<s32>(SDL_event.tfinger.x * Width);
|
||||
irrevent.TouchInput.Y = static_cast<s32>(SDL_event.tfinger.y * Height);
|
||||
// To match Android behavior, still count the pointer that was
|
||||
// just released.
|
||||
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||
|
|
|
@ -159,7 +159,8 @@ public:
|
|||
void setPosition(s32 x, s32 y) override
|
||||
{
|
||||
SDL_WarpMouseInWindow(Device->Window,
|
||||
x / Device->ScaleX, y / Device->ScaleY);
|
||||
static_cast<int>(x / Device->ScaleX),
|
||||
static_cast<int>(y / Device->ScaleY));
|
||||
|
||||
if (SDL_GetRelativeMouseMode()) {
|
||||
// There won't be an event for this warp (details on libsdl-org/SDL/issues/6034)
|
||||
|
@ -192,7 +193,7 @@ public:
|
|||
virtual void setRelativeMode(bool relative) _IRR_OVERRIDE_
|
||||
{
|
||||
// Only change it when necessary, as it flushes mouse motion when enabled
|
||||
if (relative != SDL_GetRelativeMouseMode()) {
|
||||
if (relative != static_cast<bool>(SDL_GetRelativeMouseMode())) {
|
||||
if (relative)
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue