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: 9628
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: 9628
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.
Post Reply