Comments (14)
I booted up into Windows and apparently it's all fine. WM_MOUSELEAVE correctly only tracks the client area. Also tested hiding the mouse on_mouse_enter
and showing it on_mouse_leave
and it works beautifully on both Windows and macOS, allowing you to resize. I guess I'll close this, then.
from defos.
Hard week, I'll back to this issue after next week
from defos.
Then we have to provide a update method so that we are enble to do checking.
How about provide a method like is_mouse_exiting to developer, so that they can determine if they need to enable/disable the cursor by calling existing method.
from defos.
That's a good idea is_mouse_cursor_within_window maybe?
from defos.
I started Window support here
https://github.com/subsoap/defos/tree/is_mouse_cursor_within_window
@chaosddp could you test this? It seems a bit problematic and I'm not sure how to improve it.. The issue is that it's fast and good at detecting if the mouse cursor is well outside the window but seems buggy within sometimes constantly reporting true/false, and seems to have issues on the window edges.
@AGulev could you add Mac support? Is Mac support needed? It is on Windows because the cursor will hide still if the mouse is on the title/edges which makes resizing a pain.
from defos.
@subsoap I've tested on my Windows 10.
- the detect bound should exclude the titlebar, it seems like 32 pixel high?
- When i trying to move the cursor into the window, it was disappeared near the edge, but not exactly on the edge(red rectangle in following image), so still cannot resize the window easily. Maybe caused by window shadow effect?
How about add a buffer to the detect bound, or make it as parameter to set the bound?
from defos.
@chaosddp If you move your mouse around inside the window does it consistently say it's within the client window or does it sometimes say it's outside of the client window sometimes even while inside?
from defos.
@subsoap only near the edge in the window, it will switch between in/outside for several time, then it will be stable if i do not move the mouse
from defos.
@chaosddp I think there may be a better approach that's possible for detecting mouse within client window with what we have available. I'll need to do some more reading and testing.
from defos.
@chaosddp I don't have progress on this yet, any ideas?
from defos.
@subsoap sorry so late, how about SetWindowLongPtr to hook the mouse in/out event, i have not try this on defold game yet.
from defos.
@chaosddp could you try that?
Another option is using GLFW functions directly #36
We've been warned to not use GLFW functions because they might remove them at any point but our main goal should be to make these features work so people can publish games and adapt over time if necessary.
from defos.
Oh. I haven't tested for that behavior on Windows. On macOS that's how it works because I added a tracking rectangle on the NSView, not the NSWindow, so the title bar should be considered outside the window.
I found this:
https://stackoverflow.com/questions/5629613/hide-cursor-in-client-rectangle-but-not-on-title-bar
Maybe changing the Windows code to use this instead of / in tandem with WM_LEAVE would help?
from defos.
I think I'll give it a go
from defos.
Related Issues (20)
- Custom OS cursor breaking for macOS since recent update? HOT 12
- Need to change / improve method of setting HTML5 cursor
- Custom cursor images do not work in Microsoft Edge
- Multi monitor / tv setups can create issues with fullscreen mode HOT 2
- FPS cursor lock HOT 2
- Emscripten 1.39 support HOT 2
- hide cursor not working on mac HOT 2
- First input after toggling fullscreen not available on MacOS? HOT 1
- Should defos.on_click() be expanded to cover additional user interaction events? HOT 2
- Cross-platform custom cursors
- allow `clip cursor to game view area` for Linux HOT 1
- Set Window/View Size Before Game Start HOT 2
- Library stops project from building on linux HOT 8
- Changing the window title HOT 3
- Defos for dynamically scaling Defold game window in HTML5? HOT 2
- Toggling fullscreen re-enables window resize if previously disabled (Windows 10)
- Setting initial view size causes error `Could not find '@render' socket` HOT 4
- Updating to Clang 17 in Defold 1.6.2
- Windows 11, using defos.get_view_size() immediatly after defos.set_view_size() return different values. HOT 1
- View size from game.project affects HTML5 canvas size until first window resize
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from defos.