|
allegro mouse distortion question |
kholdstayr
Member #7,575
August 2006
|
I am a complete Allegro newbie and I am trying to start making a simple Solitaire card game just to have some fun with Allegro. Anyway, I am having some troubles with the mouse cursor in Allegro. I have a simple program that just displays a screen with a black background and a green box. If I move the mouse cursor over the box the box gets erased by the mouse cursor, and turns black (which is the color of the area behind the box). I was thinking that the problem was that I wasn't hiding the mouse cursor properly, but I think I am doing it correctly. Here is my code:
I am using the sleep function just to have the graphics run for a few seconds so I can test the mouse out. It's not necessary at all. |
Kitty Cat
Member #2,815
October 2002
|
The mouse will be hidden automatically if it needs to be. Once you call show_mouse(screen); you can't call show_mouse again without losing the hardware cursor. -- |
kholdstayr
Member #7,575
August 2006
|
When I try it without the show_mouse(0) it makes it worse, and the mouse messes up even more. |
Richard Phipps
Member #1,632
November 2001
|
Change the last part of your code to this: show_mouse (screen); BITMAP* bmp = create_bitmap(640, 480); clear_to_color (bmp, makecol16(0,0,0)); rectfill(bmp, 150, 400, 230, 450, makecol16(0,255,0)); scare_mouse(); blit(bmp, screen, 0, 0, 0, 0, 640, 480); unscare_mouse();
|
Evert
Member #794
November 2000
|
Quote: #include <pc.h> What compiler are you using? |
kholdstayr
Member #7,575
August 2006
|
I am using DJGPP. |
Matthew Leverton
Supreme Loser
January 1999
|
DJGPP doesn't work right under Windows XP. |
kholdstayr
Member #7,575
August 2006
|
I fixed the problem. I didn't know about the individual graphics drivers you could load up, only the GFX_AUTODETECT. I did some searching and found out about the selection of video drivers for each platform. I tried loading up the GFX_VESA1 driver and now the mouse corruption problem went away. |
Matthew Leverton
Supreme Loser
January 1999
|
You worked around the problem for your installation of XP on your hardware, which is far from fixing it. If you plan to let other people running Windows XP use your project, then you need to switch to a Windows compiler. DOS applications can be coaxed to run on Windows XP, but usually not very well. They won't work at all on 64-bit versions. |
kholdstayr
Member #7,575
August 2006
|
I use DJGPP because my university computer science classes/professors use DJGPP actually. |
count
Member #5,401
January 2005
|
You should use Mingw. djgpp = gcc for dos IIRC. So it won´t be much of a change, but your games will work correct under windows
|
Kauhiz
Member #4,798
July 2004
|
Quote: my university computer science classes/professors use DJGPP You sure that they're really professors, and not just some random guy with a fake beard? --- |
kholdstayr
Member #7,575
August 2006
|
Yeah, we haven't needed anything else really besides DJGPP. For instance, if you are doing data structures like trees, linked lists, basic AI stuff like searching through mazes, sorting, hash functions, etc, you don't need fancy graphics or capabilities. Anyway, I took the time tonight to get MINGW installed, as I had some problems when I tried to get allegro working with it in the past. Well, I got Allegro successfully working with MINGW now so I will continue my solitaire game development using MINGW instead of djgpp. *EDIT* I have a Windows related question. If I want to run a Windows based Allegro program on another computer, what do I need to do? Is the Allegro library statically linked into the program or do I need to include a DLL if I want to run the program on another PC? |
count
Member #5,401
January 2005
|
Depends on the way you compiled allegro. If you make one change to your exefile, people only have to download the small exe file, because they already have the dll. Otherwise your exe will be bigger and the people will redownload the dll (in the exe) everytime they download the exe.
|
|