Mail Archives: djgpp/1999/03/06/15:51:05
From: | tmurez AT nospam DOT planete DOT net (Thibaut Murez)
|
Newsgroups: | comp.os.msdos.djgpp,comp.os.msdos.programmer
|
Subject: | Problem with Mouse cursor
|
Date: | Sat, 6 Mar 1999 20:25:43 +0100
|
Organization: | Planete.net, France
|
Lines: | 47
|
Message-ID: | <MPG.114b9f768fe146869896b2@news>
|
NNTP-Posting-Host: | numeris-bdx-4.planete.net
|
X-Newsreader: | MicroPlanet Gravity v2.10
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi
I'm making a game using djgpp and nasm(using DOS). I built my images in a
buffer and then i move my buffer to my VESA 640*480*16bits banked screen.
As it's a wargame i need a mouse and i've succedeed (don't remember the
spelling) into using it. My only problem is that i can't draw a cursor
without having sheat following my cursor, as if my function (called by
the mouse driver) didn't erase the cursor from my buffer before drawing
it at a new place ! I don't understand either why this problem doesn't
appear at all when my mouse moves left or up, why it appears a little
when it moves right and A LOT when it moves down !!!!!!
please help me !!! this is my drawcursor function called by the mouse
driver (the main loop of my game only moves buffer to screen at the
moment)
void DrawCursr(MOUSE_INT_ARGS) //arguments i defined : position and
//buttons state
{
int x, y, ox, oy;
if(Souris.AfficheCurseur) //if cursor has to be displayed
{
for(int h=0;h<32;h++)
{
for(int j=0;j<32;j++)
{
ox=Souris.OldX+j;
oy=Souris.OldY+h;
VirtualScreen[oy*640+ox]=Souris.SousCurseur[h*32+j];
//restore background
//VirtualScreen is my offscreen buffer
//Souris is my mouse class
//Souris.SousCurseur is a 32*32*16bits memory block used to save my
//cursor background
x=X+j;
y=Y+h;
//save background
Souris.SousCurseur[h*32+j]=VirtualScreen[y*640+x];
//draw cursor (65086 is the color i use for transparency)
//Souris.Curseur is a 32*32*16bits memory block containing my cursor's
//pixels (the color to be displayed or 65086 not to be displayed)
if(Souris.Curseur[h*32+j]!=65086 && x<640 && y<480)
VirtualScreen[y*640+x]=Souris.Curseur[h*32+j];
}
}
}
}
- Raw text -