|
This thread is locked; no one can reply to it. |
1
2
|
My game doesn't work on Windows |
James Stanley
Member #7,275
May 2006
|
OK, I have done a fair amount of my game and have just got to collision detection. It was working but I changed something and I'll have to fix it again. But anyway, I ran it on Windows and it sometimes works, and sometimes it doesn't draw anything in the window until I move it. It only updates the picture when I move the window. Does anybody know what could cause this? I'd like to have a Windows port so this is fairly important. Hopefully somebody has had this problem and fixed it...? |
Marco Radaelli
Member #3,028
December 2002
|
No idea, but I would help if you provide versions of everything (Allegro, static? dynamic?, compiler, compiler command, etc.)
|
James Stanley
Member #7,275
May 2006
|
Allegro 4.2.0 Static linked EDIT: |
Kris Asick
Member #1,424
July 2001
|
If it sometimes draws to the screen and sometimes doesn't and almost seems to be random then my best guess is you're not drawing to the screen properly. I know, since it probably works on the other OS you're designing for that may not seem right, but Windows does some strange things when it comes to the screen and as a result, your code which works in one OS may not work in Windows. Could you post a segment of your code showing just a little before the actual draw to the screen and just a little after? I'm going to guess that you're doing something like this: do { clear_bitmap(screen); vsync(); // Game Code Goes Here blit(back_buffer,screen,0,0,0,0,screen->w,screen->h); } while (gameloop_active);
--- Kris Asick (Gemini) --- Kris Asick (Gemini) |
James Stanley
Member #7,275
May 2006
|
while(!quit) { if(counter >= 5) { //Simple timing ;) //Game counter = 0; draw_sprite(canvas, cursor[pointer], mouse_x, mouse_y); draw_sprite(screen, canvas, 0, 0); clear_bitmap(canvas); } } I have a timer callback, before you ask |
BAF
Member #2,981
December 2002
|
Why do people insist on using draw_sprite to draw to the screen? I never get that myself. |
asamsharaz
Member #7,831
October 2006
|
I read something about making sure you use acquire_screen() and release_screen() functions before and after drawing to the screen? Well I use it for window programs in Allegro
|
LennyLen
Member #5,313
December 2004
|
Quote: I read something about making sure you use acquire_screen() and release_screen() functions before and after drawing to the screen? You don't need these functions, but they can help speed up drawing.
|
Michael Faerber
Member #4,800
July 2004
|
I had a problem like this on a really crappy laptop once. Try it on another computer, I'm quite sure that it will work. -- |
Richard Phipps
Member #1,632
November 2001
|
First check if the allegro examples or other allegro programs have the same problem. |
James Stanley
Member #7,275
May 2006
|
BAF, sorry if it offended you EDIT: |
gnolam
Member #2,030
March 2002
|
They do. acquire/release are almost never needed, even to speed things up. -- |
James Stanley
Member #7,275
May 2006
|
So what's the point in me calling them? |
Kitty Cat
Member #2,815
October 2002
|
When you draw to the same bitmap multiple times in a row. -- |
James Stanley
Member #7,275
May 2006
|
Oh. OK. |
Kris Asick
Member #1,424
July 2001
|
Is canvas a memory bitmap, made with create_bitmap(), or a video bitmap made with create_video_bitmap()? If the later, then what's happening is canvas and screen are ending up using the SAME memory! Thus when you clear canvas, you clear the screen, and the pause between due to your timing routine is making the screen show up clear. Simply use create_bitmap() on your canvas object instead of create_video_bitmap(). And if you only ever make one draw to the screen, there's no point calling the acquire and release commands because Allegro will do it for you. You only need to call them if you plan to do multiple video-bitmap operations in one go. --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
James Stanley
Member #7,275
May 2006
|
Just a normal memory bitmap, I've never really got the hang of video bitmaps |
Kris Asick
Member #1,424
July 2001
|
Waitaminute... You say it only updates the picture when you move the window. Does that mean the previous frame is still shown when you stop moving the window? --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
James Stanley
Member #7,275
May 2006
|
Yeah. I guess I should have been more specific. |
Kris Asick
Member #1,424
July 2001
|
Three more questions to narrow this issue down:
I recommend you try running some other Allegro-driven games from the depot to see if the problem is limited to your own code or not. If other Allegro games are causing problems, it's likely nothing to do with your code and everything to do with your system configuration. (IE: Outdated drivers, background applications sucking resources dry, etc.) --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
James Stanley
Member #7,275
May 2006
|
1.) It updates but doesn't draw I'll try some other allegro stuff. I can't do anything about drivers though, they're schools computers. |
Kris Asick
Member #1,424
July 2001
|
If it's not running full-screen when you're telling it to then you're probably requesting a video mode that isn't standard, either because of a bad resolution or a colour depth the video card can't handle. Good resolutions that work on just about any computer are 320x200, 640x480 and 800x600. 8-bit colour depth will work on anything, 16 and 32 bit will work on most things, but not really old systems, and 15 and 24 bit are fairly uncommon and sporadically work on some systems and not on others. Start with trying to use a more normal resolution and see if that helps run full-screen. If you are... well... Depending on the school, especially if we're talking pre-college level, the computers there could be EXTREMELY outdated and would not make a good development or testing platform. You really ought to find a more personal locale to do your programming, either at home, a friend's house, somewhere where the computer can be kept up to date. --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
James Stanley
Member #7,275
May 2006
|
640x480x24. The 24 might be the problem. I'll change it to 32 and see what happens. It is pre-college but the computers are fairly new (they upgrade about once every two to three years), but I'll see how it runs on friends computers. |
Richard Phipps
Member #1,632
November 2001
|
Add checks to try 24 bit if 32 bit fails (and to use 15 bit if 16 bit fails). |
James Stanley
Member #7,275
May 2006
|
OK. I'll do that now. |
|
1
2
|