I want to create a window of 850x650px. Every time I go to set the graphics mode, I see the window pop up, but it's filled with pink (and would segfault upon drawing if I didn't add an if in there). 850*650 isn't all that big, what's going on? Can only certain sizes be used?
1 | int main(int argc, char *argv[]){ |
2 | for (int i = 0; i < 256; i++){ |
3 | sysLines<i>.flags = 0; |
4 | sysLines<i>.height = 0; |
5 | } |
6 | |
7 | allegro_init(); |
8 | install_keyboard(); |
9 | install_timer(); |
10 | LOCK_VARIABLE(systime); |
11 | LOCK_FUNCTION(sysTimer); |
12 | install_int_ex(sysTimer, BPS_TO_TIMER(30)); |
13 | set_color_depth(desktop_color_depth()); |
14 | set_window_title("Level Editor"); |
15 | //THIS ALWAYS RETURNS -1 WITH 850 & 650 |
16 | if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 850, 650, 0, 0) == -1){ |
17 | allegro_message("Error"); |
18 | allegro_exit(); |
19 | return 0; |
20 | } |
21 | ... |
It's also worth noting I can't set anything bigger than 800*600 (or rather that's the smallest res it wants to set)
What's the resolution of your monitor set to? (althought that's a longshot...)
1024*768 (or wtv).
I tried to edit my post, but I couldn't shakes fist.
Anyways, I'm using DevC++ with MingW 3.1 and Allegro 2.0 (off the site, compiled this morning)
I've seen the pink screen before. I think you do have to use one of the standard screen sizes to avoid it. (640x480, 800x600, 1024x768, etc.)
(Just did a quick test on an existing project. Even though it drew properly, the pink was a visible flash when using an awkward screen size.)
Neither 850 nor 650 are multiples of 4, which IIRC, is a requirement of Windows. Though in that case, set_gfx_mode should be failing...
Windows creates weird window sizes all the time, another one of my programs does a small windowed weird size, however, it's like it can't get enough memory together or something, as if I did a window of like 320*325, I can do that.
I'd like to note that 1024*768 does not work windowed, but fullscreen it does.
Neither 850 nor 650 are multiples of 4, which IIRC, is a requirement of Windows.
That's a requirement of DirectX, not Windows itself. So, 848x648 will work, as well as 852x652, or any other combination of those numbers, but not 850x650...
If 850x650 is really required and speed of drawing is not very important, you could use the GDI driver...
I'd like to note that 1024*768 does not work windowed
You cannot create windows larger than or as large as the desktop.
But you can use fullscreen and have the thing you want.
There, a multiple of 2 fixed it, thanks!
Multiple of 4!!!
You cannot create windows larger than or as large as the desktop.
Can't you? I can't say that I've ever had this experience, although I do program under Linux. I say experience, and not problem, because there isn't actually a sensible reason why you would create a window that is bigger than the desktop resolution.
Can't you? I can't say that I've ever had this experience, although I do program under Linux.
Oh, under X you can. I don't know if it's a limitation in Windows or Allegro that prevents you from doing it in Windows - but it's not usually a good idea to do anyway.
SOrry Miran, that's what I ment
I can create just any size smaller than the Windows graphics mode, which is 1024*768*32.