-"fixed" warning about vars being used uninitialized (may happen if mouse cursor is totally offscreen or screen resolution is 0 pixel height, that is, never).
-Put some cursor drawing loops in the right order (loop on y, then on x) to make them a little more cache-friendly (and easier to read). I wrote them the wrong way, sorry! -Some code formatting to 80 columns (not really important, don't worry about it) -Added a sample neochrome picture to the pic-samples folder. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@923 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
9d0c73b5be
commit
8b5681eccb
BIN
pic-samples/BALLOONS.NEO
Normal file
BIN
pic-samples/BALLOONS.NEO
Normal file
Binary file not shown.
54
windows.c
54
windows.c
@ -1604,7 +1604,7 @@ void Display_cursor(void)
|
|||||||
short end_y;
|
short end_y;
|
||||||
short x_pos;
|
short x_pos;
|
||||||
short y_pos;
|
short y_pos;
|
||||||
short counter_x;
|
short counter_x = 0;
|
||||||
short counter_y;
|
short counter_y;
|
||||||
int temp;
|
int temp;
|
||||||
byte color;
|
byte color;
|
||||||
@ -1652,12 +1652,14 @@ void Display_cursor(void)
|
|||||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||||
|
|
||||||
for (x_pos=start_x,counter_x=0;counter_x<15 && x_pos < Screen_width;x_pos++,counter_x++)
|
for (y_pos=start_y,counter_y=0; counter_y<15 && y_pos < Screen_height;
|
||||||
|
y_pos++,counter_y++)
|
||||||
|
{
|
||||||
|
if( y_pos < 0 ) continue;
|
||||||
|
for (x_pos=start_x,counter_x=0;
|
||||||
|
counter_x<15 && x_pos < Screen_width; x_pos++,counter_x++)
|
||||||
{
|
{
|
||||||
if( x_pos < 0 ) continue;
|
if( x_pos < 0 ) continue;
|
||||||
for (y_pos=start_y,counter_y=0;counter_y<15 && y_pos < Screen_height;y_pos++,counter_y++)
|
|
||||||
{
|
|
||||||
if( y_pos < 0 || y_pos >= Screen_height) continue;
|
|
||||||
color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
|
color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
|
||||||
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||||
if (color!=MC_Trans)
|
if (color!=MC_Trans)
|
||||||
@ -1721,14 +1723,14 @@ void Display_cursor(void)
|
|||||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||||
|
|
||||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
|
||||||
{
|
|
||||||
if(x_pos<0) continue;
|
|
||||||
if(x_pos>=Screen_width) break;
|
|
||||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||||
{
|
{
|
||||||
if(y_pos<0) continue;
|
if(y_pos<0) continue;
|
||||||
if(y_pos>=Screen_height) break;
|
if(y_pos>=Screen_height) break;
|
||||||
|
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||||
|
{
|
||||||
|
if(x_pos<0) continue;
|
||||||
|
if(x_pos>=Screen_width) break;
|
||||||
color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
|
color=Gfx->Cursor_sprite[temp][counter_y][counter_x];
|
||||||
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
|
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
|
||||||
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||||
@ -1750,14 +1752,14 @@ void Display_cursor(void)
|
|||||||
case CURSOR_SHAPE_HOURGLASS :
|
case CURSOR_SHAPE_HOURGLASS :
|
||||||
start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
|
start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
|
||||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
|
start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
|
||||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
|
||||||
{
|
|
||||||
if(x_pos<0) continue;
|
|
||||||
if(x_pos>=Screen_width) break;
|
|
||||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||||
{
|
{
|
||||||
if(y_pos<0) continue;
|
if(y_pos<0) continue;
|
||||||
if(y_pos>=Screen_height) break;
|
if(y_pos>=Screen_height) break;
|
||||||
|
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||||
|
{
|
||||||
|
if(x_pos<0) continue;
|
||||||
|
if(x_pos>=Screen_width) break;
|
||||||
color=Gfx->Cursor_sprite[shape][counter_y][counter_x];
|
color=Gfx->Cursor_sprite[shape][counter_y][counter_x];
|
||||||
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
|
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
|
||||||
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
|
||||||
@ -1908,14 +1910,11 @@ void Hide_cursor(void)
|
|||||||
int start_y;
|
int start_y;
|
||||||
short end_x;
|
short end_x;
|
||||||
short end_y;
|
short end_y;
|
||||||
int x_pos;
|
int x_pos = 0;
|
||||||
int y_pos;
|
int y_pos;
|
||||||
short counter_x;
|
short counter_x = 0;
|
||||||
short counter_y;
|
short counter_y;
|
||||||
//short end_counter_x; // Position X ou s'arrête l'affichage de la brosse/pinceau
|
|
||||||
//short end_counter_y; // Position Y ou s'arrête l'affichage de la brosse/pinceau
|
|
||||||
int temp;
|
int temp;
|
||||||
//byte color;
|
|
||||||
float cos_a,sin_a;
|
float cos_a,sin_a;
|
||||||
short x1,y1,x2,y2,x3,y3,x4,y4;
|
short x1,y1,x2,y2,x3,y3,x4,y4;
|
||||||
|
|
||||||
@ -1960,10 +1959,11 @@ void Hide_cursor(void)
|
|||||||
|
|
||||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||||
{
|
{
|
||||||
|
if(y_pos < 0) continue;
|
||||||
if(y_pos>=Screen_height) break;
|
if(y_pos>=Screen_height) break;
|
||||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||||
{
|
{
|
||||||
if ( (x_pos<0) || (y_pos < 0)) continue;
|
if(x_pos < 0) continue;
|
||||||
else if (x_pos>=Screen_width) break;
|
else if (x_pos>=Screen_width) break;
|
||||||
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
||||||
}
|
}
|
||||||
@ -2026,14 +2026,14 @@ void Hide_cursor(void)
|
|||||||
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
start_x=Mouse_X-Gfx->Cursor_offset_X[temp];
|
||||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
start_y=Mouse_Y-Gfx->Cursor_offset_Y[temp];
|
||||||
|
|
||||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
|
||||||
{
|
|
||||||
if(x_pos<0) continue;
|
|
||||||
if(x_pos>=Screen_width) break;
|
|
||||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||||
{
|
{
|
||||||
if(y_pos<0) continue;
|
if(y_pos<0) continue;
|
||||||
if(y_pos>=Screen_height) break;
|
if(y_pos>=Screen_height) break;
|
||||||
|
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||||
|
{
|
||||||
|
if(x_pos<0) continue;
|
||||||
|
if(x_pos>=Screen_width) break;
|
||||||
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2054,14 +2054,14 @@ void Hide_cursor(void)
|
|||||||
start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
|
start_x=Mouse_X-Gfx->Cursor_offset_X[shape];
|
||||||
start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
|
start_y=Mouse_Y-Gfx->Cursor_offset_Y[shape];
|
||||||
|
|
||||||
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
|
||||||
{
|
|
||||||
if(x_pos<0) continue;
|
|
||||||
if(x_pos>=Screen_width) break;
|
|
||||||
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
|
||||||
{
|
{
|
||||||
if(y_pos<0) continue;
|
if(y_pos<0) continue;
|
||||||
if(y_pos>=Screen_height) break;
|
if(y_pos>=Screen_height) break;
|
||||||
|
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
|
||||||
|
{
|
||||||
|
if(x_pos<0) continue;
|
||||||
|
if(x_pos>=Screen_width) break;
|
||||||
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user