A5 - Fullscreen in Linux Mint
PeKaGM

Hi Allegro folks. I'm trying to rewrite my program from Allegro 4.4 to Allegro 5 and I'm stuck on one serious problem. When I try to set fullscreen mode with something like this

al_set_new_display_flags(ALLEGRO_FULLSCREEN);
display = al_create_display(1024,768);
if (!display)
return -1;

I will get fullscreen mode , I can draw and everything but there is still visible bottom panel from Linux on top of everything(see attachment in this post).That panel is not active -mouse clicks dont do anything but I can't get that panel out of my screen.I use Linux Mint 17 Cinnamon, Codeblocks, Allegro 5 from repositaries and drivers for Nvidia (nvidia-331).My resolution for display in Linux is set on 1024x768 too.What's wrong Allegro or something in Linux Mint? Is there a way to get a fullscreen mode without visible bottom panel? I also tried ALLEGRO_FULLSCREEN_WINDOW and in this case is everything ok for 1024x768 but I want to use lover resolutions in the future and with ALLEGRO_FULLSCREEN_WINDOW it not seems like a good idea.Thanks for any answers.

beoran

This is a bug, but I don't quite know how to fix it.

Nowadays, with GPUs being as they are, you will probably use a virtual resolution (e.g. of 640x480) and let the GPU upscale that for you to whatever resolution the desktop of the user has. This is called "resolution independence". So it's less critical to use ALLEGRO_FULLSCREEN, and ALLEGRO_FULLSCREEN_WINDOW can be used perfectly if you achieve resolution independence.

See https://wiki.allegro.cc/index.php?title=Achieving_Resolution_Independence for a bit more info on how to do this.

Gideon Weems

I concur with beoran: Using ALLEGRO_FULLSCREEN_WINDOWED with a buffer is a good way of handling lower resolutions. Simply stretch blit the buffer, and you have your full screen.

Another advantage of A_F_W is speed.

Thomas Fjellstrom

In Allegro 5, skip the buffer and just use transformations.

One word of caution, the ALLEGRO_FULLSCREEN driver isn't great, but i don't think it's entirely allegro's fault. I've tried (and others have tried) to make it work identically in all circumstances with all window managers, but it seems it is impossible.

In particular, any WM based on Compiz is just going to be broken, and not work right in general. I think metacity had issues when I last checked, but I can't remember for sure.

These days with everyone using LCDs, you really don't have more than one available resolution anyhow, so you're better off with ALLEGRO_FULLSCREEN_WINDOW and a transform.

Gideon Weems

In Allegro 5, skip the buffer and just use transformations.

Hey, thanks! That's a good tip. All you have to do is this, right?

al_scale_transform (al_get_current_transform(), uScreenW / uBufW, uScreenH / uBufH);

How'd you get so good at Allegro, anyway?

Thomas Fjellstrom

How'd you get so good at Allegro, anyway?

I spend far too much time on the internet. :( (I also helped write the X port...)

Arthur Kalliokoski

I spend far too much time on the internet.

Isn't that the way to not get good at something? i.e. wasting time.

beoran

The way to get good at programming is by programming a lot, andt he by to get good at using allegro is by using allegro a lot. That's all, really.

Thomas Fjellstrom

Isn't that the way to not get good at something? i.e. wasting time.

You can soak up a lot of trivia though ;)

beoran said:

andt he by to get good at using allegro is by using allegro a lot. That's all, really.

Sadly I don't use allegro much anymore. My current active personal projects aren't games. I do want to get back into my game projects though... but I have no idea when I'll get back to them.

PeKaGM

Thanks to all. Now I see that it's the best way for me - use ALLEGRO_FULLSCREEN_WINDOW and transformations. I just need to find proper scale value with lover resolutions and it's fullscreen :). I still wonder how this will look when I transform my program from 320x240,640x480 or 800x600 to 1024x768 or even higher resolutions, if I dont lost "pixel clean" feeling.Worst sitiuation will be with widescreen monitors and their resolutions like 1280x800.In this case I can get scale value 1.66666.... and this must be distorted. I need to do more tests and see the results. Anyhow thanks again.

Thomas Fjellstrom

You can always scale 1:1 and letterbox to avoid distortion.

Gideon Weems

Ah, letterboxing... I suppose adding an al_translate_transform() would take care of that.

On a somewhat different note, I can't help but wonder whether this...

al_transform_identity
al_transform_build
al_transform_translate
al_transform_rotate

... is preferable to current names...

... as the former is more uniform. Uniformity helps, for example, when autocompleting functions, as the user would only have to remember "al_transform_" (realistically speaking, "al_tr" would probably be enough).

Does the unstable branch allow such changes?

Thomas Fjellstrom

Does the unstable branch allow such changes?

It allows adding aliases, but we can't whole-sale remove large chunks of api that exist in previous stable releases.

A long discussion was had on the naming scheme for Allegro 5, and it was decided that it was going to be al_verb_noun. To be honest I prefer noun_verb but we have what we have.

beoran

Yes, it's al_verb_noun. It may sometimes be a bit harder to do autocompletion, but it reads more like English, and it is consistent. A combination al_noun_verb tends to be less legible when when you have more than just noun and verb.

For example al_get_haptic_from_joystick reads smoothly as "Get haptic from joystick" while something like al_haptic_get_from_joystick leads to "Haptic get from joystick" which is ungrammatical English.

Gideon Weems

Interesting... I figured the topic probably came up at some point. Though I do prefer naming from general to specific (which is why we have al_ and not _al), I'm more happy that a decision has been made than anything.

I also see nothing that precludes someone from maintaining an "add-on" of aliases.

beoran

Personally I like the Allegro naming convention it is a distinguishing feature of the Allegro API.

But I wouldn't be against someone writing a header file with alias macros, but with the clear distinction that these are not part of the official api and are for convenience only. And that header file would need to be written according to consistent rules so it's clear how long function names like al_get_haptic_from_joystick will be mapped.

Thread #614387. Printed from Allegro.cc