Issue 257: In the Paintbrush selection screen, outline the current brush
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1478 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
a29c025156
commit
f686d8a951
@ -2719,6 +2719,26 @@ void Button_Unselect_fill(void)
|
|||||||
|
|
||||||
//---------------------------- Menu des pinceaux -----------------------------
|
//---------------------------- Menu des pinceaux -----------------------------
|
||||||
|
|
||||||
|
/// Checks if the current brush is identical to a preset one.
|
||||||
|
byte Is_paintbrush(byte index)
|
||||||
|
{
|
||||||
|
if (Paintbrush_shape!=Gfx->Paintbrush_type[index] ||
|
||||||
|
Paintbrush_width!=Gfx->Preset_paintbrush_width[index] ||
|
||||||
|
Paintbrush_height!=Gfx->Preset_paintbrush_height[index])
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (Paintbrush_shape==PAINTBRUSH_SHAPE_MISC)
|
||||||
|
{
|
||||||
|
// Check all pixels
|
||||||
|
int x,y;
|
||||||
|
for(y=0;y<Paintbrush_height;y++)
|
||||||
|
for(x=0;x<Paintbrush_width;x++)
|
||||||
|
if(Paintbrush_sprite[(y*MAX_PAINTBRUSH_SIZE)+x]!=Gfx->Paintbrush_sprite[index][y][x])
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void Button_Paintbrush_menu(void)
|
void Button_Paintbrush_menu(void)
|
||||||
{
|
{
|
||||||
short clicked_button;
|
short clicked_button;
|
||||||
@ -2736,6 +2756,10 @@ void Button_Paintbrush_menu(void)
|
|||||||
x_pos=13+(index%12)*24;
|
x_pos=13+(index%12)*24;
|
||||||
y_pos=27+(index/12)*25;
|
y_pos=27+(index/12)*25;
|
||||||
Window_set_normal_button(x_pos ,y_pos ,20,20,"",0,1,SDLK_LAST);
|
Window_set_normal_button(x_pos ,y_pos ,20,20,"",0,1,SDLK_LAST);
|
||||||
|
// Highlight selected brush
|
||||||
|
if (Is_paintbrush(index))
|
||||||
|
Window_rectangle(x_pos,y_pos,20,20,MC_White);
|
||||||
|
|
||||||
Display_paintbrush_in_window(x_pos+2,y_pos+2,index);
|
Display_paintbrush_in_window(x_pos+2,y_pos+2,index);
|
||||||
}
|
}
|
||||||
for (index=0; index<BRUSH_CONTAINER_COLUMNS*BRUSH_CONTAINER_ROWS; index++)
|
for (index=0; index<BRUSH_CONTAINER_COLUMNS*BRUSH_CONTAINER_ROWS; index++)
|
||||||
|
|||||||
@ -1291,7 +1291,8 @@ void Display_paintbrush_in_window(word x,word y,int number)
|
|||||||
|
|
||||||
for (window_y_pos=0,y_pos=0; y_pos<Gfx->Preset_paintbrush_height[number]; window_y_pos++,y_pos++)
|
for (window_y_pos=0,y_pos=0; y_pos<Gfx->Preset_paintbrush_height[number]; window_y_pos++,y_pos++)
|
||||||
for (window_x_pos=0,x_pos=0; x_pos<Gfx->Preset_paintbrush_width[number]; window_x_pos++,x_pos++)
|
for (window_x_pos=0,x_pos=0; x_pos<Gfx->Preset_paintbrush_width[number]; window_x_pos++,x_pos++)
|
||||||
Block(origin_x+window_x_pos*x_size,origin_y+window_y_pos*y_size,x_size,y_size,(Gfx->Paintbrush_sprite[number][y_pos][x_pos])?MC_Black:MC_Light);
|
if (Gfx->Paintbrush_sprite[number][y_pos][x_pos])
|
||||||
|
Block(origin_x+window_x_pos*x_size,origin_y+window_y_pos*y_size,x_size,y_size,MC_Black);
|
||||||
// On n'utilise pas Pixel_in_window() car on ne dessine pas
|
// On n'utilise pas Pixel_in_window() car on ne dessine pas
|
||||||
// forcément avec la même taille de pixel.
|
// forcément avec la même taille de pixel.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user