|
This thread is locked; no one can reply to it. |
1
2
|
Wide screen + Fullscreen + Allegro = ? |
Albin Engström
Member #8,110
December 2006
|
Running in 640x480 on a wide screen monitor results in pixels wider than high and it looks rather funny. But it's not funny anymore when you try to come up with a solution for the problem . so my question is: How would you solve this problem? |
William Labbett
Member #4,486
March 2004
|
Hey. I've had the same problem for ages but thought I couldn't explain it in words.
|
Kibiz0r
Member #6,203
September 2005
|
One solution would be to do it in widescreen mode, but still blit to the screen as if you were in 4:3, and center it so you get black bars to either side. --- |
Albin Engström
Member #8,110
December 2006
|
Sounds like an idyllic solution, then how would i do this? I've been trying some things, but since they obviously doesn't work I'll have you answer my question . Thanks! |
Kibiz0r
Member #6,203
September 2005
|
blit(buffer, screen, 0, 0, screen->w / 2 - buffer->w / 2, 0, buffer->w, buffer->h); Completely untested. Might be slow, might have artifacts where the black bars should be. --- |
William Labbett
Member #4,486
March 2004
|
widescreen is 16:9 so you can work out what to do from that.. Is there a way to detect a widescreen with allegro ?
|
Kibiz0r
Member #6,203
September 2005
|
get_desktop_resolution(int* width, int* height); if (h * 4 == w * 3) //4:3 aspect ratio else //16:9 or 16:10
--- |
Albin Engström
Member #8,110
December 2006
|
I have a bad feeling about this.. although i shouldn't right? Thanks |
Kibiz0r
Member #6,203
September 2005
|
Quote: I have a bad feeling about this.. although i shouldn't right? Oh no, you definitely should. Edit: This seems to work fine.
Edit2: Changed a line for ease-of-use. --- |
William Labbett
Member #4,486
March 2004
|
|
Albin Engström
Member #8,110
December 2006
|
What do you think about: My game depends on the hight (it's a vertical shooter) which is 480, the ideal thing to do would be to only change the width. but as far as i can tell that's not possible. I can't find any good resolution to fit my game in widescreen, large resolution isn't an option as allegro is software rendered. . |
Kibiz0r
Member #6,203
September 2005
|
Quote: My game depends on the hight (it's a vertical shooter) which is 480, the ideal thing to do would be to only change the width. Set up the buffer as normal then, and just do a stretchblit instead of a blit. Quote: allegro is software rendered. Since it's a vertical shooter, I'll assume you're using draw_sprite instead of something like pivot_sprite. In which case, Allegro can be a hardware renderer. Just use video bitmaps instead of memory ones. --- |
Albin Engström
Member #8,110
December 2006
|
Kibiz0r said: Set up the buffer as normal then, and just do a stretchblit instead of a blit. "normal"?? and what about triple buffering? Kibiz0r said: Since it's a vertical shooter, I'll assume you're using draw_sprite instead of something like pivot_sprite. In which case, Allegro can be a hardware renderer. Just use video bitmaps instead of memory ones. Yes, i've heard about that, but never tried it. what about litting and transparent drawing?, if i lit a sprite from video memory to video memory, won't that require more power than from memory to video?.. or am i totaly lost? |
Kibiz0r
Member #6,203
September 2005
|
Quote: if i lit a sprite from video memory to video memory, won't that require more power than from memory to video? I think so, but don't hold me to that. Quote: "normal"?? and what about triple buffering? Normal: create_bitmap(640, 480) Triple buffering: Would be if you were using video memory. --- |
Kris Asick
Member #1,424
July 2001
|
Here's a neat trick. Most widescreen monitors support standard vertical resolutions, so when running full-screen just start with 960x480 or something ridiculous and just keep scaling the first number back until set_gfx_mode() finally succeeds. For example: for (z = 960; z >= 640; z--) if (!set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,z,480,0,0)) break; if (screen == NULL) { /* Unable to set any graphics mode */ }
--- Kris Asick (Gemini) --- Kris Asick (Gemini) |
Richard Phipps
Member #1,632
November 2001
|
Won't that cause flickering and slow-down as the monitor attempts to open a non-existant mode? |
gnolam
Member #2,030
March 2002
|
Kris: That's a horrible idea, and you should be subjected to a public beating for even suggesting it. Have you any idea of what that kind of resolution setting abuse would do to my poor monitor? -- |
spellcaster
Member #1,493
September 2001
|
Well, you could also check the list of available modes reported by allegro -- |
William Labbett
Member #4,486
March 2004
|
|
Tobias Dammers
Member #2,604
August 2002
|
Graphics editors are generally windowed applications, and as such, will automatically use the desktop resolution. If the user has set it to something sensible (read: a widescreen resolution), then pixels are still square and everything looks fine. You just have a wider working area. Widescreen only causes trouble when you decide to override the desktop resolution and set a different one. BTW, I think widescreens are the most stupid invention ever made. I use my computer for editing all sorts documents, and 95% of these have one thing in common: they are taller than wide, so the closer the aspect ratio comes to 1 : sqrt(2), the happier I am. --- |
Kris Asick
Member #1,424
July 2001
|
Quote: Won't that cause flickering and slow-down as the monitor attempts to open a non-existant mode?
Quote: Kris: That's a horrible idea, and you should be subjected to a public beating for even suggesting it. Have you any idea of what that kind of resolution setting abuse would do to my poor monitor?
Ok, I tested that code just to see for myself what would happen. Yes, there was flickering for half a minute as the Allegro window appeared and disappeared rapidly, but short of that it worked. So it does work, it's just not practical. However, using any autodetect method for widescreen by default is bad because many non-widescreen monitors can actually display widescreen resolutions. So it's good to ask a user on first run of a program, or as suggested, to figure out if the desktop res is a wide-screen resolution or not. --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: If a full-screen mode doesn't exist, there's no way for the monitor to actually switch into anything. The monitor driver knows what's valid and what isn't Heh. You'd like to think so. But many monitors report incorrect modes and resolutions, and miss some valid ones, etc. And yes, you can set invalid modes for monitors, then they go into "sleep" mode with a message saying "you fucked up". Or even worse, some will display some weird ass shit till the mode is changed back. Quote: However, using any autodetect method for widescreen by default is bad because many non-widescreen monitors can actually display widescreen resolutions. Sure, but the monitors aspect ratio is still 4:3, which means that widescreen res is squished quite a bit. -- |
Runesabre
Member #7,573
August 2006
|
Is there a way to programmatically determine the aspect ratio of the monitor? get_desktop_resolution() relies on the player having set a proper resolution. _______________ |
StevenVI
Member #562
July 2000
|
Quote: get_desktop_resolution() relies on the player having set a proper resolution. If the user can't set a proportional resolution on their computer then they probably won't realize that the game they're playing looks like poo. My girlfriend's laptop is widescreen and I was programming on it the other night when I noticed the neat effect of which this thread is about. It didn't hinder gameplay, just made things look kinda funny. I say this as a backup to my argument. The user who's resolution is improperly set is probably already aware that their computer is retarded and have submitted to their fate of everything stretched. __________________________________________________ |
weapon_S
Member #7,859
October 2006
|
Actually I once did the opposite: set an widescreen resolution on a normal monitor. |
|
1
2
|