Skip to content

Commit

Permalink
#1225: icon pos fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nesbox committed Oct 28, 2020
1 parent 0f90152 commit 1de3b1c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 45 deletions.
79 changes: 39 additions & 40 deletions src/studio/editors/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,20 @@ static void drawBankButtons(Map* map, s32 x, s32 y)

static const u8 Icons[] =
{
0b11111000,
0b10101000,
0b11111000,
0b10101000,
0b11111000,
0b01010100,
0b00000000,
0b01010100,
0b00000000,
0b01010100,
0b00000000,
0b00000000,
0b00000000,

0b10101000,
0b11111000,
0b01110000,
0b01110000,
0b01010000,
0b00111000,
0b01010100,
0b01111100,
0b01000100,
0b00111000,
0b00000000,
0b00000000,
0b00000000,
Expand Down Expand Up @@ -431,42 +431,39 @@ static void drawPagesButtons(Map* map, s32 x, s32 y)

enum{Width = TIC_ALTFONT_WIDTH + 1, Height = TOOLBAR_SIZE};

if(map->sheet.blit.pages > 1)
for(s32 i = 0; i < map->sheet.blit.pages; i++)
{
for(s32 i = 0; i < map->sheet.blit.pages; i++)
{
tic_rect rect = {x + i * Width - 1, y, Width, Height};

bool hover = false;
if(checkMousePos(&rect))
{
setCursor(tic_cursor_hand);
hover = true;
tic_rect rect = {x + i * Width - 1, y, Width, Height};

SHOW_TOOLTIP("PAGE %i", i);
bool hover = false;
if(checkMousePos(&rect))
{
setCursor(tic_cursor_hand);
hover = true;

if(checkMouseClick(&rect, tic_mouse_left))
{
map->sheet.blit.page = i;
}
}
SHOW_TOOLTIP("PAGE %i", i);

bool active = i == map->sheet.blit.page;
if(active)
if(checkMouseClick(&rect, tic_mouse_left))
{
tic_api_rect(tic, rect.x, rect.y, Width, Height, tic_color_black);
map->sheet.blit.page = i;
}
}

const char* label = (char[]){i + '1', '\0'};
tic_api_print(tic, label, rect.x + 1, rect.y + 1,
active
? tic_color_white
: hover
? tic_color_grey
: tic_color_light_grey,
true, 1, true);
}
}
bool active = i == map->sheet.blit.page;
if(active)
{
tic_api_rect(tic, rect.x, rect.y, Width, Height, tic_color_black);
}

const char* label = (char[]){i + '1', '\0'};
tic_api_print(tic, label, rect.x + 1, rect.y + 1,
active
? tic_color_white
: hover
? tic_color_grey
: tic_color_light_grey,
true, 1, true);
}
}

static void drawMapToolbar(Map* map, s32 x, s32 y)
Expand All @@ -481,7 +478,9 @@ static void drawMapToolbar(Map* map, s32 x, s32 y)
{
drawBankButtons(map, 183, 1);
drawBppButtons(map, 199, 1);
drawPagesButtons(map, 213, 0);

if(map->sheet.blit.pages > 1)
drawPagesButtons(map, map->sheet.blit.pages == 4 ? 213 : 222, 0);
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions src/studio/editors/sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,20 +1743,20 @@ static void drawBankTabs(Sprite* sprite, s32 x, s32 y)
static const u8 Icons[] =
{
0b00000000,
0b00111110,
0b00101010,
0b00111110,
0b00000000,
0b00101010,
0b00000000,
0b00101010,
0b00111110,
0b00000000,
0b00000000,

0b00000000,
0b00011100,
0b00101010,
0b00111110,
0b00100010,
0b00011100,
0b00011100,
0b00010100,
0b00000000,
0b00000000,
};
Expand Down

0 comments on commit 1de3b1c

Please sign in to comment.