Borderless window and mouse clipping when not fullscreen

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
aehparta
Posts: 3
Joined: Wed Feb 29, 2012 3:38 pm

Borderless window and mouse clipping when not fullscreen

Post by aehparta »

Thought to share my modifications since these couple seemed to be missing from Irrlicht and they are, in my opinion, very usefull when developing games.

Made a patch with following new features ( patch-file is here https://sourceforge.net/tracker/?func=d ... tid=540678 ):
- creation of window without borders
- prevent mouse from escaping outside application window in windowed mode (borders or not)

Usage:

Code: Select all

irr::SIrrlichtCreationParameters params;
params.WindowNoBorder = <true|false>; // default false
params.MouseClip = <true|false>; // default false
Tested and used a little, more extensive testing needed (though it seems to work well on My Testing Environment (tm)). Microsoft Windows only. Didn't have the time or resources to apply this on other platforms (is it even needed?).
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Borderless window and mouse clipping when not fullscreen

Post by CuteAlien »

Thanks for the patch.

I see the point of creating a Window without borders, not sure how that would work on X11, but it's probably a little tricky doing that on Windows if it isn't supported by the engine so it might make sense adding that even if it's not yet cross-platform. I didn't even know about ClipCursor so far - have to check what that does when I find some time. But I think that one could still be done in the client-application without modifying Irrlicht as long as it's not cross-platform. And when added - please use same names as the system - when the OS calls it clipcursor it should be named similar (not MouseClip), that way people don't have to wonder if those are different things.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
aehparta
Posts: 3
Joined: Wed Feb 29, 2012 3:38 pm

Re: Borderless window and mouse clipping when not fullscreen

Post by aehparta »

CuteAlien wrote:Thanks for the patch.

I see the point of creating a Window without borders, not sure how that would work on X11, but it's probably a little tricky doing that on Windows if it isn't supported by the engine so it might make sense adding that even if it's not yet cross-platform. I didn't even know about ClipCursor so far - have to check what that does when I find some time. But I think that one could still be done in the client-application without modifying Irrlicht as long as it's not cross-platform. And when added - please use same names as the system - when the OS calls it clipcursor it should be named similar (not MouseClip), that way people don't have to wonder if those are different things.
The main reason I went through the trouble implementing these into Irrlicht itself was that both of these problems were quite hard to figure out. Also they need window handle, which wasn't so easy to acquire. Well mouse clip can be done without that, but borderless window can't. First I tried to create the window manually and giving the handle to Irrlicht, but this lead to many other troubles. In the end it was simply easier to modify Irrlicht itself.

Many modern games can be played in borderless "fullscreen" mode, where the application window occupies whole primary screen like it would be fullscreen. But alt-tab example wont change resolution etc. In this case, if you happen to have multiple monitors (like many people seem to have), mouse can easily "leak" on the other monitor(s) which is a big problem. This patch was meant to fix this. Personally I, and many other friends/gamers I know, like to use borderless mode since it is much easier to do other stuff when playing any game that has longer pauses in it.

My current trend in programming is in server side, networking and mobile platforms so I'm not a big expert in graphics/game stuff, only a hobbyist. These couple features were something that I needed in my hobby project. Seemed that quite a few people had been asking the same features, so I hope you can some day implement something similar into released version of Irrlicht :) Took me almost two days to get these two things working properly.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Borderless window and mouse clipping when not fullscreen

Post by hendu »

Just remember than a window mode is slower than a fullscreen one ;)

Under X you'd override the WM to get a borderless window. Mouse grabs are supported too.
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Borderless window and mouse clipping when not fullscreen

Post by REDDemon »

this is already possible in many crosso-platform windowing system. So is possible as well in irrlicht.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
aehparta
Posts: 3
Joined: Wed Feb 29, 2012 3:38 pm

Re: Borderless window and mouse clipping when not fullscreen

Post by aehparta »

hendu wrote:Just remember than a window mode is slower than a fullscreen one ;)

Under X you'd override the WM to get a borderless window. Mouse grabs are supported too.
With modern hardware and operating systems, you wont really notice the speed difference. Just to mention few popular ones, games like Starcraft 2, League of Legends and Left 4 Dead 2 work very fine without noticeable framedrop in windowed mode (though they are all windows only games).
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Borderless window and mouse clipping when not fullscreen

Post by hendu »

It's the difference between a page-flip and a blit, and you will notice it especially on low-end hw. In this interest, please make the option available to your users instead of forcing a window.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Borderless window and mouse clipping when not fullscreen

Post by CuteAlien »

aehparta wrote:Well mouse clip can be done without that, but borderless window can't.
Yeah, that's what I meant in short.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Borderless window and mouse clipping when not fullscreen

Post by REDDemon »

starcraft 2 will not run in low-end hardware infact :). I think that despite the performance problem many users will find less invasive a borderless window than a fullscreen window.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Borderless window and mouse clipping when not fullscreen

Post by hybrid »

And since such additions will not break the old behavior and features that we had before, there's no point in not adding this one.
livphi
Posts: 7
Joined: Tue Apr 16, 2024 10:10 pm

Re: Borderless window and mouse clipping when not fullscreen

Post by livphi »

I don't see a patch file attached to https://sourceforge.net/p/irrlicht/patches/232/ . Do you still have it, aehparta? This would be a great feature. On Linux you can press a button to make the Irrlicht window fullscreen borderless, on both X11 and Wayland. This is what I do with Minetest and my WIP game. There should be a way to make the Irrlicht window start fullscreen borderless.
n00bc0de
Posts: 55
Joined: Tue Oct 04, 2022 1:21 am

Re: Borderless window and mouse clipping when not fullscreen

Post by n00bc0de »

livphi wrote: Mon Oct 07, 2024 3:07 pm I don't see a patch file attached to https://sourceforge.net/p/irrlicht/patches/232/ . Do you still have it, aehparta? This would be a great feature. On Linux you can press a button to make the Irrlicht window fullscreen borderless, on both X11 and Wayland. This is what I do with Minetest and my WIP game. There should be a way to make the Irrlicht window start fullscreen borderless.
You can do it with SDL2. I have a custom SDL2 device in my own fork of irrlicht that you can pull if you want. The device itself does not handle any IO since I am handling all of that from my application.

https://github.com/n00b87/RCIrrlicht
Post Reply