Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How to create a window-frame less game?

This thread is locked; no one can reply to it. rss feed Print
How to create a window-frame less game?
Doctor Cop
Member #16,833
April 2018
avatar

I was wondering how are these modern web frameworks are able to create frame less windows like in WPF and Electron.

I want to create my Game with frameless window. What are the procedures and is there any compiler quirks to set icon for Executable? If not then is there a way I can set icon without approaching Platform specifics?

MiquelFire
Member #3,110
January 2003
avatar

IMO, don't make a frameless window for a game. If you don't add in the features that the frame gives you for free, people who want to play your game in a window may not like that they can't move the window to where they want. Also, if your game crashes for some reason, they may need to use their task manager to close the game when they could just hit the close button on the window itself.

Either way, it depends on what you're making your game with. I'm going to assume Allegro 5 for the rest of the post.

The function al_set_new_display_flags does have an ALLEGRO_FRAMELESS option, so along with the other options, you just add that to the bitmask. ALLEGRO_FULLSCREEN_WINDOW might be what you really want though. The window is fullscreen, but you can easily switch out of the game without causing too many issues that plain fullscreen could cause.

The icon for the window requires you to call al_set_display_icon at some point, otherwise, the icon in the taskbar may be the default icon.

If you're not using Allegro, you need to tell us what you're using.

The icon for the executable is platform specific, so the Windows icon I know is bundled with the file, though I don't know what you're using to compile it, so I'm not going to look it up (Visual Studio is kinda different than it is for Mingw for example), I don't know Mac, and I don't know if Linux even allows that (my Linux use is limited to web servers, so I only deal with the command line, so icons don't matter anyway). I know that Electron, unless you want to compile it yourself, requires some hacking of the Electron executable to change, which you could do with the executable you compile yourself anyway.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Doctor Cop
Member #16,833
April 2018
avatar

I'm using Windows OS and compiler is MinGW TDM GCC.
I thought that there is some compiler command which can add icon to the executable.
I'm talking about the icon which appears in the shortcuts at Desktop not on top of the frame.

I get it that its bad for a game to be frameless but if I make an Application which doesn't use drag for UI components then how to do it?

Edit:
Never mind. I found that it can be easily done with the help of RC file.

MiquelFire
Member #3,110
January 2003
avatar

If the main window is not draggable, people will hate it.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Chris Katko
Member #1,881
January 2002
avatar

If the main window is not draggable, people will hate it.

In general, yes.

But contrary to that:

- Borderless windowed mode is an almost expected feature these days because it has better alt-tab support.

Also FYI:

- You can intentionally get framed (no title) windows using DxWnd for any game.

- You can use tools like DxWnd to add back the title, or, forcibly change the window size.

Again, in general, I agree. Any game that just always does that will almost immediately get perma-banned from my games list.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Doctor Cop
Member #16,833
April 2018
avatar

So chris, what you want to say is that Frame less games are bad and frame less Apps are future?

So I can and make Apps framelees if I can make them drag-able and should not make any game frameless unless I have a really good reason to do so?

Thank you all for you advice, I'll keep that in mind if it's exactly what you mean.
I don't want to mess up every time and then learn from it only to get realization that it was a bad idea.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you're talking about the picture in picture mode youtube has on my android, then sure its great, sometimes. It lets me do other things on an other wise non multi tasking os at the same time.

But otherwise, most apps run in full screen or fs window mode. FS window mode is best because of Alt-Tab support, and being able to easily switch in and out of your window.

MiquelFire
Member #3,110
January 2003
avatar

Taking about windowed mode, not full screen.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Chris Katko
Member #1,881
January 2002
avatar

Doctor Cop: I'm not saying you should do anything, I'm merely giving background.

But in general, it's considered "hijacking" the OS if you don't let the user control a window (with the exception of fullscreen). However, borderless windowed mode IS essentially the same thing except the window is the width of the screen and in that case it's considered acceptable.

Mechanically it may seem like an anachronism but in terms of user experience, they're not. "Borderless windowed" is seen as "fullscreen except alt-tab actually works."

Of course, one new problem with borderless windowed is you can't use a lower display resolution than the screen (unless you manually upscale it which some engines do). That becomes an issue on some modern computers. For example, I have a 4K screen but I can't play most games in 4K with my videocard and CPU setup. Not a deal-breaker but it's something to consider.

Anyhow, the topic tile is creating a window with no frame and that's USUALLY a bad thing because if it goes bad, a user can't move it, and a user can't close it without task manager (a big NO NO of a requirement).

But if you're dead set on it, mechanically just Google the stack overflow for it. It's pretty easy to set the window modal style in Windows (And most likely the same in Mac OS X and Linux).

https://docs.microsoft.com/en-us/windows/desktop/winmsg/window-styles

https://stackoverflow.com/questions/34462445/fullscreen-vs-borderless-window

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

He was talking about Apps, hence the change in topic to phones and fs window, which is just a frameless window set to stay on top btw. ;)

Go to: