|
Allegro and multitasking |
pav0
Member #4,447
March 2004
|
I wrote a game using Allegro for graphics and libnet for networking and it seems to have a serious problem with multitasking. When I run in Windows (98) two instances of the program, only the one on foreground seems to work. When both windows are 'unfocused', they work, but they're both updating screen very slowly. (I'm setting switch_mode to BACKGROUND/BACKAMNESIA in Allegro, and I put rest(0) in the main game loop, like the manual advises). |
ReyBrujo
Moderator
January 2001
|
Allegro always tries to use 100% of CPU. You need to call rest(1); inside your main loop to get a lower CPU usage. As for foreground only working, see set_display_switch_mode. (Edited: It is rest(1), rest(0) yields CPU, which is something you don't want. As for SWITCH, set it AFTER setting the graphics mode, not before. Also, see Kitty Cat comment). -- |
A J
Member #3,025
December 2002
|
rest(0) is saying to the scheduler, i'll rest if you have something else to do, else i'll continue. rest(1) says to teh scheduler, i will rest 1 millisecond. ___________________________ |
pav0
Member #4,447
March 2004
|
I changed the call to rest(1) and now it works well. Thanks for advice. |
|