From e311fa42a80da1c45d0dc36d5fe4b3462ca72440 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Fri, 20 Oct 2017 10:37:30 +0300 Subject: [PATCH] removed system color func --- src/code.c | 22 ++++----- src/config.c | 18 ------- src/console.c | 16 +++---- src/dialog.c | 30 ++++++------ src/keymap.c | 20 ++++---- src/map.c | 30 ++++++------ src/menu.c | 64 ++++++++++++------------- src/music.c | 66 +++++++++++++------------- src/sfx.c | 64 ++++++++++++------------- src/sprite.c | 128 +++++++++++++++++++++++++------------------------- src/start.c | 8 ++-- src/studio.c | 23 ++++----- src/studio.h | 9 +--- src/world.c | 4 +- 14 files changed, 236 insertions(+), 266 deletions(-) diff --git a/src/code.c b/src/code.c index d270d13..aeb31b8 100644 --- a/src/code.c +++ b/src/code.c @@ -46,7 +46,7 @@ static void history(Code* code) static void drawStatus(Code* code) { const s32 Height = TIC_FONT_HEIGHT + 1; - code->tic->api.rect(code->tic, 0, TIC80_HEIGHT - Height, TIC80_WIDTH, Height, systemColor(tic_color_white)); + code->tic->api.rect(code->tic, 0, TIC80_HEIGHT - Height, TIC80_WIDTH, Height, (tic_color_white)); code->tic->api.fixed_text(code->tic, code->status, 0, TIC80_HEIGHT - TIC_FONT_HEIGHT, getConfig()->theme.code.bg); } @@ -1410,10 +1410,10 @@ static void drawPopupBar(Code* code, const char* title) { enum {TextY = TOOLBAR_SIZE + 1}; - code->tic->api.rect(code->tic, 0, TOOLBAR_SIZE, TIC80_WIDTH, TIC_FONT_HEIGHT + 1, systemColor(tic_color_blue)); - code->tic->api.fixed_text(code->tic, title, 0, TextY, systemColor(tic_color_white)); + code->tic->api.rect(code->tic, 0, TOOLBAR_SIZE, TIC80_WIDTH, TIC_FONT_HEIGHT + 1, (tic_color_blue)); + code->tic->api.fixed_text(code->tic, title, 0, TextY, (tic_color_white)); - code->tic->api.fixed_text(code->tic, code->popup.text, (s32)strlen(title)*TIC_FONT_WIDTH, TextY, systemColor(tic_color_white)); + code->tic->api.fixed_text(code->tic, code->popup.text, (s32)strlen(title)*TIC_FONT_WIDTH, TextY, (tic_color_white)); drawCursor(code, (s32)(strlen(title) + strlen(code->popup.text)) * TIC_FONT_WIDTH, TextY, ' '); } @@ -1609,7 +1609,7 @@ static void drawOutlineBar(Code* code, s32 x, s32 y) } } - code->tic->api.rect(code->tic, rect.x-1, rect.y, rect.w+1, rect.h, systemColor(tic_color_blue)); + code->tic->api.rect(code->tic, rect.x-1, rect.y, rect.w+1, rect.h, (tic_color_blue)); OutlineItem* ptr = code->outline.items; @@ -1618,15 +1618,15 @@ static void drawOutlineBar(Code* code, s32 x, s32 y) if(ptr->pos) { code->tic->api.rect(code->tic, rect.x - 1, rect.y + code->outline.index*STUDIO_TEXT_HEIGHT, - rect.w + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_red)); + rect.w + 1, TIC_FONT_HEIGHT + 1, (tic_color_red)); while(ptr->pos) { - code->tic->api.fixed_text(code->tic, ptr->name, x, y, systemColor(tic_color_white)); + code->tic->api.fixed_text(code->tic, ptr->name, x, y, (tic_color_white)); ptr++; y += STUDIO_TEXT_HEIGHT; } } - else code->tic->api.fixed_text(code->tic, "(empty)", x, y, systemColor(tic_color_white)); + else code->tic->api.fixed_text(code->tic, "(empty)", x, y, (tic_color_white)); } static void textOutlineTick(Code* code) @@ -1691,7 +1691,7 @@ static void textOutlineTick(Code* code) static void drawCodeToolbar(Code* code) { - code->tic->api.rect(code->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + code->tic->api.rect(code->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); static const u8 Icons[] = { @@ -1768,9 +1768,9 @@ static void drawCodeToolbar(Code* code) bool active = i == code->mode - TEXT_EDIT_MODE && i != 0; if(active) - code->tic->api.rect(code->tic, rect.x, rect.y, Size, Size, systemColor(tic_color_blue)); + code->tic->api.rect(code->tic, rect.x, rect.y, Size, Size, (tic_color_blue)); - drawBitIcon(rect.x, rect.y, Icons + i*BITS_IN_BYTE, active ? systemColor(tic_color_white) : (over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue))); + drawBitIcon(rect.x, rect.y, Icons + i*BITS_IN_BYTE, active ? (tic_color_white) : (over ? (tic_color_dark_gray) : (tic_color_light_blue))); } drawToolbar(code->tic, getConfig()->theme.code.bg, false); diff --git a/src/config.c b/src/config.c index 3f3744f..6e1b2e7 100644 --- a/src/config.c +++ b/src/config.c @@ -85,23 +85,6 @@ static void readCursorTheme(Config* config, lua_State* lua) lua_pop(lua, 1); } -static void readPaletteMapTheme(Config* config, lua_State* lua) -{ - lua_getfield(lua, -1, "PALMAP"); - - if(lua_isstring(lua, -1)) - { - const char* val = lua_tostring(lua, -1); - - s32 size = (s32)strlen(val); - if(size == TIC_PALETTE_SIZE) - for(s32 i = 0; i < size; i++) - config->data.theme.palmap.data[i] = val[i] - (val[i] >= '0' && val[i] <= '9' ? '0' : 'a' - 10); - } - - lua_pop(lua, 1); -} - static void readCodeTheme(Config* config, lua_State* lua) { lua_getfield(lua, -1, "CODE"); @@ -154,7 +137,6 @@ static void readTheme(Config* config, lua_State* lua) if(lua_type(lua, -1) == LUA_TTABLE) { - readPaletteMapTheme(config, lua); readCursorTheme(config, lua); readCodeTheme(config, lua); readGamepadTheme(config, lua); diff --git a/src/console.c b/src/console.c index 17f6517..45bd205 100644 --- a/src/console.c +++ b/src/console.c @@ -29,10 +29,10 @@ #include -#define CONSOLE_CURSOR_COLOR (systemColor(tic_color_red)) -#define CONSOLE_BACK_TEXT_COLOR (systemColor(tic_color_dark_gray)) -#define CONSOLE_FRONT_TEXT_COLOR (systemColor(tic_color_white)) -#define CONSOLE_ERROR_TEXT_COLOR (systemColor(tic_color_red)) +#define CONSOLE_CURSOR_COLOR ((tic_color_red)) +#define CONSOLE_BACK_TEXT_COLOR ((tic_color_dark_gray)) +#define CONSOLE_FRONT_TEXT_COLOR ((tic_color_white)) +#define CONSOLE_ERROR_TEXT_COLOR ((tic_color_red)) #define CONSOLE_CURSOR_BLINK_PERIOD (TIC_FRAMERATE) #define CONSOLE_CURSOR_DELAY (TIC_FRAMERATE / 2) #define CONSOLE_BUFFER_WIDTH (STUDIO_TEXT_BUFFER_WIDTH) @@ -1724,10 +1724,10 @@ static void printTable(Console* console, const char* text) case '+': case '|': case '-': - color = systemColor(tic_color_gray); + color = (tic_color_gray); break; default: - color = systemColor(tic_color_white); + color = (tic_color_white); } *(console->colorBuffer + offset) = color; @@ -2065,7 +2065,7 @@ static void processConsoleCommand(Console* console) static void error(Console* console, const char* info) { - consolePrint(console, info ? info : "unknown error", systemColor(tic_color_red)); + consolePrint(console, info ? info : "unknown error", (tic_color_red)); commandDone(console); } @@ -2118,7 +2118,7 @@ static void checkNewVersion(Console* console) { char msg[FILENAME_MAX] = {0}; sprintf(msg, "\n A new version %i.%i.%i is available.\n", version.major, version.minor, version.patch); - consolePrint(console, msg, systemColor(tic_color_light_green)); + consolePrint(console, msg, (tic_color_light_green)); } } } diff --git a/src/dialog.c b/src/dialog.c index c5e6006..ce80edd 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -49,12 +49,12 @@ static void drawButton(Dialog* dlg, const char* label, s32 x, s32 y, u8 color, u if(down) { - tic->api.rect(tic, rect.x, rect.y+1, rect.w, rect.h, systemColor(tic_color_white)); + tic->api.rect(tic, rect.x, rect.y+1, rect.w, rect.h, (tic_color_white)); } else { - tic->api.rect(tic, rect.x, rect.y+1, rect.w, rect.h, systemColor(tic_color_black)); - tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_white)); + tic->api.rect(tic, rect.x, rect.y+1, rect.w, rect.h, (tic_color_black)); + tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, (tic_color_white)); } s32 size = tic->api.text(tic, label, 0, -TIC_FONT_HEIGHT, 0); @@ -74,8 +74,8 @@ static void drawButton(Dialog* dlg, const char* label, s32 x, s32 y, u8 color, u 0b00000000, }; - drawBitIcon(rect.x-5, rect.y+3, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x-5, rect.y+2, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x-5, rect.y+3, Icon, (tic_color_black)); + drawBitIcon(rect.x-5, rect.y+2, Icon, (tic_color_white)); } } @@ -156,16 +156,16 @@ static void drawDialog(Dialog* dlg) dlg->drag.active = false; } - tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_blue)); - tic->api.rect_border(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_white)); - tic->api.line(tic, rect.x, rect.y+Height, rect.x+Width-1, rect.y+Height, systemColor(tic_color_black)); - tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE-2), rect.w, TOOLBAR_SIZE-2, systemColor(tic_color_white)); - tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE-1), rect.x+Width-2, rect.y-(TOOLBAR_SIZE-1), systemColor(tic_color_white)); + tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, (tic_color_blue)); + tic->api.rect_border(tic, rect.x, rect.y, rect.w, rect.h, (tic_color_white)); + tic->api.line(tic, rect.x, rect.y+Height, rect.x+Width-1, rect.y+Height, (tic_color_black)); + tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE-2), rect.w, TOOLBAR_SIZE-2, (tic_color_white)); + tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE-1), rect.x+Width-2, rect.y-(TOOLBAR_SIZE-1), (tic_color_white)); { static const char Label[] = "WARNING!"; s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, 0); - tic->api.text(tic, Label, rect.x + (Width - size)/2, rect.y-(TOOLBAR_SIZE-2), systemColor(tic_color_gray)); + tic->api.text(tic, Label, rect.x + (Width - size)/2, rect.y-(TOOLBAR_SIZE-2), (tic_color_gray)); } { @@ -180,13 +180,13 @@ static void drawDialog(Dialog* dlg) s32 x = rect.x + (Width - size)/2; s32 y = rect.y + (TIC_FONT_HEIGHT+1)*(i+1); - tic->api.text(tic, dlg->text[i], x, y+1, systemColor(tic_color_black)); - tic->api.text(tic, dlg->text[i], x, y, systemColor(tic_color_white)); + tic->api.text(tic, dlg->text[i], x, y+1, (tic_color_black)); + tic->api.text(tic, dlg->text[i], x, y, (tic_color_white)); } } - drawButton(dlg, "YES", rect.x + (Width/2 - 26), rect.y + 45, systemColor(tic_color_dark_red), systemColor(tic_color_red), onYes, 0); - drawButton(dlg, "NO", rect.x + (Width/2 + 6), rect.y + 45, systemColor(tic_color_green), systemColor(tic_color_light_green), onNo, 1); + drawButton(dlg, "YES", rect.x + (Width/2 - 26), rect.y + 45, (tic_color_dark_red), (tic_color_red), onYes, 0); + drawButton(dlg, "NO", rect.x + (Width/2 + 6), rect.y + 45, (tic_color_green), (tic_color_light_green), onNo, 1); } static void tick(Dialog* dlg) diff --git a/src/keymap.c b/src/keymap.c index 62d3cf6..096d83d 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -56,7 +56,7 @@ static void drawPlayer(Keymap* keymap, s32 x, s32 y, s32 id) { char label[] = "PLAYER #%i"; sprintf(label, label, id+1); - keymap->tic->api.text(keymap->tic, label, x, y, systemColor(tic_color_white)); + keymap->tic->api.text(keymap->tic, label, x, y, (tic_color_white)); } @@ -84,14 +84,14 @@ static void drawPlayer(Keymap* keymap, s32 x, s32 y, s32 id) bool selected = keymap->button == button; if(over) - keymap->tic->api.rect(keymap->tic, rect.x-1, rect.y-1, rect.w, rect.h, systemColor(tic_color_dark_red)); + keymap->tic->api.rect(keymap->tic, rect.x-1, rect.y-1, rect.w, rect.h, (tic_color_dark_red)); if(selected) - keymap->tic->api.rect(keymap->tic, rect.x-1, rect.y-1, rect.w, rect.h, systemColor(tic_color_white)); + keymap->tic->api.rect(keymap->tic, rect.x-1, rect.y-1, rect.w, rect.h, (tic_color_white)); - keymap->tic->api.text(keymap->tic, ButtonNames[i], rect.x, rect.y, selected ? systemColor(tic_color_black) : systemColor(tic_color_gray)); + keymap->tic->api.text(keymap->tic, ButtonNames[i], rect.x, rect.y, selected ? (tic_color_black) : (tic_color_gray)); - keymap->tic->api.text(keymap->tic, SDL_GetKeyName(SDL_GetKeyFromScancode(codes[button])), rect.x + OffsetX, rect.y, selected ? systemColor(tic_color_black) : systemColor(tic_color_white)); + keymap->tic->api.text(keymap->tic, SDL_GetKeyName(SDL_GetKeyFromScancode(codes[button])), rect.x + OffsetX, rect.y, selected ? (tic_color_black) : (tic_color_white)); } } @@ -102,11 +102,11 @@ static void drawCenterText(Keymap* keymap, const char* text, s32 y, u8 color) static void drawKeymap(Keymap* keymap) { - keymap->tic->api.rect(keymap->tic, 0, 0, TIC80_WIDTH, TIC_FONT_HEIGHT * 3, systemColor(tic_color_white)); + keymap->tic->api.rect(keymap->tic, 0, 0, TIC80_WIDTH, TIC_FONT_HEIGHT * 3, (tic_color_white)); { static const char Label[] = "CONFIGURE BUTTONS MAPPING"; - keymap->tic->api.text(keymap->tic, Label, (TIC80_WIDTH - sizeof Label * TIC_FONT_WIDTH)/2, TIC_FONT_HEIGHT, systemColor(tic_color_black)); + keymap->tic->api.text(keymap->tic, Label, (TIC80_WIDTH - sizeof Label * TIC_FONT_WIDTH)/2, TIC_FONT_HEIGHT, (tic_color_black)); } drawPlayer(keymap, 16, 40, 0); @@ -115,14 +115,14 @@ static void drawKeymap(Keymap* keymap) if(keymap->button < 0) { if(keymap->ticks % TIC_FRAMERATE < TIC_FRAMERATE/2) - drawCenterText(keymap, "SELECT BUTTON", 120, systemColor(tic_color_white)); + drawCenterText(keymap, "SELECT BUTTON", 120, (tic_color_white)); } else { char label[256]; sprintf(label, "PRESS A KEY FOR '%s'", ButtonNames[keymap->button % BUTTONS_COUNT]); - drawCenterText(keymap, label, 120, systemColor(tic_color_white)); - drawCenterText(keymap, "ESC TO CANCEL", 126, systemColor(tic_color_white)); + drawCenterText(keymap, label, 120, (tic_color_white)); + drawCenterText(keymap, "ESC TO CANCEL", 126, (tic_color_white)); } } diff --git a/src/map.c b/src/map.c index 3319e44..3efc8e0 100644 --- a/src/map.c +++ b/src/map.c @@ -99,7 +99,7 @@ static s32 drawWorldButton(Map* map, s32 x, s32 y) setStudioMode(TIC_WORLD_MODE); } - drawBitIcon(x, y, WorldIcon, over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue)); + drawBitIcon(x, y, WorldIcon, over ? (tic_color_dark_gray) : (tic_color_light_blue)); return x; @@ -137,7 +137,7 @@ static s32 drawGridButton(Map* map, s32 x, s32 y) map->canvas.grid = !map->canvas.grid; } - drawBitIcon(x, y, GridIcon, map->canvas.grid ? systemColor(tic_color_black) : over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue)); + drawBitIcon(x, y, GridIcon, map->canvas.grid ? (tic_color_black) : over ? (tic_color_dark_gray) : (tic_color_light_blue)); return x; } @@ -186,7 +186,7 @@ static s32 drawSheetButton(Map* map, s32 x, s32 y) } } - drawBitIcon(rect.x, rect.y, map->sheet.show ? UpIcon : DownIcon, over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue)); + drawBitIcon(rect.x, rect.y, map->sheet.show ? UpIcon : DownIcon, over ? (tic_color_dark_gray) : (tic_color_light_blue)); return x; } @@ -212,7 +212,7 @@ static s32 drawToolButton(Map* map, s32 x, s32 y, const u8* Icon, s32 width, con } } - drawBitIcon(rect.x, rect.y, Icon, map->mode == mode ? systemColor(tic_color_black) : over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue)); + drawBitIcon(rect.x, rect.y, Icon, map->mode == mode ? (tic_color_black) : over ? (tic_color_dark_gray) : (tic_color_light_blue)); return x; } @@ -322,13 +322,13 @@ static void drawTileIndex(Map* map, s32 x, s32 y) { char buf[] = "#999"; sprintf(buf, "#%03i", index); - map->tic->api.text(map->tic, buf, x, y, systemColor(tic_color_light_blue)); + map->tic->api.text(map->tic, buf, x, y, (tic_color_light_blue)); } } static void drawMapToolbar(Map* map, s32 x, s32 y) { - map->tic->api.rect(map->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + map->tic->api.rect(map->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); drawTileIndex(map, TIC80_WIDTH/2 - TIC_FONT_WIDTH, y); @@ -348,7 +348,7 @@ static void drawSheet(Map* map, s32 x, s32 y) SDL_Rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE}; - map->tic->api.rect_border(map->tic, rect.x - 1, rect.y - 1, rect.w + 2, rect.h + 2, systemColor(tic_color_white)); + map->tic->api.rect_border(map->tic, rect.x - 1, rect.y - 1, rect.w + 2, rect.h + 2, (tic_color_white)); if(checkMousePos(&rect)) { @@ -398,7 +398,7 @@ static void drawSheet(Map* map, s32 x, s32 y) s32 bw = map->sheet.rect.w * TIC_SPRITESIZE + 2; s32 bh = map->sheet.rect.h * TIC_SPRITESIZE + 2; - map->tic->api.rect_border(map->tic, bx, by, bw, bh, systemColor(tic_color_white)); + map->tic->api.rect_border(map->tic, bx, by, bw, bh, (tic_color_white)); } } @@ -411,7 +411,7 @@ static void drawCursorPos(Map* map, s32 x, s32 y) sprintf(pos, "%03i:%03i", tx, ty); - s32 width = map->tic->api.text(map->tic, pos, TIC80_WIDTH, 0, systemColor(tic_color_gray)); + s32 width = map->tic->api.text(map->tic, pos, TIC80_WIDTH, 0, (tic_color_gray)); s32 px = x + (TIC_SPRITESIZE + 3); if(px + width >= TIC80_WIDTH) px = x - (width + 2); @@ -419,8 +419,8 @@ static void drawCursorPos(Map* map, s32 x, s32 y) s32 py = y - (TIC_FONT_HEIGHT + 2); if(py <= TOOLBAR_SIZE) py = y + (TIC_SPRITESIZE + 3); - map->tic->api.rect(map->tic, px - 1, py - 1, width + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white)); - map->tic->api.text(map->tic, pos, px, py, systemColor(tic_color_light_blue)); + map->tic->api.rect(map->tic, px - 1, py - 1, width + 1, TIC_FONT_HEIGHT + 1, (tic_color_white)); + map->tic->api.text(map->tic, pos, px, py, (tic_color_light_blue)); } static void setMapSprite(Map* map, s32 x, s32 y) @@ -455,7 +455,7 @@ static void drawTileCursor(Map* map) s32 height = map->sheet.rect.h * TIC_SPRITESIZE + 2; map->tic->api.rect_border(map->tic, mx - 1, my - 1, - width, height, systemColor(tic_color_white)); + width, height, (tic_color_white)); { s32 sx = map->sheet.rect.x; @@ -556,7 +556,7 @@ static void resetSelection(Map* map) static void drawSelectionRect(Map* map, s32 x, s32 y, s32 w, s32 h) { enum{Step = 3}; - u8 color = systemColor(tic_color_white); + u8 color = (tic_color_white); s32 index = map->tickCounter / 10; for(s32 i = x; i < (x+w); i++) {map->tic->api.pixel(map->tic, i, y, index++ % Step ? color : 0);} index++; @@ -867,8 +867,8 @@ static void drawMap(Map* map) s32 screenScrollX = map->scroll.x % TIC80_WIDTH; s32 screenScrollY = map->scroll.y % TIC80_HEIGHT; - map->tic->api.line(map->tic, 0, TIC80_HEIGHT - screenScrollY, TIC80_WIDTH, TIC80_HEIGHT - screenScrollY, systemColor(tic_color_gray)); - map->tic->api.line(map->tic, TIC80_WIDTH - screenScrollX, 0, TIC80_WIDTH - screenScrollX, TIC80_HEIGHT, systemColor(tic_color_gray)); + map->tic->api.line(map->tic, 0, TIC80_HEIGHT - screenScrollY, TIC80_WIDTH, TIC80_HEIGHT - screenScrollY, (tic_color_gray)); + map->tic->api.line(map->tic, TIC80_WIDTH - screenScrollX, 0, TIC80_WIDTH - screenScrollX, TIC80_HEIGHT, (tic_color_gray)); } if(!map->sheet.show && checkMousePos(&rect)) diff --git a/src/menu.c b/src/menu.c index d712ca8..04e4d00 100644 --- a/src/menu.c +++ b/src/menu.c @@ -110,16 +110,16 @@ static void drawDialog(Menu* menu) rect = getRect(menu); - tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_blue)); - tic->api.rect_border(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_white)); - tic->api.line(tic, rect.x, rect.y+DIALOG_HEIGHT, rect.x+DIALOG_WIDTH-1, rect.y+DIALOG_HEIGHT, systemColor(tic_color_black)); - tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE-2), rect.w, TOOLBAR_SIZE-2, systemColor(tic_color_white)); - tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE-1), rect.x+DIALOG_WIDTH-2, rect.y-(TOOLBAR_SIZE-1), systemColor(tic_color_white)); + tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, (tic_color_blue)); + tic->api.rect_border(tic, rect.x, rect.y, rect.w, rect.h, (tic_color_white)); + tic->api.line(tic, rect.x, rect.y+DIALOG_HEIGHT, rect.x+DIALOG_WIDTH-1, rect.y+DIALOG_HEIGHT, (tic_color_black)); + tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE-2), rect.w, TOOLBAR_SIZE-2, (tic_color_white)); + tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE-1), rect.x+DIALOG_WIDTH-2, rect.y-(TOOLBAR_SIZE-1), (tic_color_white)); { static const char Label[] = "GAME MENU"; s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, 0); - tic->api.text(tic, Label, rect.x + (DIALOG_WIDTH - size)/2, rect.y-(TOOLBAR_SIZE-2), systemColor(tic_color_gray)); + tic->api.text(tic, Label, rect.x + (DIALOG_WIDTH - size)/2, rect.y-(TOOLBAR_SIZE-2), (tic_color_gray)); } { @@ -149,14 +149,14 @@ static void drawTabDisabled(Menu* menu, s32 x, s32 y, s32 id) } } - tic->api.rect(tic, x, y-1, Width, Height+1, systemColor(tic_color_dark_gray)); - tic->api.pixel(tic, x, y+Height-1, systemColor(tic_color_blue)); - tic->api.pixel(tic, x+Width-1, y+Height-1, systemColor(tic_color_blue)); + tic->api.rect(tic, x, y-1, Width, Height+1, (tic_color_dark_gray)); + tic->api.pixel(tic, x, y+Height-1, (tic_color_blue)); + tic->api.pixel(tic, x+Width-1, y+Height-1, (tic_color_blue)); { char buf[] = "#1"; sprintf(buf, "#%i", id+1); - tic->api.fixed_text(tic, buf, x+2, y, systemColor(over ? tic_color_light_blue : tic_color_gray)); + tic->api.fixed_text(tic, buf, x+2, y, (over ? tic_color_light_blue : tic_color_gray)); } } @@ -165,15 +165,15 @@ static void drawTab(Menu* menu, s32 x, s32 y, s32 id) enum{Width = 15, Height = 7}; tic_mem* tic = menu->tic; - tic->api.rect(tic, x, y-2, Width, Height+2, systemColor(tic_color_white)); - tic->api.pixel(tic, x, y+Height-1, systemColor(tic_color_black)); - tic->api.pixel(tic, x+Width-1, y+Height-1, systemColor(tic_color_black)); - tic->api.rect(tic, x+1, y+Height, Width-2 , 1, systemColor(tic_color_black)); + tic->api.rect(tic, x, y-2, Width, Height+2, (tic_color_white)); + tic->api.pixel(tic, x, y+Height-1, (tic_color_black)); + tic->api.pixel(tic, x+Width-1, y+Height-1, (tic_color_black)); + tic->api.rect(tic, x+1, y+Height, Width-2 , 1, (tic_color_black)); { char buf[] = "#1"; sprintf(buf, "#%i", id+1); - tic->api.fixed_text(tic, buf, x+2, y, systemColor(tic_color_gray)); + tic->api.fixed_text(tic, buf, x+2, y, (tic_color_gray)); } } @@ -218,7 +218,7 @@ static void drawPlayerButtons(Menu* menu, s32 x, s32 y) if(strlen(label) > MaxChars) label[MaxChars] = '\0'; - tic->api.text(tic, label, rect.x+10, rect.y+2, systemColor(over ? tic_color_gray : tic_color_black)); + tic->api.text(tic, label, rect.x+10, rect.y+2, (over ? tic_color_gray : tic_color_black)); } } @@ -228,12 +228,12 @@ static void drawGamepadSetupTabs(Menu* menu, s32 x, s32 y) tic_mem* tic = menu->tic; - tic->api.rect(tic, x, y, Width, Height, systemColor(tic_color_white)); - tic->api.pixel(tic, x, y, systemColor(tic_color_blue)); - tic->api.pixel(tic, x+Width-1, y, systemColor(tic_color_blue)); - tic->api.pixel(tic, x, y+Height-1, systemColor(tic_color_black)); - tic->api.pixel(tic, x+Width-1, y+Height-1, systemColor(tic_color_black)); - tic->api.rect(tic, x+1, y+Height, Width-2 , 1, systemColor(tic_color_black)); + tic->api.rect(tic, x, y, Width, Height, (tic_color_white)); + tic->api.pixel(tic, x, y, (tic_color_blue)); + tic->api.pixel(tic, x+Width-1, y, (tic_color_blue)); + tic->api.pixel(tic, x, y+Height-1, (tic_color_black)); + tic->api.pixel(tic, x+Width-1, y+Height-1, (tic_color_black)); + tic->api.rect(tic, x+1, y+Height, Width-2 , 1, (tic_color_black)); for(s32 i = 0; i < Tabs; i++) { @@ -283,12 +283,12 @@ static void drawGamepadMenu(Menu* menu) if(down) { - tic->api.text(tic, Label, rect.x, rect.y+1, systemColor(tic_color_light_blue)); + tic->api.text(tic, Label, rect.x, rect.y+1, (tic_color_light_blue)); } else { - tic->api.text(tic, Label, rect.x, rect.y+1, systemColor(tic_color_black)); - tic->api.text(tic, Label, rect.x, rect.y, systemColor(over ? tic_color_light_blue : tic_color_white)); + tic->api.text(tic, Label, rect.x, rect.y+1, (tic_color_black)); + tic->api.text(tic, Label, rect.x, rect.y, (over ? tic_color_light_blue : tic_color_white)); } { @@ -304,8 +304,8 @@ static void drawGamepadMenu(Menu* menu) 0b00000000, }; - drawBitIcon(rect.x-7, rect.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x-7, rect.y, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x-7, rect.y+1, Icon, (tic_color_black)); + drawBitIcon(rect.x-7, rect.y, Icon, (tic_color_white)); } drawGamepadSetupTabs(menu, dlgRect.x+25, dlgRect.y+4); @@ -349,12 +349,12 @@ static void drawMainMenu(Menu* menu) if(down) { - tic->api.text(tic, Rows[i], label.x, label.y+1, systemColor(tic_color_light_blue)); + tic->api.text(tic, Rows[i], label.x, label.y+1, (tic_color_light_blue)); } else { - tic->api.text(tic, Rows[i], label.x, label.y+1, systemColor(tic_color_black)); - tic->api.text(tic, Rows[i], label.x, label.y, systemColor(over ? tic_color_light_blue : tic_color_white)); + tic->api.text(tic, Rows[i], label.x, label.y+1, (tic_color_black)); + tic->api.text(tic, Rows[i], label.x, label.y, (over ? tic_color_light_blue : tic_color_white)); } if(i == menu->main.focus) @@ -371,8 +371,8 @@ static void drawMainMenu(Menu* menu) 0b00000000, }; - drawBitIcon(label.x-7, label.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(label.x-7, label.y, Icon, systemColor(tic_color_white)); + drawBitIcon(label.x-7, label.y+1, Icon, (tic_color_black)); + drawBitIcon(label.x-7, label.y, Icon, (tic_color_white)); } } } diff --git a/src/music.c b/src/music.c index 01cd67d..2cf74e5 100644 --- a/src/music.c +++ b/src/music.c @@ -93,7 +93,7 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* set(music, -1, channel); } - drawBitIcon(rect.x, rect.y, LeftArrow, systemColor(over ? tic_color_light_blue : tic_color_dark_gray)); + drawBitIcon(rect.x, rect.y, LeftArrow, (over ? tic_color_light_blue : tic_color_dark_gray)); } { @@ -115,16 +115,16 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* } } - music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_black)); + music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_black)); if(music->tracker.row == -1 && music->tracker.col / CHANNEL_COLS == channel) { - music->tic->api.rect(music->tic, x - 1 + music->tracker.patternCol * TIC_FONT_WIDTH, y - 1, TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_red)); + music->tic->api.rect(music->tic, x - 1 + music->tracker.patternCol * TIC_FONT_WIDTH, y - 1, TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, (tic_color_red)); } char val[] = "99"; sprintf(val, "%02i", value); - music->tic->api.fixed_text(music->tic, val, x, y, systemColor(tic_color_white)); + music->tic->api.fixed_text(music->tic, val, x, y, (tic_color_white)); } { @@ -142,7 +142,7 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* set(music, +1, channel); } - drawBitIcon(rect.x, rect.y, RightArrow, systemColor(over ? tic_color_light_blue : tic_color_dark_gray)); + drawBitIcon(rect.x, rect.y, RightArrow, (over ? tic_color_light_blue : tic_color_dark_gray)); } } @@ -172,7 +172,7 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value, 0b00000000, }; - music->tic->api.text(music->tic, label, x, y, systemColor(tic_color_white)); + music->tic->api.text(music->tic, label, x, y, (tic_color_white)); { x += (s32)strlen(label)*TIC_FONT_WIDTH; @@ -187,13 +187,13 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value, set(music, -1, data); } - drawBitIcon(rect.x, rect.y, LeftArrow, systemColor(tic_color_dark_gray)); + drawBitIcon(rect.x, rect.y, LeftArrow, (tic_color_dark_gray)); } { char val[] = "999"; sprintf(val, "%02i", value); - music->tic->api.fixed_text(music->tic, val, x += TIC_FONT_WIDTH, y, systemColor(tic_color_white)); + music->tic->api.fixed_text(music->tic, val, x += TIC_FONT_WIDTH, y, (tic_color_white)); } { @@ -209,7 +209,7 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value, set(music, +1, data); } - drawBitIcon(rect.x, rect.y, RightArrow, systemColor(tic_color_dark_gray)); + drawBitIcon(rect.x, rect.y, RightArrow, (tic_color_dark_gray)); } } @@ -1112,7 +1112,7 @@ static void drawTrackerFrames(Music* music, s32 x, s32 y) } } - music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_black)); + music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_black)); } for (s32 i = 0; i < MUSIC_FRAMES; i++) @@ -1131,24 +1131,24 @@ static void drawTrackerFrames(Music* music, s32 x, s32 y) 0b00000000, }; - drawBitIcon(x - TIC_FONT_WIDTH, y - 1 + i*TIC_FONT_HEIGHT, Icon, systemColor(tic_color_white)); + drawBitIcon(x - TIC_FONT_WIDTH, y - 1 + i*TIC_FONT_HEIGHT, Icon, (tic_color_white)); } if (i == music->tracker.frame) { - music->tic->api.rect(music->tic, x - 1, y - 1 + i*TIC_FONT_HEIGHT, Width, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white)); + music->tic->api.rect(music->tic, x - 1, y - 1 + i*TIC_FONT_HEIGHT, Width, TIC_FONT_HEIGHT + 1, (tic_color_white)); } char buf[] = "99"; sprintf(buf, "%02i", i); - music->tic->api.fixed_text(music->tic, buf, x, y + i*TIC_FONT_HEIGHT, systemColor(tic_color_dark_gray)); + music->tic->api.fixed_text(music->tic, buf, x, y + i*TIC_FONT_HEIGHT, (tic_color_dark_gray)); } if(music->tracker.row >= 0) { char buf[] = "99"; sprintf(buf, "%02i", music->tracker.row); - music->tic->api.fixed_text(music->tic, buf, x, y - 9, systemColor(tic_color_white)); + music->tic->api.fixed_text(music->tic, buf, x, y - 9, (tic_color_white)); } } @@ -1215,7 +1215,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) } } - music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_black)); + music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_black)); s32 start = music->tracker.scroll; s32 end = start + Rows; @@ -1229,7 +1229,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) if (i == music->tracker.row) { - music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, systemColor(tic_color_dark_red)); + music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, (tic_color_dark_red)); } // draw selection @@ -1239,13 +1239,13 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) if (rect.h > 1 && i >= rect.y && i < rect.y + rect.h) { s32 sx = x - 1; - tic->api.rect(tic, sx, rowy - 1, CHANNEL_COLS * TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_yellow)); + tic->api.rect(tic, sx, rowy - 1, CHANNEL_COLS * TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, (tic_color_yellow)); } } if (checkPlayRow(music, i)) { - music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white)); + music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, (tic_color_white)); } char rowStr[] = "--------"; @@ -1268,8 +1268,8 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) if (note >= NoteStart) sprintf(rowStr, "%s%i%02i%01X--", Notes[note - NoteStart], octave + 1, sfx, volume & 0xf); - const u8 Colors[] = { systemColor(tic_color_light_green), systemColor(tic_color_orange), systemColor(tic_color_blue), systemColor(tic_color_gray) }; - const u8 DarkColors[] = { systemColor(tic_color_green), systemColor(tic_color_brown), systemColor(tic_color_dark_blue), systemColor(tic_color_dark_gray) }; + const u8 Colors[] = { (tic_color_light_green), (tic_color_orange), (tic_color_blue), (tic_color_gray) }; + const u8 DarkColors[] = { (tic_color_green), (tic_color_brown), (tic_color_dark_blue), (tic_color_dark_gray) }; static u8 ColorIndexes[] = { 0, 0, 0, 1, 1, 2, 3, 3 }; bool beetRow = i % NOTES_PER_BEET == 0; @@ -1283,7 +1283,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) } } } - else music->tic->api.fixed_text(music->tic, rowStr, x, rowy, systemColor(tic_color_dark_gray)); + else music->tic->api.fixed_text(music->tic, rowStr, x, rowy, (tic_color_dark_gray)); if (i == music->tracker.row) { @@ -1291,13 +1291,13 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) { s32 col = music->tracker.col % CHANNEL_COLS; s32 colx = x - 1 + col * TIC_FONT_WIDTH; - music->tic->api.rect(music->tic, colx, rowy - 1, TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_red)); - music->tic->api.draw_char(music->tic, rowStr[col], colx + 1, rowy, systemColor(tic_color_black)); + music->tic->api.rect(music->tic, colx, rowy - 1, TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, (tic_color_red)); + music->tic->api.draw_char(music->tic, rowStr[col], colx + 1, rowy, (tic_color_black)); } } if (i % NOTES_PER_BEET == 0) - music->tic->api.pixel(music->tic, x - 4, y + pos*TIC_FONT_HEIGHT + 2, systemColor(tic_color_dark_gray)); + music->tic->api.pixel(music->tic, x - 4, y + pos*TIC_FONT_HEIGHT + 2, (tic_color_dark_gray)); } } @@ -1418,9 +1418,9 @@ static void drawPlayButtons(Music* music) } if(i == 0 && music->tracker.follow) - drawBitIcon(rect.x, rect.y, Icons + i*Rows, over ? systemColor(tic_color_peach) : systemColor(tic_color_red)); + drawBitIcon(rect.x, rect.y, Icons + i*Rows, over ? (tic_color_peach) : (tic_color_red)); else - drawBitIcon(rect.x, rect.y, Icons + i*Rows, over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue)); + drawBitIcon(rect.x, rect.y, Icons + i*Rows, over ? (tic_color_dark_gray) : (tic_color_light_blue)); } } @@ -1470,15 +1470,15 @@ static void drawModeTabs(Music* music) } if (music->tab == Tabs[i]) - music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_gray)); + music->tic->api.rect(music->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_gray)); - drawBitIcon(rect.x, rect.y, Icons + i*Rows, music->tab == Tabs[i] ? systemColor(tic_color_white) : over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue)); + drawBitIcon(rect.x, rect.y, Icons + i*Rows, music->tab == Tabs[i] ? (tic_color_white) : over ? (tic_color_dark_gray) : (tic_color_light_blue)); } } static void drawMusicToolbar(Music* music) { - music->tic->api.rect(music->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + music->tic->api.rect(music->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); drawPlayButtons(music); drawModeTabs(music); @@ -1489,10 +1489,10 @@ static void drawPianoLayout(Music* music) SDL_Event* event = NULL; while ((event = pollEvent())){} - music->tic->api.clear(music->tic, systemColor(tic_color_gray)); + music->tic->api.clear(music->tic, (tic_color_gray)); static const char Wip[] = "PIANO MODE - WORK IN PROGRESS..."; - music->tic->api.fixed_text(music->tic, Wip, (TIC80_WIDTH - (sizeof Wip - 1) * TIC_FONT_WIDTH) / 2, TIC80_HEIGHT / 2, systemColor(tic_color_white)); + music->tic->api.fixed_text(music->tic, Wip, (TIC80_WIDTH - (sizeof Wip - 1) * TIC_FONT_WIDTH) / 2, TIC80_HEIGHT / 2, (tic_color_white)); } static void scrollNotes(Music* music, s32 delta) @@ -1571,7 +1571,7 @@ static void drawTrackerLayout(Music* music) } } - music->tic->api.clear(music->tic, systemColor(tic_color_gray)); + music->tic->api.clear(music->tic, (tic_color_gray)); drawTopPanel(music, 6, TOOLBAR_SIZE + 3); drawTracker(music, 6, 35); @@ -1592,7 +1592,7 @@ static void tick(Music* music) } drawMusicToolbar(music); - drawToolbar(music->tic, systemColor(tic_color_gray), false); + drawToolbar(music->tic, (tic_color_gray), false); } static void onStudioEvent(Music* music, StudioEvent event) diff --git a/src/sfx.c b/src/sfx.c index 5c9c526..eb466d1 100644 --- a/src/sfx.c +++ b/src/sfx.c @@ -63,7 +63,7 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi 0b00000000, }; - sfx->tic->api.text(sfx->tic, label, x, y, systemColor(tic_color_white)); + sfx->tic->api.text(sfx->tic, label, x, y, (tic_color_white)); { x += (s32)strlen(label)*TIC_FONT_WIDTH; @@ -78,13 +78,13 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi set(sfx, -1); } - drawBitIcon(rect.x, rect.y, LeftArrow, systemColor(tic_color_dark_gray)); + drawBitIcon(rect.x, rect.y, LeftArrow, (tic_color_dark_gray)); } { char val[] = "99"; sprintf(val, "%02i", value); - sfx->tic->api.fixed_text(sfx->tic, val, x += TIC_FONT_WIDTH, y, systemColor(tic_color_white)); + sfx->tic->api.fixed_text(sfx->tic, val, x += TIC_FONT_WIDTH, y, (tic_color_white)); } { @@ -100,7 +100,7 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi set(sfx, +1); } - drawBitIcon(rect.x, rect.y, RightArrow, systemColor(tic_color_dark_gray)); + drawBitIcon(rect.x, rect.y, RightArrow, (tic_color_dark_gray)); } } @@ -156,7 +156,7 @@ static void setLoopSize(Sfx* sfx, s32 delta) static void drawLoopPanel(Sfx* sfx, s32 x, s32 y) { - sfx->tic->api.text(sfx->tic, "LOOP:", x, y, systemColor(tic_color_dark_gray)); + sfx->tic->api.text(sfx->tic, "LOOP:", x, y, (tic_color_dark_gray)); enum {Gap = 2}; @@ -234,7 +234,7 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y) } sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, - active ? systemColor(tic_color_red) : over ? systemColor(tic_color_gray) : systemColor(tic_color_dark_gray)); + active ? (tic_color_red) : over ? (tic_color_gray) : (tic_color_dark_gray)); { enum{Size = 5}; @@ -254,7 +254,7 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y) } } - drawBitIcon(iconRect.x, iconRect.y, EmptyIcon, systemColor(over ? tic_color_gray : tic_color_dark_gray)); + drawBitIcon(iconRect.x, iconRect.y, EmptyIcon, (over ? tic_color_gray : tic_color_dark_gray)); } { @@ -263,7 +263,7 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y) for(s32 i = 0; i < ENVELOPE_VALUES/Scale; i++) { s32 value = tic_tool_peek4(wave->data, i*Scale)/Scale; - sfx->tic->api.pixel(sfx->tic, rect.x + i+1, rect.y + Height - value - 2, systemColor(tic_color_white)); + sfx->tic->api.pixel(sfx->tic, rect.x + i+1, rect.y + Height - value - 2, (tic_color_white)); } } } @@ -281,7 +281,7 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y) } if(full) - drawBitIcon(x+Width+HGap, y + (Count - start - 1)*(Height+Gap), FullIcon, systemColor(tic_color_white)); + drawBitIcon(x+Width+HGap, y + (Count - start - 1)*(Height+Gap), FullIcon, (tic_color_white)); } } @@ -293,7 +293,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) for(s32 i = 0, sy = y; i < COUNT_OF(Labels); sy += Height, i++) { - s32 size = sfx->tic->api.text(sfx->tic, Labels[i], 0, -TIC_FONT_HEIGHT, systemColor(tic_color_black)); + s32 size = sfx->tic->api.text(sfx->tic, Labels[i], 0, -TIC_FONT_HEIGHT, (tic_color_black)); SDL_Rect rect = {x - size, sy, size, TIC_FONT_HEIGHT}; @@ -307,7 +307,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) } } - sfx->tic->api.text(sfx->tic, Labels[i], rect.x, rect.y, i == sfx->canvasTab ? systemColor(tic_color_white) : systemColor(tic_color_dark_gray)); + sfx->tic->api.text(sfx->tic, Labels[i], rect.x, rect.y, i == sfx->canvasTab ? (tic_color_white) : (tic_color_dark_gray)); } tic_sound_effect* effect = getEffect(sfx); @@ -328,7 +328,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) effect->pitch16x++; } - sfx->tic->api.fixed_text(sfx->tic, Label, rect.x, rect.y, systemColor(effect->pitch16x ? tic_color_white : tic_color_dark_gray)); + sfx->tic->api.fixed_text(sfx->tic, Label, rect.x, rect.y, (effect->pitch16x ? tic_color_white : tic_color_dark_gray)); } break; case SFX_ARPEGGIO_TAB: @@ -345,7 +345,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) effect->reverse++; } - sfx->tic->api.text(sfx->tic, Label, rect.x, rect.y, systemColor(effect->reverse ? tic_color_white : tic_color_dark_gray)); + sfx->tic->api.text(sfx->tic, Label, rect.x, rect.y, (effect->reverse ? tic_color_white : tic_color_dark_gray)); } break; default: break; @@ -354,7 +354,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) static void drawCanvas(Sfx* sfx, s32 x, s32 y) { - sfx->tic->api.rect(sfx->tic, x, y, CANVAS_WIDTH, CANVAS_HEIGHT, systemColor(tic_color_dark_red)); + sfx->tic->api.rect(sfx->tic, x, y, CANVAS_WIDTH, CANVAS_HEIGHT, (tic_color_dark_red)); for(s32 i = 0; i < CANVAS_HEIGHT; i += CANVAS_SIZE) sfx->tic->api.line(sfx->tic, x, y + i, x + CANVAS_WIDTH, y + i, TIC_COLOR_BG); @@ -367,7 +367,7 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y) s32 tickIndex = *(pos.data + sfx->canvasTab); if(tickIndex >= 0) - sfx->tic->api.rect(sfx->tic, x + tickIndex * CANVAS_SIZE, y, CANVAS_SIZE + 1, CANVAS_HEIGHT + 1, systemColor(tic_color_white)); + sfx->tic->api.rect(sfx->tic, x + tickIndex * CANVAS_SIZE, y, CANVAS_SIZE + 1, CANVAS_HEIGHT + 1, (tic_color_white)); } SDL_Rect rect = {x, y, CANVAS_WIDTH, CANVAS_HEIGHT}; @@ -409,26 +409,26 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y) case SFX_VOLUME_TAB: { for(s32 j = 1, start = CANVAS_HEIGHT - CANVAS_SIZE; j <= CANVAS_ROWS - effect->data[i].volume; j++, start -= CANVAS_SIZE) - sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, y + 1 + start, CANVAS_SIZE-1, CANVAS_SIZE-1, systemColor(tic_color_red)); + sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, y + 1 + start, CANVAS_SIZE-1, CANVAS_SIZE-1, (tic_color_red)); } break; case SFX_ARPEGGIO_TAB: { sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, - y + 1 + (CANVAS_HEIGHT - (effect->data[i].arpeggio+1)*CANVAS_SIZE), CANVAS_SIZE-1, CANVAS_SIZE-1, systemColor(tic_color_red)); + y + 1 + (CANVAS_HEIGHT - (effect->data[i].arpeggio+1)*CANVAS_SIZE), CANVAS_SIZE-1, CANVAS_SIZE-1, (tic_color_red)); } break; case SFX_PITCH_TAB: { for(s32 j = SDL_min(0, effect->data[i].pitch); j <= SDL_max(0, effect->data[i].pitch); j++) sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, y + 1 + (CANVAS_HEIGHT/2 - (j+1)*CANVAS_SIZE), - CANVAS_SIZE-1, CANVAS_SIZE-1, systemColor(tic_color_red)); + CANVAS_SIZE-1, CANVAS_SIZE-1, (tic_color_red)); } break; case SFX_WAVE_TAB: { sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, - y + 1 + (CANVAS_HEIGHT - (effect->data[i].wave+1)*CANVAS_SIZE), CANVAS_SIZE-1, CANVAS_SIZE-1, systemColor(tic_color_red)); + y + 1 + (CANVAS_HEIGHT - (effect->data[i].wave+1)*CANVAS_SIZE), CANVAS_SIZE-1, CANVAS_SIZE-1, (tic_color_red)); } break; default: break; @@ -440,7 +440,7 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y) if(loop->start > 0 || loop->size > 0) { for(s32 i = 0; i < loop->size; i++) - sfx->tic->api.rect(sfx->tic, x + (loop->start+i) * CANVAS_SIZE+1, y + CANVAS_HEIGHT - 2, CANVAS_SIZE-1, 2, systemColor(tic_color_yellow)); + sfx->tic->api.rect(sfx->tic, x + (loop->start+i) * CANVAS_SIZE+1, y + CANVAS_HEIGHT - 2, CANVAS_SIZE-1, 2, (tic_color_yellow)); } } } @@ -508,7 +508,7 @@ static void drawPiano(Sfx* sfx, s32 x, s32 y) if(index >= 0) sfx->tic->api.rect(sfx->tic, rect->x, rect->y, rect->w - (white ? 1 : 0), rect->h, - systemColor(sfx->play.active && effect->note == index ? tic_color_red : white ? tic_color_white : tic_color_black)); + (sfx->play.active && effect->note == index ? tic_color_red : white ? tic_color_white : tic_color_black)); } } @@ -517,7 +517,7 @@ static void drawOctavePanel(Sfx* sfx, s32 x, s32 y) tic_sound_effect* effect = getEffect(sfx); static const char Label[] = "OCT"; - sfx->tic->api.text(sfx->tic, Label, x, y, systemColor(tic_color_white)); + sfx->tic->api.text(sfx->tic, Label, x, y, (tic_color_white)); x += sizeof(Label)*TIC_FONT_WIDTH; @@ -537,7 +537,7 @@ static void drawOctavePanel(Sfx* sfx, s32 x, s32 y) } } - sfx->tic->api.draw_char(sfx->tic, i + '1', rect.x, rect.y, systemColor(i == effect->octave ? tic_color_white : tic_color_dark_gray)); + sfx->tic->api.draw_char(sfx->tic, i + '1', rect.x, rect.y, (i == effect->octave ? tic_color_white : tic_color_dark_gray)); } } @@ -788,15 +788,15 @@ static void drawModeTabs(Sfx* sfx) } if (sfx->tab == Tabs[i]) - sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_black)); + sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_black)); - drawBitIcon(rect.x, rect.y, Icons + i*Rows, systemColor(sfx->tab == Tabs[i] ? tic_color_white : over ? tic_color_dark_gray : tic_color_light_blue)); + drawBitIcon(rect.x, rect.y, Icons + i*Rows, (sfx->tab == Tabs[i] ? tic_color_white : over ? tic_color_dark_gray : tic_color_light_blue)); } } static void drawSfxToolbar(Sfx* sfx) { - sfx->tic->api.rect(sfx->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + sfx->tic->api.rect(sfx->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); enum{Width = 3 * TIC_FONT_WIDTH}; s32 x = TIC80_WIDTH - Width - TIC_SPRITESIZE*3; @@ -825,7 +825,7 @@ static void drawSfxToolbar(Sfx* sfx) char buf[] = "C#4"; sprintf(buf, "%s%i", Notes[effect->note], effect->octave+1); - sfx->tic->api.fixed_text(sfx->tic, buf, x, y, systemColor(over ? tic_color_dark_gray : tic_color_light_blue)); + sfx->tic->api.fixed_text(sfx->tic, buf, x, y, (over ? tic_color_dark_gray : tic_color_light_blue)); } drawModeTabs(sfx); @@ -898,10 +898,10 @@ static void drawWaveformBar(Sfx* sfx, s32 x, s32 y) active = true; } - sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, systemColor(active ? tic_color_red : tic_color_white)); + sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, (active ? tic_color_red : tic_color_white)); if(sfx->waveform.index == i) - sfx->tic->api.rect_border(sfx->tic, rect.x-2, rect.y-2, rect.w+4, rect.h+4, systemColor(tic_color_white)); + sfx->tic->api.rect_border(sfx->tic, rect.x-2, rect.y-2, rect.w+4, rect.h+4, (tic_color_white)); { tic_waveform* wave = getWaveformById(sfx, i); @@ -909,7 +909,7 @@ static void drawWaveformBar(Sfx* sfx, s32 x, s32 y) for(s32 i = 0; i < ENVELOPE_VALUES/Scale; i++) { s32 value = tic_tool_peek4(wave->data, i*Scale)/Scale; - sfx->tic->api.pixel(sfx->tic, rect.x + i+1, rect.y + Height - value - 2, systemColor(tic_color_black)); + sfx->tic->api.pixel(sfx->tic, rect.x + i+1, rect.y + Height - value - 2, (tic_color_black)); } } } @@ -921,7 +921,7 @@ static void drawWaveformCanvas(Sfx* sfx, s32 x, s32 y) SDL_Rect rect = {x, y, Width, Height}; - sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_dark_red)); + sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_dark_red)); for(s32 i = 0; i < Height; i += CANVAS_SIZE) sfx->tic->api.line(sfx->tic, rect.x, rect.y + i, rect.x + Width, rect.y + i, TIC_COLOR_BG); @@ -958,7 +958,7 @@ static void drawWaveformCanvas(Sfx* sfx, s32 x, s32 y) { s32 value = tic_tool_peek4(wave->data, i); sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, - y + 1 + (Height - (value+1)*CANVAS_SIZE), CANVAS_SIZE-1, CANVAS_SIZE-1, systemColor(tic_color_red)); + y + 1 + (Height - (value+1)*CANVAS_SIZE), CANVAS_SIZE-1, CANVAS_SIZE-1, (tic_color_red)); } } diff --git a/src/sprite.c b/src/sprite.c index 6caaa9b..8494a3c 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -56,7 +56,7 @@ static s32 getIndexPosY(Sprite* sprite) static void drawSelection(Sprite* sprite, s32 x, s32 y, s32 w, s32 h) { enum{Step = 3}; - u8 color = systemColor(tic_color_white); + u8 color = (tic_color_white); s32 index = sprite->tickCounter / 10; for(s32 i = x; i < (x+w); i++) { sprite->tic->api.pixel(sprite->tic, i, y, index++ % Step ? color : 0);} index++; @@ -75,8 +75,8 @@ static SDL_Rect getSpriteRect(Sprite* sprite) static void drawCursorBorder(Sprite* sprite, s32 x, s32 y, s32 w, s32 h) { - sprite->tic->api.rect_border(sprite->tic, x, y, w, h, systemColor(tic_color_black)); - sprite->tic->api.rect_border(sprite->tic, x-1, y-1, w+2, h+2, systemColor(tic_color_white)); + sprite->tic->api.rect_border(sprite->tic, x, y, w, h, (tic_color_black)); + sprite->tic->api.rect_border(sprite->tic, x-1, y-1, w+2, h+2, (tic_color_white)); } static void processPickerCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 sy) @@ -336,21 +336,21 @@ static void drawBrushSlider(Sprite* sprite, s32 x, s32 y) } } - sprite->tic->api.rect(sprite->tic, x+1, y, Size-2, Size*Count, systemColor(tic_color_black)); + sprite->tic->api.rect(sprite->tic, x+1, y, Size-2, Size*Count, (tic_color_black)); for(s32 i = 0; i < Count; i++) { s32 offset = y + i*(Size+1); - sprite->tic->api.rect(sprite->tic, x, offset, Size, Size, systemColor(tic_color_black)); - sprite->tic->api.rect(sprite->tic, x + 6, offset + 2, Count - i, 1, systemColor(tic_color_black)); + sprite->tic->api.rect(sprite->tic, x, offset, Size, Size, (tic_color_black)); + sprite->tic->api.rect(sprite->tic, x + 6, offset + 2, Count - i, 1, (tic_color_black)); } - sprite->tic->api.rect(sprite->tic, x+2, y+1, 1, Size*Count+1, systemColor(over ? tic_color_white : tic_color_gray)); + sprite->tic->api.rect(sprite->tic, x+2, y+1, 1, Size*Count+1, (over ? tic_color_white : tic_color_gray)); s32 offset = y + (Count - sprite->brushSize)*(Size+1); - sprite->tic->api.rect(sprite->tic, x, offset, Size, Size, systemColor(tic_color_black)); - sprite->tic->api.rect(sprite->tic, x+1, offset+1, Size-2, Size-2, systemColor(over ? tic_color_white : tic_color_gray)); + sprite->tic->api.rect(sprite->tic, x, offset, Size, Size, (tic_color_black)); + sprite->tic->api.rect(sprite->tic, x+1, offset+1, Size-2, Size-2, (over ? tic_color_white : tic_color_gray)); } static void drawCanvas(Sprite* sprite, s32 x, s32 y) @@ -362,13 +362,13 @@ static void drawCanvas(Sprite* sprite, s32 x, s32 y) s32 ix = x + (CANVAS_SIZE - 4*TIC_FONT_WIDTH)/2; s32 iy = TIC_SPRITESIZE + 2; - sprite->tic->api.text(sprite->tic, buf, ix, iy+1, systemColor(tic_color_black)); - sprite->tic->api.text(sprite->tic, buf, ix, iy, systemColor(tic_color_white)); + sprite->tic->api.text(sprite->tic, buf, ix, iy+1, (tic_color_black)); + sprite->tic->api.text(sprite->tic, buf, ix, iy, (tic_color_white)); } - sprite->tic->api.rect_border(sprite->tic, x-1, y-1, CANVAS_SIZE+2, CANVAS_SIZE+2, systemColor(tic_color_white)); - sprite->tic->api.rect(sprite->tic, x, y, CANVAS_SIZE, CANVAS_SIZE, systemColor(tic_color_black)); - sprite->tic->api.rect(sprite->tic, x-1, y + CANVAS_SIZE+1, CANVAS_SIZE+2, 1, systemColor(tic_color_black)); + sprite->tic->api.rect_border(sprite->tic, x-1, y-1, CANVAS_SIZE+2, CANVAS_SIZE+2, (tic_color_white)); + sprite->tic->api.rect(sprite->tic, x, y, CANVAS_SIZE, CANVAS_SIZE, (tic_color_black)); + sprite->tic->api.rect(sprite->tic, x-1, y + CANVAS_SIZE+1, CANVAS_SIZE+2, 1, (tic_color_black)); SDL_Rect rect = getSpriteRect(sprite); s32 r = rect.x + rect.w; @@ -506,9 +506,9 @@ static void drawMoveButtons(Sprite* sprite) Func[i](sprite); } - drawBitIcon(Rects[i].x, Rects[i].y+1, Icons + i*8, down ? systemColor(tic_color_white) : systemColor(tic_color_black)); + drawBitIcon(Rects[i].x, Rects[i].y+1, Icons + i*8, down ? (tic_color_white) : (tic_color_black)); - if(!down) drawBitIcon(Rects[i].x, Rects[i].y, Icons + i*8, systemColor(tic_color_white)); + if(!down) drawBitIcon(Rects[i].x, Rects[i].y, Icons + i*8, (tic_color_white)); } } } @@ -543,20 +543,20 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value) } } - sprite->tic->api.rect(sprite->tic, x, y+1, Size, 1, systemColor(tic_color_black)); - sprite->tic->api.rect(sprite->tic, x, y, Size, 1, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, x, y+1, Size, 1, (tic_color_black)); + sprite->tic->api.rect(sprite->tic, x, y, Size, 1, (tic_color_white)); { s32 offset = x + *value * (Size-1) / Max - 1; - drawBitIcon(offset, y, Icon, systemColor(tic_color_black)); - drawBitIcon(offset, y-1, Icon, systemColor(tic_color_white)); + drawBitIcon(offset, y, Icon, (tic_color_black)); + drawBitIcon(offset, y-1, Icon, (tic_color_white)); sprite->tic->api.pixel(sprite->tic, offset+1, y, sprite->color); } { char buf[] = "FF"; sprintf(buf, "%02X", *value); - sprite->tic->api.text(sprite->tic, buf, x - 18, y - 2, systemColor(tic_color_dark_gray)); + sprite->tic->api.text(sprite->tic, buf, x - 18, y - 2, (tic_color_dark_gray)); } } @@ -589,12 +589,12 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value) if(down) { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_white)); } else { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x, rect.y, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); + drawBitIcon(rect.x, rect.y, Icon, (tic_color_white)); } } @@ -627,12 +627,12 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value) if(down) { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_white)); } else { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x, rect.y, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); + drawBitIcon(rect.x, rect.y, Icon, (tic_color_white)); } } } @@ -674,12 +674,12 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y) if(down) { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_light_blue)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_light_blue)); } else { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x, rect.y, Icon, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); + drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white)); } } @@ -720,12 +720,12 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y) if(down) { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_light_blue)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_light_blue)); } else { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x, rect.y, Icon, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); + drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white)); } } } @@ -768,23 +768,23 @@ static void drawPalette(Sprite* sprite, s32 x, s32 y) } } - sprite->tic->api.rect(sprite->tic, rect.x-1, rect.y-1, rect.w+2, rect.h+2, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, rect.x-1, rect.y-1, rect.w+2, rect.h+2, (tic_color_white)); for(s32 row = 0, i = 0; row < PALETTE_ROWS; row++) for(s32 col = 0; col < PALETTE_COLS; col++) sprite->tic->api.rect(sprite->tic, x + col * PALETTE_CELL_SIZE, y + row * PALETTE_CELL_SIZE, PALETTE_CELL_SIZE-1, PALETTE_CELL_SIZE-1, i++); - sprite->tic->api.rect(sprite->tic, rect.x-1, rect.y+rect.h+1, PALETTE_WIDTH+1, 1, systemColor(tic_color_black)); + sprite->tic->api.rect(sprite->tic, rect.x-1, rect.y+rect.h+1, PALETTE_WIDTH+1, 1, (tic_color_black)); { s32 offsetX = x + (sprite->color % PALETTE_COLS) * PALETTE_CELL_SIZE; s32 offsetY = y + (sprite->color / PALETTE_COLS) * PALETTE_CELL_SIZE; sprite->tic->api.rect(sprite->tic, offsetX - 1, offsetY - 1, PALETTE_CELL_SIZE + 1, PALETTE_CELL_SIZE + 1, sprite->color); - sprite->tic->api.rect_border(sprite->tic, offsetX - 2, offsetY - 2, PALETTE_CELL_SIZE + 3, PALETTE_CELL_SIZE + 3, systemColor(tic_color_white)); + sprite->tic->api.rect_border(sprite->tic, offsetX - 2, offsetY - 2, PALETTE_CELL_SIZE + 3, PALETTE_CELL_SIZE + 3, (tic_color_white)); if(offsetY > y) - sprite->tic->api.rect(sprite->tic, offsetX - 2, rect.y + rect.h+2, PALETTE_CELL_SIZE+3, 1, systemColor(tic_color_black)); + sprite->tic->api.rect(sprite->tic, offsetX - 2, rect.y + rect.h+2, PALETTE_CELL_SIZE+3, 1, (tic_color_black)); } { @@ -803,7 +803,7 @@ static void drawPalette(Sprite* sprite, s32 x, s32 y) s32 offsetX = x + (sprite->color2 % PALETTE_COLS) * PALETTE_CELL_SIZE; s32 offsetY = y + (sprite->color2 / PALETTE_COLS) * PALETTE_CELL_SIZE; - drawBitIcon(offsetX, offsetY, Icon, sprite->color2 == systemColor(tic_color_white) ? systemColor(tic_color_black) : systemColor(tic_color_white)); + drawBitIcon(offsetX, offsetY, Icon, sprite->color2 == (tic_color_white) ? (tic_color_black) : (tic_color_white)); } { @@ -839,12 +839,12 @@ static void drawPalette(Sprite* sprite, s32 x, s32 y) if(sprite->editPalette || down) { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (over ? tic_color_light_blue : tic_color_white)); } else { - drawBitIcon(rect.x, rect.y+1, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x, rect.y, Icon, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); + drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white)); } } } @@ -886,8 +886,8 @@ static void drawSheet(Sprite* sprite, s32 x, s32 y) { SDL_Rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE}; - sprite->tic->api.rect_border(sprite->tic, rect.x - 1, rect.y - 1, rect.w + 2, rect.h + 2, systemColor(tic_color_white)); - sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_black)); + sprite->tic->api.rect_border(sprite->tic, rect.x - 1, rect.y - 1, rect.w + 2, rect.h + 2, (tic_color_white)); + sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_black)); if(checkMousePos(&rect)) { @@ -907,7 +907,7 @@ static void drawSheet(Sprite* sprite, s32 x, s32 y) s32 bx = getIndexPosX(sprite) + x - 1; s32 by = getIndexPosY(sprite) + y - 1; - sprite->tic->api.rect_border(sprite->tic, bx, by, sprite->size + 2, sprite->size + 2, systemColor(tic_color_white)); + sprite->tic->api.rect_border(sprite->tic, bx, by, sprite->size + 2, sprite->size + 2, (tic_color_white)); } } @@ -1059,12 +1059,12 @@ static void drawSpriteTools(Sprite* sprite, s32 x, s32 y) if(pushed) { - drawBitIcon(rect.x, y + 1, Icons + i*BITS_IN_BYTE, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, y + 1, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white)); } else { - drawBitIcon(rect.x, y+1, Icons + i*BITS_IN_BYTE, systemColor(tic_color_black)); - drawBitIcon(rect.x, y, Icons + i*BITS_IN_BYTE, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, y+1, Icons + i*BITS_IN_BYTE, (tic_color_black)); + drawBitIcon(rect.x, y, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white)); } } } @@ -1150,15 +1150,15 @@ static void drawTools(Sprite* sprite, s32 x, s32 y) 0b00000000, }; - drawBitIcon(rect.x, y - 4, Icon, systemColor(tic_color_black)); - drawBitIcon(rect.x, y - 5, Icon, systemColor(tic_color_white)); + drawBitIcon(rect.x, y - 4, Icon, (tic_color_black)); + drawBitIcon(rect.x, y - 5, Icon, (tic_color_white)); - drawBitIcon(rect.x, y + 1, Icons + i*BITS_IN_BYTE, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, y + 1, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white)); } else { - drawBitIcon(rect.x, y+1, Icons + i*BITS_IN_BYTE, systemColor(tic_color_black)); - drawBitIcon(rect.x, y, Icons + i*BITS_IN_BYTE, systemColor(over ? tic_color_light_blue : tic_color_white)); + drawBitIcon(rect.x, y+1, Icons + i*BITS_IN_BYTE, (tic_color_black)); + drawBitIcon(rect.x, y, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white)); } } @@ -1334,7 +1334,7 @@ static void processKeydown(Sprite* sprite, SDL_Keycode keycode) static void drawSpriteToolbar(Sprite* sprite) { - sprite->tic->api.rect(sprite->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); // draw sprite size control { @@ -1357,16 +1357,16 @@ static void drawSpriteToolbar(Sprite* sprite) } for(s32 i = 0; i < 4; i++) - sprite->tic->api.rect(sprite->tic, rect.x + i*6, 1, 5, 5, systemColor(tic_color_black)); + sprite->tic->api.rect(sprite->tic, rect.x + i*6, 1, 5, 5, (tic_color_black)); - sprite->tic->api.rect(sprite->tic, rect.x, 2, 23, 3, systemColor(tic_color_black)); - sprite->tic->api.rect(sprite->tic, rect.x+1, 3, 21, 1, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, rect.x, 2, 23, 3, (tic_color_black)); + sprite->tic->api.rect(sprite->tic, rect.x+1, 3, 21, 1, (tic_color_white)); s32 size = sprite->size / TIC_SPRITESIZE, val = 0; while(size >>= 1) val++; - sprite->tic->api.rect(sprite->tic, rect.x + val*6, 1, 5, 5, systemColor(tic_color_black)); - sprite->tic->api.rect(sprite->tic, rect.x+1 + val*6, 2, 3, 3, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, rect.x + val*6, 1, 5, 5, (tic_color_black)); + sprite->tic->api.rect(sprite->tic, rect.x+1 + val*6, 2, 3, 3, (tic_color_white)); } bool bg = sprite->index < TIC_BANK_SPRITES; @@ -1374,8 +1374,8 @@ static void drawSpriteToolbar(Sprite* sprite) { static const char Label[] = "BG"; SDL_Rect rect = {TIC80_WIDTH - 2 * TIC_FONT_WIDTH - 2, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1}; - sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? systemColor(tic_color_black) : systemColor(tic_color_gray)); - sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? (tic_color_black) : (tic_color_gray)); + sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white)); if(checkMousePos(&rect)) { @@ -1394,8 +1394,8 @@ static void drawSpriteToolbar(Sprite* sprite) { static const char Label[] = "FG"; SDL_Rect rect = {TIC80_WIDTH - 4 * TIC_FONT_WIDTH - 4, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1}; - sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? systemColor(tic_color_gray) : systemColor(tic_color_black)); - sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? (tic_color_gray) : (tic_color_black)); + sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white)); if(checkMousePos(&rect)) { @@ -1440,7 +1440,7 @@ static void tick(Sprite* sprite) } } - sprite->tic->api.clear(sprite->tic, systemColor(tic_color_gray)); + sprite->tic->api.clear(sprite->tic, (tic_color_gray)); drawCanvas(sprite, 24, 20); drawMoveButtons(sprite); @@ -1453,7 +1453,7 @@ static void tick(Sprite* sprite) drawSheet(sprite, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, 7); drawSpriteToolbar(sprite); - drawToolbar(sprite->tic, systemColor(tic_color_gray), false); + drawToolbar(sprite->tic, (tic_color_gray), false); sprite->tickCounter++; } diff --git a/src/start.c b/src/start.c index d7ecad9..930a08b 100644 --- a/src/start.c +++ b/src/start.c @@ -26,7 +26,7 @@ static void reset(Start* start) { u8* tile = (u8*)start->tic->ram.gfx.tiles; - start->tic->api.clear(start->tic, systemColor(tic_color_black)); + start->tic->api.clear(start->tic, (tic_color_black)); static const u8 Reset[] = {0x00, 0x06, 0x96, 0x00}; u8 val = Reset[sizeof(Reset) * (start->ticks % TIC_FRAMERATE) / TIC_FRAMERATE]; @@ -38,9 +38,9 @@ static void reset(Start* start) static void drawHeader(Start* start) { - start->tic->api.fixed_text(start->tic, TIC_NAME_FULL, STUDIO_TEXT_WIDTH, STUDIO_TEXT_HEIGHT, systemColor(tic_color_white)); - start->tic->api.fixed_text(start->tic, TIC_VERSION_LABEL, (sizeof(TIC_NAME_FULL) + 1) * STUDIO_TEXT_WIDTH, STUDIO_TEXT_HEIGHT, systemColor(tic_color_dark_gray)); - start->tic->api.fixed_text(start->tic, TIC_COPYRIGHT, STUDIO_TEXT_WIDTH, STUDIO_TEXT_HEIGHT*2, systemColor(tic_color_dark_gray)); + start->tic->api.fixed_text(start->tic, TIC_NAME_FULL, STUDIO_TEXT_WIDTH, STUDIO_TEXT_HEIGHT, (tic_color_white)); + start->tic->api.fixed_text(start->tic, TIC_VERSION_LABEL, (sizeof(TIC_NAME_FULL) + 1) * STUDIO_TEXT_WIDTH, STUDIO_TEXT_HEIGHT, (tic_color_dark_gray)); + start->tic->api.fixed_text(start->tic, TIC_COPYRIGHT, STUDIO_TEXT_WIDTH, STUDIO_TEXT_HEIGHT*2, (tic_color_dark_gray)); } static void header(Start* start) diff --git a/src/studio.c b/src/studio.c index 8e6c78f..ef75d63 100644 --- a/src/studio.c +++ b/src/studio.c @@ -466,8 +466,8 @@ void drawExtrabar(tic_mem* tic) { SDL_Rect rect = {x + i*Size, y, Size, Size}; - u8 bgcolor = systemColor(tic_color_white); - u8 color = systemColor(tic_color_light_blue); + u8 bgcolor = (tic_color_white); + u8 color = (tic_color_light_blue); if(checkMousePos(&rect)) { @@ -479,7 +479,7 @@ void drawExtrabar(tic_mem* tic) if(checkMouseDown(&rect, SDL_BUTTON_LEFT)) { bgcolor = color; - color = systemColor(tic_color_white); + color = (tic_color_white); } else if(checkMouseClick(&rect, SDL_BUTTON_LEFT)) { @@ -497,15 +497,10 @@ const StudioConfig* getConfig() return &studio.config.data; } -u8 systemColor(u8 color) -{ - return getConfig()->theme.palmap.data[color]; -} - void drawToolbar(tic_mem* tic, u8 color, bool bg) { if(bg) - studio.tic->api.rect(tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + studio.tic->api.rect(tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); static const u8 TabIcon[] = { @@ -596,7 +591,7 @@ void drawToolbar(tic_mem* tic, u8 color, bool bg) if(mode == i) drawBitIcon(i * Size, 0, TabIcon, color); - drawBitIcon(i * Size, 0, Icons + i * BITS_IN_BYTE, mode == i ? systemColor(tic_color_white) : (over ? systemColor(tic_color_dark_gray) : systemColor(tic_color_light_blue))); + drawBitIcon(i * Size, 0, Icons + i * BITS_IN_BYTE, mode == i ? (tic_color_white) : (over ? (tic_color_dark_gray) : (tic_color_light_blue))); } if(mode >= 0) drawExtrabar(tic); @@ -614,11 +609,11 @@ void drawToolbar(tic_mem* tic, u8 color, bool bg) { if(strlen(studio.tooltip.text)) { - studio.tic->api.text(tic, studio.tooltip.text, (COUNT_OF(Modes) + 1) * Size, 1, systemColor(tic_color_black)); + studio.tic->api.text(tic, studio.tooltip.text, (COUNT_OF(Modes) + 1) * Size, 1, (tic_color_black)); } else { - studio.tic->api.text(tic, Names[mode], (COUNT_OF(Modes) + 1) * Size, 1, systemColor(tic_color_dark_gray)); + studio.tic->api.text(tic, Names[mode], (COUNT_OF(Modes) + 1) * Size, 1, (tic_color_dark_gray)); } } } @@ -2070,9 +2065,9 @@ static void renderStudio() { studio.popup.counter--; - studio.tic->api.rect(studio.tic, 0, TIC80_HEIGHT - TIC_FONT_HEIGHT - 1, TIC80_WIDTH, TIC80_HEIGHT, systemColor(tic_color_red)); + studio.tic->api.rect(studio.tic, 0, TIC80_HEIGHT - TIC_FONT_HEIGHT - 1, TIC80_WIDTH, TIC80_HEIGHT, (tic_color_red)); studio.tic->api.text(studio.tic, studio.popup.message, (s32)(TIC80_WIDTH - strlen(studio.popup.message)*TIC_FONT_WIDTH)/2, - TIC80_HEIGHT - TIC_FONT_HEIGHT, systemColor(tic_color_white)); + TIC80_HEIGHT - TIC_FONT_HEIGHT, (tic_color_white)); } studio.tic->api.tick_end(studio.tic); diff --git a/src/studio.h b/src/studio.h index 0597730..eed87b7 100644 --- a/src/studio.h +++ b/src/studio.h @@ -49,7 +49,7 @@ #define STUDIO_TEXT_BUFFER_WIDTH (TIC80_WIDTH / STUDIO_TEXT_WIDTH) #define STUDIO_TEXT_BUFFER_HEIGHT (TIC80_HEIGHT / STUDIO_TEXT_HEIGHT) -#define TIC_COLOR_BG systemColor(tic_color_black) +#define TIC_COLOR_BG (tic_color_black) #define DEFAULT_CHMOD 0755 #define CONFIG_TIC "config " TIC_VERSION_LABEL ".tic" @@ -64,11 +64,6 @@ typedef struct { struct { - struct - { - u8 data[TIC_PALETTE_SIZE]; - } palmap; - struct { s32 sprite; @@ -179,8 +174,6 @@ void showTooltip(const char* text); SDL_Scancode* getKeymap(); -u8 systemColor(u8 color); - const StudioConfig* getConfig(); void setSpritePixel(tic_tile* tiles, s32 x, s32 y, u8 color); diff --git a/src/world.c b/src/world.c index 8a41a7d..bae1698 100644 --- a/src/world.c +++ b/src/world.c @@ -28,7 +28,7 @@ static void drawGrid(World* world) { Map* map = world->map; - u8 color = systemColor(tic_color_light_blue); + u8 color = (tic_color_light_blue); for(s32 c = 0; c < TIC80_WIDTH; c += TIC_MAP_SCREEN_WIDTH) world->tic->api.line(world->tic, c, 0, c, TIC80_HEIGHT, color); @@ -58,7 +58,7 @@ static void drawGrid(World* world) } world->tic->api.rect_border(world->tic, map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE, - TIC_MAP_SCREEN_WIDTH+1, TIC_MAP_SCREEN_HEIGHT+1, systemColor(tic_color_red)); + TIC_MAP_SCREEN_WIDTH+1, TIC_MAP_SCREEN_HEIGHT+1, (tic_color_red)); } static void processKeydown(World* world, SDL_Keycode keycode)