From 03efd9051855ad61cc7fbd4eba09a3284f9dd6f5 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Mon, 12 Mar 2018 15:33:18 +0300 Subject: [PATCH] Add font width/height to the config #568 --- bin/assets/config.tic.dat | 2 +- config.tic | Bin 14450 -> 14489 bytes src/code.c | 116 ++++++----- src/code.h | 8 +- src/config.c | 29 +++ src/console.c | 77 ++++---- src/console.h | 2 +- src/dialog.c | 8 +- src/map.c | 13 +- src/menu.c | 6 +- src/music.c | 135 +++++++------ src/sfx.c | 82 ++++---- src/sprite.c | 9 +- src/start.c | 21 +- src/studio.c | 33 ++-- src/studio.h | 10 +- src/surf.c | 14 +- src/system.h | 6 + src/tic.c | 396 +++++++++++++++++++------------------- src/tic.h | 8 - src/tic80.c | 8 +- src/ticapi.h | 10 +- 22 files changed, 558 insertions(+), 435 deletions(-) diff --git a/bin/assets/config.tic.dat b/bin/assets/config.tic.dat index 161ea4a..c190bb3 100644 --- a/bin/assets/config.tic.dat +++ b/bin/assets/config.tic.dat @@ -1 +1 @@ -0x78, 0xda, 0xed, 0x19, 0x4b, 0x6c, 0x1b, 0xc7, 0x75, 0x1d, 0x3b, 0x6d, 0xc8, 0xb8, 0x1e, 0x0b, 0x28, 0x82, 0x7e, 0xd2, 0x66, 0xa1, 0xa6, 0x2d, 0x29, 0x91, 0x14, 0x45, 0x4a, 0xaa, 0x6b, 0x77, 0x9b, 0xca, 0x22, 0x2d, 0xa9, 0xd1, 0xc7, 0x90, 0xc4, 0xb8, 0x81, 0x91, 0xa8, 0x2b, 0x72, 0x29, 0x11, 0xa1, 0xb8, 0xea, 0x2e, 0x69, 0x49, 0x0e, 0x04, 0x04, 0x01, 0x02, 0xa8, 0x27, 0xb7, 0x80, 0x0b, 0x54, 0x27, 0xa5, 0xc8, 0x4d, 0xbd, 0xf4, 0xe2, 0x4b, 0x75, 0x30, 0xda, 0x63, 0x80, 0x16, 0x45, 0x50, 0xf4, 0x50, 0x14, 0xbd, 0x14,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xca, 0x1e, 0xd3, 0x63, 0xfa, 0x96, 0xd9, 0x6a, 0xc0, 0x44, 0xab, 0x93, 0xc9, 0xaa, 0x20, 0x9b, 0x7f, 0xc9, 0x87, 0xbb, 0x52, 0x91, 0x05, 0xa1, 0x77, 0x31, 0x0e, 0x52, 0x62, 0xfa, 0x80, 0x24, 0x63, 0x75, 0xb5, 0xf5, 0xf6, 0xea, 0x35, 0x4b, 0x5f, 0x67, 0x4f, 0x27, 0xb8, 0x14, 0xf0, 0xa3, 0x99, 0xbd, 0x8c, 0x72, 0xfc, 0x2d, 0x84, 0xa2, 0xb1, 0xa5, 0x85, 0x5d, 0x8d, 0x3d, 0x64, 0xf2, 0x62, 0x04, 0x37, 0xea, 0x94, 0xab, 0x58, 0x8d, 0xd9, 0x9d, 0x01, 0x46, 0x3c, 0x0a, 0xdb, 0x9c, 0xc2, 0x06, 0xe6, 0xbd, 0x74, 0xca, 0xdb, 0xa8, 0x6d, 0x5a, 0x78, 0xe7, 0xd0, 0x30, 0x4c, 0xd0, 0x26, 0x43, 0xcc, 0x44, 0x11, 0x3e, 0x70, 0xd7, 0x20, 0x06, 0xbc, 0x17, 0x80, 0xee, 0x98, 0xb8, 0xbf, 0x65, 0xa2, 0xc4, 0xb2, 0xae, 0x4f, 0xef, 0xa5, 0xdf, 0x78, 0x23, 0xfd, 0x5f, 0x1c, 0x33, 0x8b, 0xc5, \ No newline at end of file +0x78, 0xda, 0xed, 0x19, 0x4b, 0x6c, 0x1b, 0xc7, 0x75, 0x1d, 0x3b, 0x6d, 0xc8, 0xb8, 0x1e, 0x0b, 0x28, 0x82, 0x7e, 0xd2, 0x66, 0xa1, 0xa6, 0x2d, 0x29, 0x91, 0x14, 0x45, 0x4a, 0xaa, 0x6b, 0x77, 0x9b, 0xca, 0x22, 0x2d, 0xa9, 0x91, 0x44, 0x43, 0x9f, 0xb8, 0x81, 0x91, 0xa8, 0x2b, 0x72, 0x57, 0x22, 0x42, 0x71, 0xd5, 0x5d, 0xd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7b, 0xe9, 0x37, 0xde, 0x48, 0xff, 0x17, 0x24, 0x16, 0x93, 0x7f, \ No newline at end of file diff --git a/config.tic b/config.tic index 84ac7e2e3b916ba485437b65f04878111632bcf2..6e1b0b431946abf46fee84dbbc7f7c525837f7a1 100644 GIT binary patch delta 53 zcmexVFtcz&yBgz;%^hl1jEbCGoNoSpA+}tc)m)sM;hrub9=2vWK&FSQr@Kdpt=Z;1 H>e~bWyh0B> delta 19 bcmbPP_^Dt+yBg!f%^hl1jGJGoZx8?gTk{Be diff --git a/src/code.c b/src/code.c index 47daef3..cac3542 100644 --- a/src/code.c +++ b/src/code.c @@ -27,16 +27,19 @@ #define TEXT_CURSOR_DELAY (TIC_FRAMERATE / 2) #define TEXT_CURSOR_BLINK_PERIOD TIC_FRAMERATE -#define TEXT_BUFFER_WIDTH STUDIO_TEXT_BUFFER_WIDTH -#define TEXT_BUFFER_HEIGHT ((TIC80_HEIGHT - TOOLBAR_SIZE - STUDIO_TEXT_HEIGHT) / STUDIO_TEXT_HEIGHT) + +static inline s32 TextBufferHeight(const tic_mem* tic) +{ + return ((TIC80_HEIGHT - TOOLBAR_SIZE - TextHeight(tic)) / TextHeight(tic)); +} struct OutlineItem { - char name[STUDIO_TEXT_BUFFER_WIDTH]; + char name[TIC80_WIDTH]; char* pos; }; -#define OUTLINE_SIZE ((TIC80_HEIGHT - TOOLBAR_SIZE*2)/TIC_FONT_HEIGHT) +#define OUTLINE_SIZE (TIC80_HEIGHT) #define OUTLINE_ITEMS_SIZE (OUTLINE_SIZE * sizeof(OutlineItem)) static void history(Code* code) @@ -47,18 +50,23 @@ 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, (tic_color_white)); - code->tic->api.fixed_text(code->tic, code->status, 0, TIC80_HEIGHT - TIC_FONT_HEIGHT, getConfig()->theme.code.bg); + tic_mem* tic = code->tic; + const s32 Height = tic->font.height + 1; + + tic->api.rect(tic, 0, TIC80_HEIGHT - Height, TIC80_WIDTH, Height, (tic_color_white)); + tic->api.fixed_text(tic, code->status.left, 0, TIC80_HEIGHT - tic->font.height, getConfig()->theme.code.bg); + tic->api.fixed_text(tic, code->status.right, TIC80_WIDTH - (strlen(code->status.right) * tic->font.width), + TIC80_HEIGHT - tic->font.height, getConfig()->theme.code.bg); } static void drawCursor(Code* code, s32 x, s32 y, char symbol) { + tic_mem* tic = code->tic; bool inverse = code->cursor.delay || code->tickCounter % TEXT_CURSOR_BLINK_PERIOD < TEXT_CURSOR_BLINK_PERIOD / 2; if(inverse) { - code->tic->api.rect(code->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, getConfig()->theme.code.cursor); + code->tic->api.rect(code->tic, x-1, y-1, tic->font.width+1, tic->font.height+1, getConfig()->theme.code.cursor); if(symbol) code->tic->api.draw_char(code->tic, symbol, x, y, getConfig()->theme.code.bg); @@ -67,9 +75,10 @@ static void drawCursor(Code* code, s32 x, s32 y, char symbol) static void drawCode(Code* code, bool withCursor) { - s32 xStart = code->rect.x - code->scroll.x * STUDIO_TEXT_WIDTH; + tic_mem* tic = code->tic; + s32 xStart = code->rect.x - code->scroll.x * TextWidth(tic); s32 x = xStart; - s32 y = code->rect.y - code->scroll.y * STUDIO_TEXT_HEIGHT; + s32 y = code->rect.y - code->scroll.y * TextHeight(tic); char* pointer = code->src; u8* colorPointer = code->colorBuffer; @@ -83,10 +92,10 @@ static void drawCode(Code* code, bool withCursor) { char symbol = *pointer; - if(x >= -TIC_FONT_WIDTH && x < TIC80_WIDTH && y >= -TIC_FONT_HEIGHT && y < TIC80_HEIGHT ) + if(x >= -tic->font.width && x < TIC80_WIDTH && y >= -tic->font.height && y < TIC80_HEIGHT ) { if(code->cursor.selection && pointer >= selection.start && pointer < selection.end) - code->tic->api.rect(code->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, getConfig()->theme.code.select); + code->tic->api.rect(code->tic, x-1, y-1, tic->font.width+1, tic->font.height+1, getConfig()->theme.code.select); else if(getConfig()->theme.code.shadow) { code->tic->api.draw_char(code->tic, symbol, x+1, y+1, 0); @@ -101,9 +110,9 @@ static void drawCode(Code* code, bool withCursor) if(symbol == '\n') { x = xStart; - y += STUDIO_TEXT_HEIGHT; + y += TextHeight(tic); } - else x += STUDIO_TEXT_WIDTH; + else x += TextWidth(tic); pointer++; colorPointer++; @@ -159,34 +168,31 @@ static void removeInvalidChars(char* code) static void updateEditor(Code* code) { + tic_mem* tic = code->tic; + s32 column = 0; s32 line = 0; getCursorPosition(code, &column, &line); if(column < code->scroll.x) code->scroll.x = column; - else if(column >= code->scroll.x + TEXT_BUFFER_WIDTH) - code->scroll.x = column - TEXT_BUFFER_WIDTH + 1; + else if(column >= code->scroll.x + BufferWidth(tic)) + code->scroll.x = column - BufferWidth(tic) + 1; if(line < code->scroll.y) code->scroll.y = line; - else if(line >= code->scroll.y + TEXT_BUFFER_HEIGHT) - code->scroll.y = line - TEXT_BUFFER_HEIGHT + 1; + else if(line >= code->scroll.y + TextBufferHeight(tic)) + code->scroll.y = line - TextBufferHeight(tic) + 1; code->cursor.delay = TEXT_CURSOR_DELAY; // update status { - memset(code->status, ' ', sizeof code->status - 1); - - char status[STUDIO_TEXT_BUFFER_WIDTH]; s32 count = getLinesCount(code); - sprintf(status, "line %i/%i col %i", line + 1, count + 1, column + 1); - memcpy(code->status, status, strlen(status)); + sprintf(code->status.left, "line %i/%i col %i", line + 1, count + 1, column + 1); size_t codeLen = strlen(code->src); - sprintf(status, "%i/%i", (u32)codeLen, TIC_CODE_SIZE); + sprintf(code->status.right, "%i/%i", (u32)codeLen, TIC_CODE_SIZE); memset(code->src + codeLen, '\0', TIC_CODE_SIZE - codeLen); - memcpy(code->status + sizeof code->status - strlen(status) - 1, status, strlen(status)); } } @@ -403,19 +409,21 @@ static void goCodeEnd(Code *code) static void pageUp(Code* code) { + tic_mem* tic = code->tic; s32 column = 0; s32 line = 0; getCursorPosition(code, &column, &line); - setCursorPosition(code, column, line > TEXT_BUFFER_HEIGHT ? line - TEXT_BUFFER_HEIGHT : 0); + setCursorPosition(code, column, line > TextBufferHeight(tic) ? line - TextBufferHeight(tic) : 0); } static void pageDown(Code* code) { + tic_mem* tic = code->tic; s32 column = 0; s32 line = 0; getCursorPosition(code, &column, &line); s32 lines = getLinesCount(code); - setCursorPosition(code, column, line < lines - TEXT_BUFFER_HEIGHT ? line + TEXT_BUFFER_HEIGHT : lines); + setCursorPosition(code, column, line < lines - TextBufferHeight(tic) ? line + TextBufferHeight(tic) : lines); } static bool replaceSelection(Code* code) @@ -726,10 +734,12 @@ static void normalizeScroll(Code* code) static void centerScroll(Code* code) { + tic_mem* tic = code->tic; + s32 col, line; getCursorPosition(code, &col, &line); - code->scroll.x = col - TEXT_BUFFER_WIDTH / 2; - code->scroll.y = line - TEXT_BUFFER_HEIGHT / 2; + code->scroll.x = col - BufferWidth(tic) / 2; + code->scroll.y = line - TextBufferHeight(tic) / 2; normalizeScroll(code); } @@ -772,8 +782,8 @@ static void initOutlineMode(Code* code) tic_mem* tic = code->tic; - char buffer[STUDIO_TEXT_BUFFER_WIDTH] = {0}; - char filter[STUDIO_TEXT_BUFFER_WIDTH] = {0}; + char buffer[TIC80_WIDTH] = {0}; + char filter[TIC80_WIDTH] = {0}; strncpy(filter, code->popup.text, sizeof(filter)); ticStrlwr(filter); @@ -792,8 +802,8 @@ static void initOutlineMode(Code* code) if(out < end) { out->pos = code->src + item->pos; - memset(out->name, 0, STUDIO_TEXT_BUFFER_WIDTH); - memcpy(out->name, out->pos, MIN(item->size, STUDIO_TEXT_BUFFER_WIDTH-1)); + memset(out->name, 0, TIC80_WIDTH); + memcpy(out->name, out->pos, MIN(item->size, TIC80_WIDTH-1)); if(*filter) { @@ -966,8 +976,8 @@ static void processMouse(Code* code) { if(checkMouseDown(&code->rect, tic_mouse_right)) { - code->scroll.x = (code->scroll.start.x - getMouseX()) / STUDIO_TEXT_WIDTH; - code->scroll.y = (code->scroll.start.y - getMouseY()) / STUDIO_TEXT_HEIGHT; + code->scroll.x = (code->scroll.start.x - getMouseX()) / TextWidth(tic); + code->scroll.y = (code->scroll.start.y - getMouseY()) / TextHeight(tic); normalizeScroll(code); } @@ -980,8 +990,8 @@ static void processMouse(Code* code) s32 mx = getMouseX(); s32 my = getMouseY(); - s32 x = (mx - code->rect.x) / STUDIO_TEXT_WIDTH; - s32 y = (my - code->rect.y) / STUDIO_TEXT_HEIGHT; + s32 x = (mx - code->rect.x) / TextWidth(tic); + s32 y = (my - code->rect.y) / TextHeight(tic); char* position = code->cursor.position; setCursorPosition(code, x + code->scroll.x, y + code->scroll.y); @@ -1009,8 +1019,8 @@ static void processMouse(Code* code) { code->scroll.active = true; - code->scroll.start.x = getMouseX() + code->scroll.x * STUDIO_TEXT_WIDTH; - code->scroll.start.y = getMouseY() + code->scroll.y * STUDIO_TEXT_HEIGHT; + code->scroll.start.x = getMouseX() + code->scroll.x * TextWidth(tic); + code->scroll.start.y = getMouseY() + code->scroll.y * TextHeight(tic); } } @@ -1058,14 +1068,16 @@ static void textEditTick(Code* code) static void drawPopupBar(Code* code, const char* title) { + tic_mem* tic = code->tic; + enum {TextY = TOOLBAR_SIZE + 1}; - code->tic->api.rect(code->tic, 0, TOOLBAR_SIZE, TIC80_WIDTH, TIC_FONT_HEIGHT + 1, (tic_color_blue)); + 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, (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, ' '); + drawCursor(code, (s32)(strlen(title) + strlen(code->popup.text)) * tic->font.width, TextY, ' '); } static void updateFindCode(Code* code, char* pos) @@ -1203,8 +1215,8 @@ static void textGoToTick(Code* code) tic->api.clear(tic, getConfig()->theme.code.bg); if(code->jump.line >= 0) - tic->api.rect(tic, 0, (code->jump.line - code->scroll.y) * (TIC_FONT_HEIGHT+1) + TOOLBAR_SIZE, - TIC80_WIDTH, TIC_FONT_HEIGHT+2, getConfig()->theme.code.select); + tic->api.rect(tic, 0, (code->jump.line - code->scroll.y) * (tic->font.height+1) + TOOLBAR_SIZE, + TIC80_WIDTH, tic->font.height+2, getConfig()->theme.code.select); drawCode(code, false); drawPopupBar(code, " GOTO:"); @@ -1213,12 +1225,14 @@ static void textGoToTick(Code* code) static void drawOutlineBar(Code* code, s32 x, s32 y) { + tic_mem* tic = code->tic; + tic_rect rect = {x, y, TIC80_WIDTH - x, TIC80_HEIGHT - y}; if(checkMousePos(&rect)) { s32 mx = getMouseY() - rect.y; - mx /= STUDIO_TEXT_HEIGHT; + mx /= TextHeight(tic); if(mx < OUTLINE_SIZE && code->outline.items[mx].pos) { @@ -1244,13 +1258,13 @@ 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, (tic_color_red)); + code->tic->api.rect(code->tic, rect.x - 1, rect.y + code->outline.index*TextHeight(tic), + rect.w + 1, tic->font.height + 1, (tic_color_red)); while(ptr->pos) { code->tic->api.fixed_text(code->tic, ptr->name, x, y, (tic_color_white)); ptr++; - y += STUDIO_TEXT_HEIGHT; + y += TextHeight(tic); } } else code->tic->api.fixed_text(code->tic, "(empty)", x, y, (tic_color_white)); @@ -1258,6 +1272,8 @@ static void drawOutlineBar(Code* code, s32 x, s32 y) static void textOutlineTick(Code* code) { + tic_mem* tic = code->tic; + if(keyWasPressed(tic_key_up)) { if(code->outline.index > 0) @@ -1305,7 +1321,7 @@ static void textOutlineTick(Code* code) drawCode(code, false); drawPopupBar(code, " FUNC:"); drawStatus(code); - drawOutlineBar(code, TIC80_WIDTH - 12 * TIC_FONT_WIDTH, 2*(TIC_FONT_HEIGHT+1)); + drawOutlineBar(code, TIC80_WIDTH - 12 * tic->font.width, 2*(tic->font.height+1)); } static void drawCodeToolbar(Code* code) @@ -1455,7 +1471,7 @@ void initCode(Code* code, tic_mem* tic, tic_code* src) .tick = tick, .escape = escape, .cursor = {{src->data, NULL, 0}, NULL, 0}, - .rect = {0, TOOLBAR_SIZE + 1, TIC80_WIDTH, TIC80_HEIGHT - TOOLBAR_SIZE - TIC_FONT_HEIGHT - 1}, + .rect = {0, TOOLBAR_SIZE + 1, TIC80_WIDTH, TIC80_HEIGHT - TOOLBAR_SIZE - tic->font.height - 1}, .scroll = {0, 0, {0, 0}, false}, .tickCounter = 0, .history = NULL, diff --git a/src/code.h b/src/code.h index f084711..1326111 100644 --- a/src/code.h +++ b/src/code.h @@ -62,7 +62,11 @@ struct Code u8 colorBuffer[TIC_CODE_SIZE]; - char status[STUDIO_TEXT_BUFFER_WIDTH+1]; + struct + { + char left[TIC80_WIDTH]; + char right[TIC80_WIDTH]; + } status; u32 tickCounter; @@ -80,7 +84,7 @@ struct Code struct { - char text[STUDIO_TEXT_BUFFER_WIDTH - sizeof "FIND:"]; + char text[TIC80_WIDTH]; char* prevPos; char* prevSel; diff --git a/src/config.c b/src/config.c index 88a7e43..63b0541 100644 --- a/src/config.c +++ b/src/config.c @@ -196,6 +196,34 @@ static void readCodeTheme(Config* config, lua_State* lua) lua_pop(lua, 1); } +static void readFontTheme(Config* config, lua_State* lua) +{ + lua_getfield(lua, -1, "FONT"); + + if(lua_type(lua, -1) == LUA_TTABLE) + { + { + lua_getfield(lua, -1, "WIDTH"); + + if(lua_isinteger(lua, -1)) + config->data.theme.font.width = lua_tointeger(lua, -1); + + lua_pop(lua, 1); + } + + { + lua_getfield(lua, -1, "HEIGHT"); + + if(lua_isinteger(lua, -1)) + config->data.theme.font.height = lua_tointeger(lua, -1); + + lua_pop(lua, 1); + } + } + + lua_pop(lua, 1); +} + static void readGamepadTheme(Config* config, lua_State* lua) { lua_getfield(lua, -1, "GAMEPAD"); @@ -229,6 +257,7 @@ static void readTheme(Config* config, lua_State* lua) readCursorTheme(config, lua); readCodeTheme(config, lua); readGamepadTheme(config, lua); + readFontTheme(config, lua); } lua_pop(lua, 1); diff --git a/src/console.c b/src/console.c index 9d590ab..aefdf82 100644 --- a/src/console.c +++ b/src/console.c @@ -45,10 +45,7 @@ #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) -#define CONSOLE_BUFFER_HEIGHT (STUDIO_TEXT_BUFFER_HEIGHT) #define CONSOLE_BUFFER_SCREENS 64 -#define CONSOLE_BUFFER_SIZE (CONSOLE_BUFFER_WIDTH * CONSOLE_BUFFER_HEIGHT * CONSOLE_BUFFER_SCREENS) typedef enum { @@ -109,7 +106,11 @@ static const char DefaultJSTicPath[] = TIC_LOCAL "default_js.tic"; #if defined(TIC_BUILD_WITH_WREN) static const char DefaultWrenTicPath[] = TIC_LOCAL "default_wren.tic"; #endif - + +static inline s32 BufferSize(const tic_mem* tic) +{ + return BufferWidth(tic) * BufferHeight(tic) * CONSOLE_BUFFER_SCREENS; +} static const char* getName(const char* name, const char* ext) { @@ -131,29 +132,33 @@ static const char* getCartName(const char* name) return getName(name, CART_EXT); } -static void scrollBuffer(char* buffer) +static void scrollBuffer(tic_mem* tic, char* buffer) { - memmove(buffer, buffer + CONSOLE_BUFFER_WIDTH, CONSOLE_BUFFER_SIZE - CONSOLE_BUFFER_WIDTH); - memset(buffer + CONSOLE_BUFFER_SIZE - CONSOLE_BUFFER_WIDTH, 0, CONSOLE_BUFFER_WIDTH); + memmove(buffer, buffer + BufferWidth(tic), BufferSize(tic) - BufferWidth(tic)); + memset(buffer + BufferSize(tic) - BufferWidth(tic), 0, BufferWidth(tic)); } static void scrollConsole(Console* console) { - while(console->cursor.y >= CONSOLE_BUFFER_HEIGHT * CONSOLE_BUFFER_SCREENS) + tic_mem* tic = console->tic; + + while(console->cursor.y >= BufferHeight(tic) * CONSOLE_BUFFER_SCREENS) { - scrollBuffer(console->buffer); - scrollBuffer((char*)console->colorBuffer); + scrollBuffer(tic, console->buffer); + scrollBuffer(tic, (char*)console->colorBuffer); console->cursor.y--; } - s32 minScroll = console->cursor.y - CONSOLE_BUFFER_HEIGHT + 1; + s32 minScroll = console->cursor.y - BufferHeight(tic) + 1; if(console->scroll.pos < minScroll) console->scroll.pos = minScroll; } static void consolePrint(Console* console, const char* text, u8 color) { + tic_mem* tic = console->tic; + printf("%s", text); const char* textPointer = text; @@ -172,13 +177,13 @@ static void consolePrint(Console* console, const char* text, u8 color) } else { - s32 offset = console->cursor.x + console->cursor.y * CONSOLE_BUFFER_WIDTH; + s32 offset = console->cursor.x + console->cursor.y * BufferWidth(tic); *(console->buffer + offset) = symbol; *(console->colorBuffer + offset) = color; console->cursor.x++; - if(console->cursor.x >= CONSOLE_BUFFER_WIDTH) + if(console->cursor.x >= BufferWidth(tic)) { console->cursor.x = 0; console->cursor.y++; @@ -228,20 +233,22 @@ static void commandDone(Console* console) static void drawCursor(Console* console, s32 x, s32 y, u8 symbol) { + tic_mem* tic = console->tic; bool inverse = console->cursor.delay || console->tickCounter % CONSOLE_CURSOR_BLINK_PERIOD < CONSOLE_CURSOR_BLINK_PERIOD / 2; if(inverse) - console->tic->api.rect(console->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, CONSOLE_CURSOR_COLOR); + console->tic->api.rect(console->tic, x-1, y-1, tic->font.width+1, tic->font.height+1, CONSOLE_CURSOR_COLOR); console->tic->api.draw_char(console->tic, symbol, x, y, inverse ? TIC_COLOR_BG : CONSOLE_FRONT_TEXT_COLOR); } static void drawConsoleText(Console* console) { - char* pointer = console->buffer + console->scroll.pos * CONSOLE_BUFFER_WIDTH; - u8* colorPointer = console->colorBuffer + console->scroll.pos * CONSOLE_BUFFER_WIDTH; + tic_mem* tic = console->tic; + char* pointer = console->buffer + console->scroll.pos * BufferWidth(tic); + u8* colorPointer = console->colorBuffer + console->scroll.pos * BufferWidth(tic); - const char* end = console->buffer + CONSOLE_BUFFER_SIZE; + const char* end = console->buffer + BufferSize(tic); s32 x = 0; s32 y = 0; @@ -251,9 +258,9 @@ static void drawConsoleText(Console* console) u8 color = *colorPointer++; if(symbol) - console->tic->api.draw_char(console->tic, symbol, x * STUDIO_TEXT_WIDTH, y * STUDIO_TEXT_HEIGHT, color); + console->tic->api.draw_char(console->tic, symbol, x * TextWidth(tic), y * TextHeight(tic), color); - if(++x == CONSOLE_BUFFER_WIDTH) + if(++x == BufferWidth(tic)) { y++; x = 0; @@ -263,8 +270,9 @@ static void drawConsoleText(Console* console) static void drawConsoleInputText(Console* console) { - s32 x = console->cursor.x * STUDIO_TEXT_WIDTH; - s32 y = (console->cursor.y - console->scroll.pos) * STUDIO_TEXT_HEIGHT; + tic_mem* tic = console->tic; + s32 x = console->cursor.x * TextWidth(tic); + s32 y = (console->cursor.y - console->scroll.pos) * TextHeight(tic); const char* pointer = console->inputBuffer; const char* end = pointer + strlen(console->inputBuffer); @@ -281,10 +289,10 @@ static void drawConsoleInputText(Console* console) index++; - x += STUDIO_TEXT_WIDTH; - if(x == (CONSOLE_BUFFER_WIDTH * STUDIO_TEXT_WIDTH)) + x += TextWidth(tic); + if(x == (BufferWidth(tic) * TextWidth(tic))) { - y += STUDIO_TEXT_HEIGHT; + y += TextHeight(tic); x = 0; } @@ -1315,8 +1323,9 @@ static void onConsoleFolderCommand(Console* console, const char* param) static void onConsoleClsCommand(Console* console, const char* param) { - memset(console->buffer, 0, CONSOLE_BUFFER_SIZE); - memset(console->colorBuffer, TIC_COLOR_BG, CONSOLE_BUFFER_SIZE); + tic_mem* tic = console->tic; + memset(console->buffer, 0, BufferSize(tic)); + memset(console->colorBuffer, TIC_COLOR_BG, BufferSize(tic)); console->scroll.pos = 0; console->cursor.x = console->cursor.y = 0; @@ -2240,6 +2249,8 @@ static void onConsoleDelCommand(Console* console, const char* param) static void printTable(Console* console, const char* text) { + tic_mem* tic = console->tic; + printf("%s", text); const char* textPointer = text; @@ -2258,7 +2269,7 @@ static void printTable(Console* console, const char* text) } else { - s32 offset = console->cursor.x + console->cursor.y * CONSOLE_BUFFER_WIDTH; + s32 offset = console->cursor.x + console->cursor.y * BufferWidth(tic); *(console->buffer + offset) = symbol; u8 color = 0; @@ -2278,7 +2289,7 @@ static void printTable(Console* console, const char* text) console->cursor.x++; - if(console->cursor.x >= CONSOLE_BUFFER_WIDTH) + if(console->cursor.x >= BufferWidth(tic)) { console->cursor.x = 0; console->cursor.y++; @@ -2290,7 +2301,7 @@ static void printTable(Console* console, const char* text) static void printRamInfo(Console* console, s32 addr, const char* name, s32 size) { - char buf[STUDIO_TEXT_BUFFER_WIDTH]; + char buf[TIC80_WIDTH]; sprintf(buf, "\n| %05X | %-17s | %-5i |", addr, name, size); printTable(console, buf); } @@ -3023,8 +3034,8 @@ static bool cmdInjectMap(Console* console, const char* param, const char* name) void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config, s32 argc, char **argv) { - if(!console->buffer) console->buffer = malloc(CONSOLE_BUFFER_SIZE); - if(!console->colorBuffer) console->colorBuffer = malloc(CONSOLE_BUFFER_SIZE); + if(!console->buffer) console->buffer = malloc(BufferSize(tic)); + if(!console->colorBuffer) console->colorBuffer = malloc(BufferSize(tic)); if(!console->embed.file) console->embed.file = malloc(sizeof(tic_cartridge)); *console = (Console) @@ -3076,8 +3087,8 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config, .crtMonitor = false, }; - memset(console->buffer, 0, CONSOLE_BUFFER_SIZE); - memset(console->colorBuffer, TIC_COLOR_BG, CONSOLE_BUFFER_SIZE); + memset(console->buffer, 0, BufferSize(tic)); + memset(console->colorBuffer, TIC_COLOR_BG, BufferSize(tic)); memset(console->codeLiveReload.fileName, 0, FILENAME_MAX); diff --git a/src/console.h b/src/console.h index dcfb97e..6dffa43 100644 --- a/src/console.h +++ b/src/console.h @@ -78,7 +78,7 @@ struct Console char* buffer; u8* colorBuffer; - char inputBuffer[STUDIO_TEXT_BUFFER_WIDTH * STUDIO_TEXT_BUFFER_HEIGHT]; + char inputBuffer[TIC80_WIDTH]; size_t inputPosition; tic_mem* tic; diff --git a/src/dialog.c b/src/dialog.c index 3dd84c3..6c19cf6 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -57,7 +57,7 @@ static void drawButton(Dialog* dlg, const char* label, s32 x, s32 y, u8 color, u 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); + s32 size = tic->api.text(tic, label, 0, -tic->font.height, 0); tic->api.text(tic, label, rect.x + (BtnWidth - size+1)/2, rect.y + (down?3:2), over ? overColor : color); if(dlg->focus == id) @@ -162,7 +162,7 @@ static void drawDialog(Dialog* dlg) { static const char Label[] = "WARNING!"; - s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, 0); + 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), (tic_color_gray)); } @@ -174,10 +174,10 @@ static void drawDialog(Dialog* dlg) { for(s32 i = 0; i < dlg->rows; i++) { - s32 size = tic->api.text(tic, dlg->text[i], 0, -TIC_FONT_HEIGHT, 0); + s32 size = tic->api.text(tic, dlg->text[i], 0, -tic->font.height, 0); s32 x = rect.x + (Width - size)/2; - s32 y = rect.y + (TIC_FONT_HEIGHT+1)*(i+1); + s32 y = rect.y + (tic->font.height+1)*(i+1); 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)); } diff --git a/src/map.c b/src/map.c index ae3806f..2f1d2fa 100644 --- a/src/map.c +++ b/src/map.c @@ -334,9 +334,11 @@ static void drawTileIndex(Map* map, s32 x, s32 y) static void drawMapToolbar(Map* map, s32 x, s32 y) { + tic_mem* tic = map->tic; + map->tic->api.rect(map->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); - drawTileIndex(map, TIC80_WIDTH/2 - TIC_FONT_WIDTH, y); + drawTileIndex(map, TIC80_WIDTH/2 - tic->font.width, y); x = drawSheetButton(map, TIC80_WIDTH, 0); x = drawFillButton(map, x, 0); @@ -417,6 +419,8 @@ static void drawSheetOvr(Map* map, s32 x, s32 y) static void drawCursorPos(Map* map, s32 x, s32 y) { + tic_mem* tic = map->tic; + char pos[] = "999:999"; s32 tx = 0, ty = 0; @@ -429,10 +433,10 @@ static void drawCursorPos(Map* map, s32 x, s32 y) s32 px = x + (TIC_SPRITESIZE + 3); if(px + width >= TIC80_WIDTH) px = x - (width + 2); - s32 py = y - (TIC_FONT_HEIGHT + 2); + 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, (tic_color_white)); + 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)); } @@ -1060,13 +1064,14 @@ static void processKeyboard(Map* map) static void tick(Map* map) { + tic_mem* tic = map->tic; map->tickCounter++; processKeyboard(map); map->tic->api.clear(map->tic, TIC_COLOR_BG); drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE); - drawMapToolbar(map, TIC80_WIDTH - 9*TIC_FONT_WIDTH, 1); + drawMapToolbar(map, TIC80_WIDTH - 9*tic->font.width, 1); drawToolbar(map->tic, TIC_COLOR_BG, false); } diff --git a/src/menu.c b/src/menu.c index 36e3208..8f5875a 100644 --- a/src/menu.c +++ b/src/menu.c @@ -118,7 +118,7 @@ static void drawDialog(Menu* menu) { static const char Label[] = "GAME MENU"; - s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, 0); + 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), (tic_color_gray)); } @@ -252,7 +252,7 @@ static void drawGamepadMenu(Menu* menu) static const char Label[] = "BACK"; - tic_rect rect = {dlgRect.x + 25, dlgRect.y + 49, (sizeof(Label)-1)*TIC_FONT_WIDTH, TIC_FONT_HEIGHT}; + tic_rect rect = {dlgRect.x + 25, dlgRect.y + 49, (sizeof(Label)-1)*tic->font.width, tic->font.height}; bool over = false; bool down = false; @@ -320,7 +320,7 @@ static void drawMainMenu(Menu* menu) { if(!*Rows[i])continue; - tic_rect label = {rect.x + 22, rect.y + (TIC_FONT_HEIGHT+1)*i + 16, 86, TIC_FONT_HEIGHT+1}; + tic_rect label = {rect.x + 22, rect.y + (tic->font.height+1)*i + 16, 86, tic->font.height+1}; bool over = false; bool down = false; diff --git a/src/music.c b/src/music.c index ab8cec9..00f38b6 100644 --- a/src/music.c +++ b/src/music.c @@ -66,6 +66,7 @@ static void drawDownBorder(Music* music, s32 x, s32 y, s32 w, s32 h) static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*, s32, s32 channel), s32 channel) { + tic_mem* tic = music->tic; static const u8 LeftArrow[] = { 0b00100000, @@ -90,8 +91,12 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* 0b00000000, }; + enum{ArrowWidth = 4, ArrowHeight = 6}; + + x -= ArrowWidth + 2; + { - tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT }; + tic_rect rect = { x, y, ArrowWidth, ArrowHeight }; bool over = false; bool down = false; @@ -111,9 +116,9 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* } { - x += TIC_FONT_WIDTH; + x += ArrowWidth + 2; - tic_rect rect = { x-1, y-1, TIC_FONT_WIDTH*2+1, TIC_FONT_HEIGHT+1 }; + tic_rect rect = { x-1, y-1, tic->font.width*2+1, tic->font.height+1 }; if (checkMousePos(&rect)) { @@ -125,7 +130,7 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* music->tracker.col = channel * CHANNEL_COLS; s32 mx = getMouseX() - rect.x; - music->tracker.patternCol = mx / TIC_FONT_WIDTH; + music->tracker.patternCol = mx / tic->font.width; } } @@ -134,7 +139,7 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* 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, (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"; @@ -143,9 +148,9 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* } { - x += 2*TIC_FONT_WIDTH; + x += 2*tic->font.width; - tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT }; + tic_rect rect = { x, y, ArrowWidth, ArrowHeight }; bool over = false; bool down = false; @@ -167,13 +172,14 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music* static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value, void(*set)(Music*, s32, void* data), void* data) { + tic_mem* tic = music->tic; static const u8 LeftArrow[] = { - 0b00010000, - 0b00110000, - 0b01110000, - 0b00110000, - 0b00010000, + 0b00100000, + 0b01100000, + 0b11100000, + 0b01100000, + 0b00100000, 0b00000000, 0b00000000, 0b00000000, @@ -181,23 +187,25 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value, static const u8 RightArrow[] = { - 0b01000000, - 0b01100000, - 0b01110000, - 0b01100000, - 0b01000000, + 0b10000000, + 0b11000000, + 0b11100000, + 0b11000000, + 0b10000000, 0b00000000, 0b00000000, 0b00000000, }; + enum{ArrowWidth = 4, ArrowHeight = 6}; + music->tic->api.text(music->tic, label, x, y+1, (tic_color_black)); music->tic->api.text(music->tic, label, x, y, (tic_color_white)); { - x += (s32)strlen(label)*TIC_FONT_WIDTH; + x += (s32)strlen(label)*tic->font.width + 1; - tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT }; + tic_rect rect = { x, y, ArrowWidth, ArrowHeight}; bool over = false; bool down = false; @@ -218,16 +226,17 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value, } { + x += ArrowWidth; char val[] = "999"; sprintf(val, "%02i", value); - music->tic->api.fixed_text(music->tic, val, x + TIC_FONT_WIDTH, y+1, (tic_color_black)); - music->tic->api.fixed_text(music->tic, val, x += TIC_FONT_WIDTH, y, (tic_color_white)); + music->tic->api.fixed_text(music->tic, val, x, y+1, (tic_color_black)); + music->tic->api.fixed_text(music->tic, val, x, y, (tic_color_white)); } { - x += (value > 99 ? 3 : 2)*TIC_FONT_WIDTH; + x += (value > 99 ? 3 : 2)*tic->font.width; - tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT }; + tic_rect rect = { x, y, ArrowWidth, ArrowHeight}; bool over = false; bool down = false; @@ -1105,24 +1114,28 @@ static void setRows(Music* music, s32 delta, void* data) static void drawTopPanel(Music* music, s32 x, s32 y) { + tic_mem* tic = music->tic; tic_track* track = getTrack(music); drawSwitch(music, x, y, "TRACK", music->track, setIndex, NULL); - drawSwitch(music, x += TIC_FONT_WIDTH * 10, y, "TEMPO", track->tempo + DEFAULT_TEMPO, setTempo, NULL); - drawSwitch(music, x += TIC_FONT_WIDTH * 11, y, "SPD", track->speed + DEFAULT_SPEED, setSpeed, NULL); - drawSwitch(music, x += TIC_FONT_WIDTH * 8, y, "ROWS", MUSIC_PATTERN_ROWS - track->rows, setRows, NULL); + drawSwitch(music, x += tic->font.width * 10, y, "TEMPO", track->tempo + DEFAULT_TEMPO, setTempo, NULL); + drawSwitch(music, x += tic->font.width * 11, y, "SPD", track->speed + DEFAULT_SPEED, setSpeed, NULL); + drawSwitch(music, x += tic->font.width * 8, y, "ROWS", MUSIC_PATTERN_ROWS - track->rows, setRows, NULL); } static void drawTrackerFrames(Music* music, s32 x, s32 y) { + tic_mem* tic = music->tic; + enum { Border = 1, - Width = TIC_FONT_WIDTH * 2 + Border, }; + s32 width = tic->font.width * 2 + Border; + { - tic_rect rect = { x - Border, y - Border, Width, MUSIC_FRAMES * TIC_FONT_HEIGHT + Border }; + tic_rect rect = { x - Border, y - Border, width, MUSIC_FRAMES * tic->font.height + Border }; if (checkMousePos(&rect)) { @@ -1131,7 +1144,7 @@ static void drawTrackerFrames(Music* music, s32 x, s32 y) if (checkMouseDown(&rect, tic_mouse_left)) { s32 my = getMouseY() - rect.y - Border; - music->tracker.frame = my / TIC_FONT_HEIGHT; + music->tracker.frame = my / tic->font.height; } } @@ -1155,18 +1168,18 @@ static void drawTrackerFrames(Music* music, s32 x, s32 y) 0b00000000, }; - drawBitIcon(x - TIC_FONT_WIDTH-1, y + i*TIC_FONT_HEIGHT, Icon, tic_color_black); - drawBitIcon(x - TIC_FONT_WIDTH-1, y - 1 + i*TIC_FONT_HEIGHT, Icon, tic_color_white); + drawBitIcon(x - 7, y + i*tic->font.height, Icon, tic_color_black); + drawBitIcon(x - 7, 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, (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, (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) @@ -1200,11 +1213,12 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) enum { Border = 1, - Rows = TRACKER_ROWS, - Width = TIC_FONT_WIDTH * 8 + Border, + Rows = TRACKER_ROWS, }; - tic_rect rect = {x - Border, y - Border, Width, Rows*TIC_FONT_HEIGHT + Border}; + s32 width = tic->font.width * 8 + Border; + + tic_rect rect = {x - Border, y - Border, width, Rows*tic->font.height + Border}; if(checkMousePos(&rect)) { @@ -1215,8 +1229,8 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) s32 mx = getMouseX() - rect.x - Border; s32 my = getMouseY() - rect.y - Border; - s32 col = music->tracker.col = channel * CHANNEL_COLS + mx / TIC_FONT_WIDTH; - s32 row = music->tracker.row = my / TIC_FONT_HEIGHT + music->tracker.scroll; + s32 col = music->tracker.col = channel * CHANNEL_COLS + mx / tic->font.width; + s32 row = music->tracker.row = my / tic->font.height + music->tracker.scroll; if(music->tracker.select.drag) { @@ -1252,11 +1266,11 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) for (s32 i = start, pos = 0; i < end; i++, pos++) { - s32 rowy = y + pos*TIC_FONT_HEIGHT; + s32 rowy = y + pos*tic->font.height; if (i == music->tracker.row) { - music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, (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 @@ -1266,13 +1280,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, (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, (tic_color_white)); + music->tic->api.rect(music->tic, x - 1, rowy - 1, width, tic->font.height + 1, (tic_color_white)); } char rowStr[] = "--------"; @@ -1301,7 +1315,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) bool beetRow = i % NOTES_PER_BEET == 0; - for (s32 c = 0, colx = x; c < sizeof rowStr - 1; c++, colx += TIC_FONT_WIDTH) + for (s32 c = 0, colx = x; c < sizeof rowStr - 1; c++, colx += tic->font.width) { char sym = rowStr[c]; const u8* colors = beetRow || sym != '-' ? Colors : DarkColors; @@ -1317,14 +1331,14 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) if (music->tracker.col / CHANNEL_COLS == 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, (tic_color_red)); + 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, (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, (tic_color_black)); + music->tic->api.pixel(music->tic, x - 4, y + pos*tic->font.height + 2, (tic_color_black)); } } @@ -1344,12 +1358,12 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 index) if(checkMouseClick(&rect, tic_mouse_left)) { - // if (SDL_GetModState() & KMOD_CTRL) - // { - // for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++) - // music->tracker.patterns[i] = i == index; - // } - // else music->tracker.patterns[index] = !music->tracker.patterns[index]; + if (tic->api.key(tic, tic_key_ctrl)) + { + for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++) + music->tracker.patterns[i] = i == index; + } + else music->tracker.patterns[index] = !music->tracker.patterns[index]; } } @@ -1359,21 +1373,25 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 index) static void drawTracker(Music* music, s32 x, s32 y) { + tic_mem* tic = music->tic; + drawTrackerFrames(music, x, y); - x += TIC_FONT_WIDTH * 3; + enum{Gap = 6, Cols = 8}; - enum{ChannelWidth = TIC_FONT_WIDTH * 9}; + x += tic->font.width * 2 + Gap; + + s32 channelWidth = tic->font.width * Cols + Gap; for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++) { s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, i); - drawEditbox(music, x + ChannelWidth * i + 2*TIC_FONT_WIDTH, y - 11, patternId, setChannelPattern, i); - drawTumbler(music, x + ChannelWidth * i + 7*TIC_FONT_WIDTH, y - 11, i); + drawEditbox(music, x + channelWidth * i + 3*tic->font.width, y - 11, patternId, setChannelPattern, i); + drawTumbler(music, x + channelWidth * (i+1) - 4 - Gap, y - 11, i); } for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++) - drawTrackerChannel(music, x + ChannelWidth * i, y, i); + drawTrackerChannel(music, x + channelWidth * i, y, i); } static void enableFollowMode(Music* music) @@ -1517,10 +1535,11 @@ static void drawMusicToolbar(Music* music) static void drawPianoLayout(Music* music) { + tic_mem* tic = music->tic; 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, (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) diff --git a/src/sfx.c b/src/sfx.c index fe8d3e2..19e72b1 100644 --- a/src/sfx.c +++ b/src/sfx.c @@ -39,13 +39,15 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, void(*set)(Sfx*, s32)) { + tic_mem* tic = sfx->tic; + static const u8 LeftArrow[] = { - 0b00010000, - 0b00110000, - 0b01110000, - 0b00110000, - 0b00010000, + 0b00100000, + 0b01100000, + 0b11100000, + 0b01100000, + 0b00100000, 0b00000000, 0b00000000, 0b00000000, @@ -53,22 +55,24 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi static const u8 RightArrow[] = { - 0b01000000, - 0b01100000, - 0b01110000, - 0b01100000, - 0b01000000, + 0b10000000, + 0b11000000, + 0b11100000, + 0b11000000, + 0b10000000, 0b00000000, 0b00000000, 0b00000000, }; + enum{ArrowWidth = 4, ArrowHeight = 6}; + sfx->tic->api.text(sfx->tic, label, x, y, (tic_color_white)); { - x += (s32)strlen(label)*TIC_FONT_WIDTH; + x += (s32)strlen(label)*tic->font.width; - tic_rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT}; + tic_rect rect = {x, y, ArrowWidth, ArrowHeight}; if(checkMousePos(&rect)) { @@ -84,13 +88,13 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi { char val[] = "99"; sprintf(val, "%02i", value); - sfx->tic->api.fixed_text(sfx->tic, val, x += TIC_FONT_WIDTH, y, (tic_color_white)); + sfx->tic->api.fixed_text(sfx->tic, val, x += ArrowWidth, y, (tic_color_white)); } { - x += 2*TIC_FONT_WIDTH; + x += 2*tic->font.width; - tic_rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT}; + tic_rect rect = {x, y, ArrowWidth, ArrowHeight}; if(checkMousePos(&rect)) { @@ -125,7 +129,8 @@ static void setSpeed(Sfx* sfx, s32 delta) static void drawTopPanel(Sfx* sfx, s32 x, s32 y) { - const s32 Gap = 8*TIC_FONT_WIDTH; + tic_mem* tic = sfx->tic; + const s32 Gap = 8*tic->font.width; drawSwitch(sfx, x, y, "IDX", sfx->index, setIndex); @@ -156,6 +161,7 @@ static void setLoopSize(Sfx* sfx, s32 delta) static void drawLoopPanel(Sfx* sfx, s32 x, s32 y) { + tic_mem* tic = sfx->tic; sfx->tic->api.text(sfx->tic, "LOOP:", x, y, (tic_color_dark_gray)); enum {Gap = 2}; @@ -163,8 +169,8 @@ static void drawLoopPanel(Sfx* sfx, s32 x, s32 y) tic_sample* effect = getEffect(sfx); tic_sound_loop* loop = effect->loops + sfx->canvasTab; - drawSwitch(sfx, x, y += Gap + TIC_FONT_HEIGHT, "", loop->size, setLoopSize); - drawSwitch(sfx, x, y += Gap + TIC_FONT_HEIGHT, "", loop->start, setLoopStart); + drawSwitch(sfx, x, y += Gap + tic->font.height, "", loop->size, setLoopSize); + drawSwitch(sfx, x, y += Gap + tic->font.height, "", loop->start, setLoopStart); } static tic_waveform* getWaveformById(Sfx* sfx, s32 i) @@ -287,15 +293,16 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y) static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) { + tic_mem* tic = sfx->tic; static const char* Labels[] = {"WAVE", "VOLUME", "ARPEGG", "PITCH"}; - enum {Height = TIC_FONT_HEIGHT+2}; + s32 height = tic->font.height+2; - for(s32 i = 0, sy = y; i < COUNT_OF(Labels); sy += Height, i++) + 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, (tic_color_black)); + s32 size = sfx->tic->api.text(sfx->tic, Labels[i], 0, -tic->font.height, (tic_color_black)); - tic_rect rect = {x - size, sy, size, TIC_FONT_HEIGHT}; + tic_rect rect = {x - size, sy, size, tic->font.height}; if(checkMousePos(&rect)) { @@ -317,8 +324,8 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) case SFX_PITCH_TAB: { static const char Label[] = "x16"; - enum{Width = (sizeof Label - 1) * TIC_FONT_WIDTH}; - tic_rect rect = {(x - Width)/2, y + Height * 6, Width, TIC_FONT_HEIGHT}; + s32 width = (sizeof Label - 1) * tic->font.width; + tic_rect rect = {(x - width)/2, y + height * 6, width, tic->font.height}; if(checkMousePos(&rect)) { @@ -334,8 +341,8 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y) case SFX_ARPEGGIO_TAB: { static const char Label[] = "DOWN"; - enum{Width = (sizeof Label - 1) * TIC_FONT_WIDTH}; - tic_rect rect = {(x - Width)/2, y + Height * 6, Width, TIC_FONT_HEIGHT}; + s32 width = (sizeof Label - 1) * tic->font.width; + tic_rect rect = {(x - width)/2, y + height * 6, width, tic->font.height}; if(checkMousePos(&rect)) { @@ -514,18 +521,19 @@ static void drawPiano(Sfx* sfx, s32 x, s32 y) static void drawOctavePanel(Sfx* sfx, s32 x, s32 y) { + tic_mem* tic = sfx->tic; tic_sample* effect = getEffect(sfx); static const char Label[] = "OCT"; sfx->tic->api.text(sfx->tic, Label, x, y, (tic_color_white)); - x += sizeof(Label)*TIC_FONT_WIDTH; + x += sizeof(Label)*tic->font.width; enum {Gap = 5}; for(s32 i = 0; i < OCTAVES; i++) { - tic_rect rect = {x + i * (TIC_FONT_WIDTH + Gap), y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT}; + tic_rect rect = {x + i * (tic->font.width + Gap), y, tic->font.width, tic->font.height}; if(checkMousePos(&rect)) { @@ -781,13 +789,14 @@ static void drawModeTabs(Sfx* sfx) static void drawSfxToolbar(Sfx* sfx) { + tic_mem* tic = sfx->tic; 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; + s32 width = 3 * tic->font.width; + s32 x = TIC80_WIDTH - width - TIC_SPRITESIZE*3; s32 y = 1; - tic_rect rect = {x, y, Width, TIC_FONT_HEIGHT}; + tic_rect rect = {x, y, width, tic->font.height}; bool over = false; if(checkMousePos(&rect)) @@ -818,6 +827,7 @@ static void drawSfxToolbar(Sfx* sfx) static void envelopesTick(Sfx* sfx) { + tic_mem* tic = sfx->tic; processKeyboard(sfx); processEnvelopesKeyboard(sfx); @@ -830,13 +840,13 @@ static void envelopesTick(Sfx* sfx) drawToolbar(sfx->tic, TIC_COLOR_BG, false); drawTopPanel(sfx, Start, TOOLBAR_SIZE + Gap); - drawCanvasTabs(sfx, Start-Gap, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT+2); + drawCanvasTabs(sfx, Start-Gap, TOOLBAR_SIZE + Gap + tic->font.height+2); if(sfx->canvasTab == SFX_WAVE_TAB) - drawWaveButtons(sfx, Start + CANVAS_WIDTH + Gap-1, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT+2); + drawWaveButtons(sfx, Start + CANVAS_WIDTH + Gap-1, TOOLBAR_SIZE + Gap + tic->font.height+2); - drawLoopPanel(sfx, Gap, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT+92); - drawCanvas(sfx, Start-1, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT + 1); - drawOctavePanel(sfx, Start + Gap + PIANO_WIDTH + Gap-1, TIC80_HEIGHT - TIC_FONT_HEIGHT - (PIANO_HEIGHT - TIC_FONT_HEIGHT)/2 - Gap); + drawLoopPanel(sfx, Gap, TOOLBAR_SIZE + Gap + tic->font.height+92); + drawCanvas(sfx, Start-1, TOOLBAR_SIZE + Gap + tic->font.height + 1); + drawOctavePanel(sfx, Start + Gap + PIANO_WIDTH + Gap-1, TIC80_HEIGHT - tic->font.height - (PIANO_HEIGHT - tic->font.height)/2 - Gap); } static void drawWaveformBar(Sfx* sfx, s32 x, s32 y) diff --git a/src/sprite.c b/src/sprite.c index 155dcc2..c35dfda 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -359,12 +359,14 @@ static void drawBrushSlider(Sprite* sprite, s32 x, s32 y) static void drawCanvas(Sprite* sprite, s32 x, s32 y) { + tic_mem* tic = sprite->tic; + if(!hasCanvasSelection(sprite)) { char buf[] = "#255"; sprintf(buf, "#%03i", sprite->index); - s32 ix = x + (CANVAS_SIZE - 4*TIC_FONT_WIDTH)/2; + 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, (tic_color_black)); sprite->tic->api.text(sprite->tic, buf, ix, iy, (tic_color_white)); @@ -1492,6 +1494,7 @@ static void processKeyboard(Sprite* sprite) static void drawSpriteToolbar(Sprite* sprite) { + tic_mem* tic = sprite->tic; sprite->tic->api.rect(sprite->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white)); // draw sprite size control @@ -1533,7 +1536,7 @@ static void drawSpriteToolbar(Sprite* sprite) { static const char Label[] = "BG"; - tic_rect rect = {TIC80_WIDTH - 2 * TIC_FONT_WIDTH - 2, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1}; + tic_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 ? (tic_color_black) : (tic_color_gray)); sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white)); @@ -1553,7 +1556,7 @@ static void drawSpriteToolbar(Sprite* sprite) { static const char Label[] = "FG"; - tic_rect rect = {TIC80_WIDTH - 4 * TIC_FONT_WIDTH - 4, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1}; + tic_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 ? (tic_color_gray) : (tic_color_black)); sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white)); diff --git a/src/start.c b/src/start.c index 8ef88bf..7a4690f 100644 --- a/src/start.c +++ b/src/start.c @@ -24,23 +24,25 @@ static void reset(Start* start) { - u8* tile = (u8*)start->tic->ram.tiles.data; + tic_mem* tic = start->tic; + u8* tile = (u8*)tic->ram.tiles.data; - start->tic->api.clear(start->tic, (tic_color_black)); + tic->api.clear(tic, (tic_color_black)); static const u8 Reset[] = {0x00, 0x06, 0x96, 0x00}; u8 val = Reset[sizeof(Reset) * (start->ticks % TIC_FRAMERATE) / TIC_FRAMERATE]; for(s32 i = 0; i < sizeof(tic_tile); i++) tile[i] = val; - start->tic->api.map(start->tic, &start->tic->ram.map, &start->tic->ram.tiles, 0, 0, TIC_MAP_SCREEN_WIDTH, TIC_MAP_SCREEN_HEIGHT + (TIC80_HEIGHT % TIC_SPRITESIZE ? 1 : 0), 0, 0, -1, 1); + tic->api.map(tic, &tic->ram.map, &tic->ram.tiles, 0, 0, TIC_MAP_SCREEN_WIDTH, TIC_MAP_SCREEN_HEIGHT + (TIC80_HEIGHT % TIC_SPRITESIZE ? 1 : 0), 0, 0, -1, 1); } static void drawHeader(Start* start) { - 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)); + tic_mem* tic = start->tic; + tic->api.fixed_text(tic, TIC_NAME_FULL, TextWidth(tic), TextHeight(tic), (tic_color_white)); + tic->api.fixed_text(tic, TIC_VERSION_LABEL, (sizeof(TIC_NAME_FULL) + 1) * TextWidth(tic), TextHeight(tic), (tic_color_dark_gray)); + tic->api.fixed_text(tic, TIC_COPYRIGHT, TextWidth(tic), TextHeight(tic)*2, (tic_color_dark_gray)); } static void header(Start* start) @@ -57,9 +59,10 @@ static void header(Start* start) static void end(Start* start) { + tic_mem* tic = start->tic; if(start->play) { - start->tic->api.sfx_stop(start->tic, 0); + tic->api.sfx_stop(tic, 0); start->play = false; } @@ -70,6 +73,8 @@ static void end(Start* start) static void tick(Start* start) { + tic_mem* tic = start->tic; + if(!start->initialized) { start->phase = 1; @@ -78,7 +83,7 @@ static void tick(Start* start) start->initialized = true; } - start->tic->api.clear(start->tic, TIC_COLOR_BG); + tic->api.clear(tic, TIC_COLOR_BG); static void(*const steps[])(Start*) = {reset, header, end}; diff --git a/src/studio.c b/src/studio.c index 3592758..37989c5 100644 --- a/src/studio.c +++ b/src/studio.c @@ -133,12 +133,12 @@ static struct struct { s32 counter; - char message[STUDIO_TEXT_BUFFER_WIDTH]; + char message[TIC80_WIDTH]; } popup; struct { - char text[STUDIO_TEXT_BUFFER_WIDTH]; + char text[TIC80_WIDTH]; } tooltip; struct @@ -436,7 +436,7 @@ static void drawExtrabar(tic_mem* tic) { enum {Size = 7}; - s32 x = (COUNT_OF(Modes) + 1) * Size + 17 * TIC_FONT_WIDTH; + s32 x = (COUNT_OF(Modes) + 1) * Size + 102; s32 y = 0; static const u8 Icons[] = @@ -532,7 +532,7 @@ static void drawBankIcon(s32 x, s32 y) { tic_mem* tic = impl.studio.tic; - tic_rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT}; + tic_rect rect = {x, y, tic->font.width, tic->font.height}; static const u8 Icon[] = { @@ -574,9 +574,11 @@ static void drawBankIcon(s32 x, s32 y) enum{Size = TOOLBAR_SIZE}; + x += Size+2; + for(s32 i = 0; i < TIC_EDITOR_BANKS; i++) { - tic_rect rect = {x + 2 + (i+1)*Size, 0, Size, Size}; + tic_rect rect = {x + i*Size, 0, Size, Size}; bool over = false; if(checkMousePos(&rect)) @@ -595,7 +597,7 @@ static void drawBankIcon(s32 x, s32 y) if(i == impl.bank.indexes[mode]) tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, tic_color_red); - tic->api.draw_char(tic, '0' + i, rect.x+1, rect.y+1, i == impl.bank.indexes[mode] ? tic_color_white : over ? tic_color_red : tic_color_peach); + tic->api.draw_char(tic, '0' + i, rect.x+(Size-tic->font.width+1)/2, rect.y+1, i == impl.bank.indexes[mode] ? tic_color_white : over ? tic_color_red : tic_color_peach); } @@ -612,7 +614,7 @@ static void drawBankIcon(s32 x, s32 y) 0b00000000, }; - tic_rect rect = {x + 4 + (TIC_EDITOR_BANKS+1)*Size, 0, Size, Size}; + tic_rect rect = {x + 2 + TIC_EDITOR_BANKS*Size, 0, Size, Size}; bool over = false; @@ -1522,6 +1524,8 @@ static void recordFrame(u32* pixels) static void drawPopup() { + tic_mem* tic = impl.studio.tic; + if(impl.popup.counter > 0) { impl.popup.counter--; @@ -1531,13 +1535,13 @@ static void drawPopup() enum{Dur = TIC_FRAMERATE/2}; if(impl.popup.counter < Dur) - anim = -((Dur - impl.popup.counter) * (TIC_FONT_HEIGHT+1) / Dur); + anim = -((Dur - impl.popup.counter) * (tic->font.height+1) / Dur); else if(impl.popup.counter >= (POPUP_DUR - Dur)) - anim = (((POPUP_DUR - Dur) - impl.popup.counter) * (TIC_FONT_HEIGHT+1) / Dur); + anim = (((POPUP_DUR - Dur) - impl.popup.counter) * (tic->font.height+1) / Dur); - impl.studio.tic->api.rect(impl.studio.tic, 0, anim, TIC80_WIDTH, TIC_FONT_HEIGHT+1, (tic_color_red)); + impl.studio.tic->api.rect(impl.studio.tic, 0, anim, TIC80_WIDTH, tic->font.height+1, (tic_color_red)); impl.studio.tic->api.text(impl.studio.tic, impl.popup.message, - (s32)(TIC80_WIDTH - strlen(impl.popup.message)*TIC_FONT_WIDTH)/2, + (s32)(TIC80_WIDTH - strlen(impl.popup.message)*tic->font.width)/2, anim + 1, (tic_color_white)); } } @@ -1626,7 +1630,12 @@ static void renderStudio() static void updateSystemFont() { - memset(impl.studio.tic->font.data, 0, sizeof(tic_font)); + tic_mem* tic = impl.studio.tic; + + memset(tic->font.data, 0, sizeof tic->font.data); + + tic->font.width = impl.config->data.theme.font.width; + tic->font.height = impl.config->data.theme.font.height; for(s32 i = 0; i < TIC_FONT_CHARS; i++) for(s32 y = 0; y < TIC_SPRITESIZE; y++) diff --git a/src/studio.h b/src/studio.h index aecf933..5a8ee6d 100644 --- a/src/studio.h +++ b/src/studio.h @@ -38,10 +38,7 @@ #define TIC_CACHE TIC_LOCAL "cache/" #define TOOLBAR_SIZE 7 -#define STUDIO_TEXT_WIDTH (TIC_FONT_WIDTH) -#define STUDIO_TEXT_HEIGHT (TIC_FONT_HEIGHT+1) -#define STUDIO_TEXT_BUFFER_WIDTH (TIC80_WIDTH / STUDIO_TEXT_WIDTH) -#define STUDIO_TEXT_BUFFER_HEIGHT (TIC80_HEIGHT / STUDIO_TEXT_HEIGHT) +#define TEXT_LINE_SPACE 1 #define TIC_COLOR_BG (tic_color_black) #define DEFAULT_CHMOD 0755 @@ -163,3 +160,8 @@ bool anyKeyWasPressed(); const StudioConfig* getConfig(); System* getSystem(); + +inline s32 TextWidth(const tic_mem* tic) { return tic->font.width; } +inline s32 TextHeight(const tic_mem* tic) { return tic->font.height + TEXT_LINE_SPACE; } +inline s32 BufferWidth(const tic_mem* tic) { return TIC80_WIDTH/TextWidth(tic); } +inline s32 BufferHeight(const tic_mem* tic) { return TIC80_HEIGHT/TextHeight(tic); } diff --git a/src/surf.c b/src/surf.c index ee80031..8d7e626 100644 --- a/src/surf.c +++ b/src/surf.c @@ -193,7 +193,7 @@ static void drawTopToolbar(Surf* surf, s32 x, s32 y) sprintf(label, "%s", "TIC-80 SURF"); s32 xl = x + MAIN_OFFSET; - s32 yl = y + (Height - TIC_FONT_HEIGHT)/2; + s32 yl = y + (Height - tic->font.height)/2; tic->api.text(tic, label, xl, yl+1, tic_color_black); tic->api.text(tic, label, xl, yl, tic_color_white); } @@ -231,7 +231,7 @@ static void drawBottomToolbar(Surf* surf, s32 x, s32 y) sprintf(label, "/%s", dir); s32 xl = x + MAIN_OFFSET; - s32 yl = y + (Height - TIC_FONT_HEIGHT)/2; + s32 yl = y + (Height - tic->font.height)/2; tic->api.text(tic, label, xl, yl+1, tic_color_black); tic->api.text(tic, label, xl, yl, tic_color_white); } @@ -327,13 +327,13 @@ static void drawMenu(Surf* surf, s32 x, s32 y, bool bg) { const char* name = surf->menu.items[i].label; - s32 ym = Height * i + y - surf->menu.pos*MENU_HEIGHT - surf->menu.anim + (MENU_HEIGHT - TIC_FONT_HEIGHT)/2; + s32 ym = Height * i + y - surf->menu.pos*MENU_HEIGHT - surf->menu.anim + (MENU_HEIGHT - tic->font.height)/2; if(bg) { - s32 size = tic->api.text(tic, name, 0, -TIC_FONT_HEIGHT, 0); + s32 size = tic->api.text(tic, name, 0, -tic->font.height, 0); - drawInverseRect(tic, x + MAIN_OFFSET - 1, ym-1, size+1, TIC_FONT_HEIGHT+2); + drawInverseRect(tic, x + MAIN_OFFSET - 1, ym-1, size+1, tic->font.height+2); } else { @@ -837,8 +837,8 @@ static void tick(Surf* surf) else { static const char Label[] = "You don't have any files..."; - s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, tic_color_white); - tic->api.text(tic, Label, (TIC80_WIDTH - size) / 2, (TIC80_HEIGHT - TIC_FONT_HEIGHT)/2, tic_color_white); + s32 size = tic->api.text(tic, Label, 0, -tic->font.height, tic_color_white); + tic->api.text(tic, Label, (TIC80_WIDTH - size) / 2, (TIC80_HEIGHT - tic->font.height)/2, tic_color_white); } } diff --git a/src/system.h b/src/system.h index 58bb177..ec46922 100644 --- a/src/system.h +++ b/src/system.h @@ -63,6 +63,12 @@ typedef struct } gamepad; + struct + { + s32 width; + s32 height; + } font; + } theme; s32 gifScale; diff --git a/src/tic.c b/src/tic.c index 2e8ddf0..0da3dad 100644 --- a/src/tic.c +++ b/src/tic.c @@ -147,11 +147,11 @@ static void runNoise(blip_buffer_t* blip, tic_sound_register* reg, tic_sound_reg } } -static void resetPalette(tic_mem* memory) +static void resetPalette(tic_mem* tic) { static const u8 DefaultMapping[] = {16, 50, 84, 118, 152, 186, 220, 254}; - memcpy(memory->ram.vram.palette.data, memory->cart.bank0.palette.data, sizeof(tic_palette)); - memcpy(memory->ram.vram.mapping, DefaultMapping, sizeof DefaultMapping); + memcpy(tic->ram.vram.palette.data, tic->cart.bank0.palette.data, sizeof(tic_palette)); + memcpy(tic->ram.vram.mapping, DefaultMapping, sizeof DefaultMapping); } static inline u8 mapColor(tic_mem* tic, u8 color) @@ -214,19 +214,19 @@ static u8 getPixel(tic_machine* machine, s32 x, s32 y) return machine->state.getpix(&machine->memory, x, y); } -static void drawHLineDma(tic_mem* memory, s32 xl, s32 xr, s32 y, u8 color) +static void drawHLineDma(tic_mem* tic, s32 xl, s32 xr, s32 y, u8 color) { color = color << 4 | color; if (xl >= xr) return; if (xl & 1) { - tic_tool_poke4(&memory->ram.vram.screen.data, y * TIC80_WIDTH + xl, color); + tic_tool_poke4(&tic->ram.vram.screen.data, y * TIC80_WIDTH + xl, color); xl++; } s32 count = (xr - xl) >> 1; - u8 *screen = memory->ram.vram.screen.data + ((y * TIC80_WIDTH + xl) >> 1); + u8 *screen = tic->ram.vram.screen.data + ((y * TIC80_WIDTH + xl) >> 1); for(s32 i = 0; i < count; i++) *screen++ = color; if (xr & 1) { - tic_tool_poke4(&memory->ram.vram.screen.data, y * TIC80_WIDTH + xr - 1, color); + tic_tool_poke4(&tic->ram.vram.screen.data, y * TIC80_WIDTH + xr - 1, color); } } @@ -377,9 +377,9 @@ static void resetSfx(Channel* channel) channel->tick = -1; } -static void channelSfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 duration, Channel* c, s32 volume, s32 speed) +static void channelSfx(tic_mem* tic, s32 index, s32 note, s32 octave, s32 duration, Channel* c, s32 volume, s32 speed) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; c->volume = volume; @@ -401,34 +401,34 @@ static void channelSfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 dur resetSfx(c); } -static void musicSfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 volume, s32 channel) +static void musicSfx(tic_mem* tic, s32 index, s32 note, s32 octave, s32 volume, s32 channel) { - tic_machine* machine = (tic_machine*)memory; - channelSfx(memory, index, note, octave, -1, &machine->state.music.channels[channel], MAX_VOLUME - volume, SFX_DEF_SPEED); + tic_machine* machine = (tic_machine*)tic; + channelSfx(tic, index, note, octave, -1, &machine->state.music.channels[channel], MAX_VOLUME - volume, SFX_DEF_SPEED); } -static void resetMusic(tic_mem* memory) +static void resetMusic(tic_mem* tic) { for (s32 c = 0; c < TIC_SOUND_CHANNELS; c++) - musicSfx(memory, -1, 0, 0, 0, c); + musicSfx(tic, -1, 0, 0, 0, c); } static void setMusic(tic_machine* machine, s32 index, s32 frame, s32 row, bool loop) { - tic_mem* memory = (tic_mem*)machine; + tic_mem* tic = (tic_mem*)machine; - memory->ram.music_pos.track = index; + tic->ram.music_pos.track = index; if(index < 0) { machine->state.music.play = MusicStop; - resetMusic(memory); + resetMusic(tic); } else { - memory->ram.music_pos.row = row; - memory->ram.music_pos.frame = frame < 0 ? 0 : frame; - memory->ram.music_pos.flag.loop = loop; + tic->ram.music_pos.row = row; + tic->ram.music_pos.frame = frame < 0 ? 0 : frame; + tic->ram.music_pos.flag.loop = loop; machine->state.music.play = MusicPlay; const tic_track* track = &machine->sound.music->tracks.data[index]; @@ -436,9 +436,9 @@ static void setMusic(tic_machine* machine, s32 index, s32 frame, s32 row, bool l } } -static void api_music(tic_mem* memory, s32 index, s32 frame, s32 row, bool loop) +static void api_music(tic_mem* tic, s32 index, s32 frame, s32 row, bool loop) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; setMusic(machine, index, frame, row, loop); @@ -446,10 +446,10 @@ static void api_music(tic_mem* memory, s32 index, s32 frame, s32 row, bool loop) machine->state.music.play = MusicPlay; } -static void soundClear(tic_mem* memory) +static void soundClear(tic_mem* tic) { { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; Channel channel = { @@ -474,7 +474,7 @@ static void soundClear(tic_mem* memory) memcpy(machine->state.music.channels+i, &channel, sizeof channel); { - tic_sound_register* reg = &memory->ram.registers[i]; + tic_sound_register* reg = &tic->ram.registers[i]; memset(reg, 0, sizeof(tic_sound_register)); } @@ -484,17 +484,17 @@ static void soundClear(tic_mem* memory) } } - api_music(memory, -1, 0, 0, false); + api_music(tic, -1, 0, 0, false); } - memset(memory->samples.buffer, 0, memory->samples.size); + memset(tic->samples.buffer, 0, tic->samples.size); } -static void updateSaveid(tic_mem* memory); +static void updateSaveid(tic_mem* tic); -static void api_clip(tic_mem* memory, s32 x, s32 y, s32 width, s32 height) +static void api_clip(tic_mem* tic, s32 x, s32 y, s32 width, s32 height) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; machine->state.clip.l = x; machine->state.clip.t = y; @@ -507,17 +507,17 @@ static void api_clip(tic_mem* memory, s32 x, s32 y, s32 width, s32 height) if(machine->state.clip.b > TIC80_HEIGHT) machine->state.clip.b = TIC80_HEIGHT; } -static void api_reset(tic_mem* memory) +static void api_reset(tic_mem* tic) { - resetPalette(memory); + resetPalette(tic); - memset(&memory->ram.vram.vars, 0, sizeof memory->ram.vram.vars); + memset(&tic->ram.vram.vars, 0, sizeof tic->ram.vram.vars); - api_clip(memory, 0, 0, TIC80_WIDTH, TIC80_HEIGHT); + api_clip(tic, 0, 0, TIC80_WIDTH, TIC80_HEIGHT); - soundClear(memory); + soundClear(tic); - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; machine->state.initialized = false; machine->state.scanline = NULL; machine->state.ovr.callback = NULL; @@ -526,60 +526,60 @@ static void api_reset(tic_mem* memory) machine->state.getpix = getPixelDma; machine->state.drawhline = drawHLineDma; - updateSaveid(memory); + updateSaveid(tic); } -static void api_pause(tic_mem* memory) +static void api_pause(tic_mem* tic) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; memcpy(&machine->pause.state, &machine->state, sizeof(MachineState)); - memcpy(&machine->pause.ram, &memory->ram, sizeof(tic_ram)); + memcpy(&machine->pause.ram, &tic->ram, sizeof(tic_ram)); machine->pause.time.start = machine->data->start; machine->pause.time.paused = machine->data->counter(); } -static void api_resume(tic_mem* memory) +static void api_resume(tic_mem* tic) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; if (machine->data) { memcpy(&machine->state, &machine->pause.state, sizeof(MachineState)); - memcpy(&memory->ram, &machine->pause.ram, sizeof(tic_ram)); + memcpy(&tic->ram, &machine->pause.ram, sizeof(tic_ram)); machine->data->start = machine->pause.time.start + machine->data->counter() - machine->pause.time.paused; } } -void tic_close(tic_mem* memory) +void tic_close(tic_mem* tic) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; machine->state.initialized = false; #if defined(TIC_BUILD_WITH_LUA) - getLuaScriptConfig()->close(memory); + getLuaScriptConfig()->close(tic); # if defined(TIC_BUILD_WITH_MOON) - getMoonScriptConfig()->close(memory); + getMoonScriptConfig()->close(tic); # endif #endif /* defined(TIC_BUILD_WITH_LUA) */ #if defined(TIC_BUILD_WITH_JS) - getJsScriptConfig()->close(memory); + getJsScriptConfig()->close(tic); #endif #if defined(TIC_BUILD_WITH_WREN) - getWrenScriptConfig()->close(memory); + getWrenScriptConfig()->close(tic); #endif blip_delete(machine->blip); - free(memory->samples.buffer); + free(tic->samples.buffer); free(machine); } @@ -587,49 +587,49 @@ void tic_close(tic_mem* memory) // API //////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -static void api_rect(tic_mem* memory, s32 x, s32 y, s32 width, s32 height, u8 color) +static void api_rect(tic_mem* tic, s32 x, s32 y, s32 width, s32 height, u8 color) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; drawRect(machine, x, y, width, height, color); } -static void api_clear(tic_mem* memory, u8 color) +static void api_clear(tic_mem* tic, u8 color) { static const Clip EmptyClip = {0, 0, TIC80_WIDTH, TIC80_HEIGHT}; - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; if(memcmp(&machine->state.clip, &EmptyClip, sizeof(Clip)) == 0) { color &= 0b00001111; - memset(memory->ram.vram.screen.data, color | (color << TIC_PALETTE_BPP), sizeof(memory->ram.vram.screen.data)); + memset(tic->ram.vram.screen.data, color | (color << TIC_PALETTE_BPP), sizeof(tic->ram.vram.screen.data)); } else { - api_rect(memory, machine->state.clip.l, machine->state.clip.t, machine->state.clip.r - machine->state.clip.l, machine->state.clip.b - machine->state.clip.t, color); + api_rect(tic, machine->state.clip.l, machine->state.clip.t, machine->state.clip.r - machine->state.clip.l, machine->state.clip.b - machine->state.clip.t, color); } } -static s32 drawChar(tic_mem* memory, u8 symbol, s32 x, s32 y, s32 width, s32 height, u8 color, s32 scale) +static s32 drawChar(tic_mem* tic, u8 symbol, s32 x, s32 y, s32 width, s32 height, u8 color, s32 scale) { - const u8* ptr = memory->font.data + symbol*BITS_IN_BYTE; + const u8* ptr = tic->font.data + symbol*BITS_IN_BYTE; x += (BITS_IN_BYTE - 1)*scale; - for(s32 i = 0, ys = y; i < TIC_FONT_HEIGHT; i++, ptr++, ys += scale) - for(s32 col = BITS_IN_BYTE - TIC_FONT_WIDTH, xs = x - col; col < BITS_IN_BYTE; col++, xs -= scale) + for(s32 i = 0, ys = y; i < tic->font.height; i++, ptr++, ys += scale) + for(s32 col = BITS_IN_BYTE - tic->font.width, xs = x - col; col < BITS_IN_BYTE; col++, xs -= scale) if(*ptr & 1 << col) - api_rect(memory, xs, ys, scale, scale, color); + api_rect(tic, xs, ys, scale, scale, color); - return TIC_FONT_WIDTH*scale; + return tic->font.width*scale; } -static s32 api_draw_char(tic_mem* memory, u8 symbol, s32 x, s32 y, u8 color) +static s32 api_draw_char(tic_mem* tic, u8 symbol, s32 x, s32 y, u8 color) { - return drawChar(memory, symbol, x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT, color, 1); + return drawChar(tic, symbol, x, y, tic->font.width, tic->font.height, color, 1); } -s32 drawText(tic_mem* memory, const char* text, s32 x, s32 y, s32 width, s32 height, u8 color, s32 scale, DrawCharFunc* func) +s32 drawText(tic_mem* tic, const char* text, s32 x, s32 y, s32 width, s32 height, u8 color, s32 scale, DrawCharFunc* func) { s32 pos = x; s32 max = x; @@ -645,69 +645,69 @@ s32 drawText(tic_mem* memory, const char* text, s32 x, s32 y, s32 width, s32 hei pos = x; y += height * scale; } - else pos += func(memory, sym, pos, y, width, height, color, scale); + else pos += func(tic, sym, pos, y, width, height, color, scale); } return pos > max ? pos - x : max - x; } -static s32 api_fixed_text(tic_mem* memory, const char* text, s32 x, s32 y, u8 color) +static s32 api_fixed_text(tic_mem* tic, const char* text, s32 x, s32 y, u8 color) { - return drawText(memory, text, x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT, color, 1, drawChar); + return drawText(tic, text, x, y, tic->font.width, tic->font.height, color, 1, drawChar); } -static s32 drawNonFixedChar(tic_mem* memory, u8 symbol, s32 x, s32 y, s32 width, s32 height, u8 color, s32 scale) +static s32 drawNonFixedChar(tic_mem* tic, u8 symbol, s32 x, s32 y, s32 width, s32 height, u8 color, s32 scale) { - const u8* ptr = memory->font.data + (symbol)*BITS_IN_BYTE; + const u8* ptr = tic->font.data + (symbol)*BITS_IN_BYTE; s32 start = 0; - s32 end = TIC_FONT_WIDTH; + s32 end = tic->font.width; s32 i = 0; - for(s32 col = 0; col < TIC_FONT_WIDTH; col++) + for(s32 col = 0; col < tic->font.width; col++) { - for(i = 0; i < TIC_FONT_HEIGHT; i++) + for(i = 0; i < tic->font.height; i++) if(*(ptr + i) & 0b10000000 >> col) break; - if(i < TIC_FONT_HEIGHT) break; else start++; + if(i < tic->font.height) break; else start++; } x -= start * scale; - for(s32 col = TIC_FONT_WIDTH - 1; col >= start; col--) + for(s32 col = tic->font.width - 1; col >= start; col--) { - for(i = 0; i < TIC_FONT_HEIGHT; i++) + for(i = 0; i < tic->font.height; i++) if(*(ptr + i) & 0b10000000 >> col) break; - if(i < TIC_FONT_HEIGHT) break; else end--; + if(i < tic->font.height) break; else end--; } - for(s32 ys = y, i = 0; i < TIC_FONT_HEIGHT; i++, ptr++, ys += scale) + for(s32 ys = y, i = 0; i < tic->font.height; i++, ptr++, ys += scale) for(s32 col = start, xs = x + start*scale; col < end; col++, xs += scale) if(*ptr & 0b10000000 >> col) - api_rect(memory, xs, ys, scale, scale, color); + api_rect(tic, xs, ys, scale, scale, color); s32 size = end - start; - return (size ? size + 1 : TIC_FONT_WIDTH - 2) * scale; + return (size ? size + 1 : tic->font.width - 2) * scale; } -static s32 api_text(tic_mem* memory, const char* text, s32 x, s32 y, u8 color) +static s32 api_text(tic_mem* tic, const char* text, s32 x, s32 y, u8 color) { - return drawText(memory, text, x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT, color, 1, drawNonFixedChar); + return drawText(tic, text, x, y, tic->font.width, tic->font.height, color, 1, drawNonFixedChar); } -static s32 api_text_ex(tic_mem* memory, const char* text, s32 x, s32 y, u8 color, bool fixed, s32 scale) +static s32 api_text_ex(tic_mem* tic, const char* text, s32 x, s32 y, u8 color, bool fixed, s32 scale) { - return drawText(memory, text, x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT, color, scale, fixed ? drawChar : drawNonFixedChar); + return drawText(tic, text, x, y, tic->font.width, tic->font.height, color, scale, fixed ? drawChar : drawNonFixedChar); } -static void drawSprite(tic_mem* memory, const tic_tiles* src, s32 index, s32 x, s32 y, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate) +static void drawSprite(tic_mem* tic, const tic_tiles* src, s32 index, s32 x, s32 y, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate) { if(index < TIC_SPRITES) - drawTile((tic_machine*)memory, src->data + index, x, y, colors, count, scale, flip, rotate); + drawTile((tic_machine*)tic, src->data + index, x, y, colors, count, scale, flip, rotate); } -static void api_sprite_ex(tic_mem* memory, const tic_tiles* src, s32 index, s32 x, s32 y, s32 w, s32 h, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate) +static void api_sprite_ex(tic_mem* tic, const tic_tiles* src, s32 index, s32 x, s32 y, s32 w, s32 h, u8* colors, s32 count, s32 scale, tic_flip flip, tic_rotate rotate) { s32 step = TIC_SPRITESIZE * scale; @@ -742,23 +742,23 @@ static void api_sprite_ex(tic_mem* memory, const tic_tiles* src, s32 index, s32 enum {Cols = TIC_SPRITESHEET_SIZE / TIC_SPRITESIZE}; if(rotate==0 || rotate==2) - drawSprite(memory, src, index + mx+my*Cols, x+i*step, y+j*step, colors, count, scale, flip, rotate); + drawSprite(tic, src, index + mx+my*Cols, x+i*step, y+j*step, colors, count, scale, flip, rotate); else - drawSprite(memory, src, index + mx+my*Cols, x+j*step, y+i*step, colors, count, scale, flip, rotate); + drawSprite(tic, src, index + mx+my*Cols, x+j*step, y+i*step, colors, count, scale, flip, rotate); } } } -s32 drawSpriteFont(tic_mem* memory, u8 symbol, s32 x, s32 y, s32 width, s32 height, u8 chromakey, s32 scale) +s32 drawSpriteFont(tic_mem* tic, u8 symbol, s32 x, s32 y, s32 width, s32 height, u8 chromakey, s32 scale) { - api_sprite_ex(memory, &memory->ram.sprites, symbol, x, y, 1, 1, &chromakey, 1, scale, tic_no_flip, tic_no_rotate); + api_sprite_ex(tic, &tic->ram.sprites, symbol, x, y, 1, 1, &chromakey, 1, scale, tic_no_flip, tic_no_rotate); return width * scale; } -s32 drawFixedSpriteFont(tic_mem* memory, u8 index, s32 x, s32 y, s32 width, s32 height, u8 chromakey, s32 scale) +s32 drawFixedSpriteFont(tic_mem* tic, u8 index, s32 x, s32 y, s32 width, s32 height, u8 chromakey, s32 scale) { - const u8* ptr = memory->ram.sprites.data[index].data; + const u8* ptr = tic->ram.sprites.data[index].data; enum {Size = TIC_SPRITESIZE}; @@ -791,7 +791,7 @@ s32 drawFixedSpriteFont(tic_mem* memory, u8 index, s32 x, s32 y, s32 width, s32 u8 color = tic_tool_peek4(ptr, col + row * Size); if(color != chromakey) - api_rect(memory, xs, ys, scale, scale, color); + api_rect(tic, xs, ys, scale, scale, color); } } @@ -799,23 +799,23 @@ s32 drawFixedSpriteFont(tic_mem* memory, u8 index, s32 x, s32 y, s32 width, s32 return (size ? size + 1 : width) * scale; } -static void api_pixel(tic_mem* memory, s32 x, s32 y, u8 color) +static void api_pixel(tic_mem* tic, s32 x, s32 y, u8 color) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; setPixel(machine, x, y, color); } -static u8 api_get_pixel(tic_mem* memory, s32 x, s32 y) +static u8 api_get_pixel(tic_mem* tic, s32 x, s32 y) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; return getPixel(machine, x, y); } -static void api_rect_border(tic_mem* memory, s32 x, s32 y, s32 width, s32 height, u8 color) +static void api_rect_border(tic_mem* tic, s32 x, s32 y, s32 width, s32 height, u8 color) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; drawRectBorder(machine, x, y, width, height, color); } @@ -861,9 +861,9 @@ static void setSideTexPixel(s32 x, s32 y, float u, float v) } } -static void api_circle(tic_mem* memory, s32 xm, s32 ym, s32 radius, u8 color) +static void api_circle(tic_mem* tic, s32 xm, s32 ym, s32 radius, u8 color) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; initSidesBuffer(); @@ -891,23 +891,23 @@ static void api_circle(tic_mem* memory, s32 xm, s32 ym, s32 radius, u8 color) } } -static void api_circle_border(tic_mem* memory, s32 xm, s32 ym, s32 radius, u8 color) +static void api_circle_border(tic_mem* tic, s32 xm, s32 ym, s32 radius, u8 color) { s32 r = radius; s32 x = -r, y = 0, err = 2-2*r; do { - api_pixel(memory, xm-x, ym+y, color); - api_pixel(memory, xm-y, ym-x, color); - api_pixel(memory, xm+x, ym-y, color); - api_pixel(memory, xm+y, ym+x, color); + api_pixel(tic, xm-x, ym+y, color); + api_pixel(tic, xm-y, ym-x, color); + api_pixel(tic, xm+x, ym-y, color); + api_pixel(tic, xm+y, ym+x, color); r = err; if (r <= y) err += ++y*2+1; if (r > x || err > y) err += ++x*2+1; } while (x < 0); } -typedef void(*linePixelFunc)(tic_mem* memory, s32 x, s32 y, u8 color); -static void ticLine(tic_mem* memory, s32 x0, s32 y0, s32 x1, s32 y1, u8 color, linePixelFunc func) +typedef void(*linePixelFunc)(tic_mem* tic, s32 x, s32 y, u8 color); +static void ticLine(tic_mem* tic, s32 x0, s32 y0, s32 x1, s32 y1, u8 color, linePixelFunc func) { s32 dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1; s32 dy = abs(y1 - y0), sy = y0 < y1 ? 1 : -1; @@ -915,7 +915,7 @@ static void ticLine(tic_mem* memory, s32 x0, s32 y0, s32 x1, s32 y1, u8 color, l for(;;) { - func(memory, x0, y0, color); + func(tic, x0, y0, color); if (x0 == x1 && y0 == y1) break; e2 = err; if (e2 >-dx) { err -= dy; x0 += sx; } @@ -923,20 +923,20 @@ static void ticLine(tic_mem* memory, s32 x0, s32 y0, s32 x1, s32 y1, u8 color, l } } -static void triPixelFunc(tic_mem* memory, s32 x, s32 y, u8 color) +static void triPixelFunc(tic_mem* tic, s32 x, s32 y, u8 color) { setSidePixel(x, y); } -static void api_tri(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, u8 color) +static void api_tri(tic_mem* tic, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, u8 color) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; initSidesBuffer(); - ticLine(memory, x1, y1, x2, y2, color, triPixelFunc); - ticLine(memory, x2, y2, x3, y3, color, triPixelFunc); - ticLine(memory, x3, y3, x1, y1, color, triPixelFunc); + ticLine(tic, x1, y1, x2, y2, color, triPixelFunc); + ticLine(tic, x2, y2, x3, y3, color, triPixelFunc); + ticLine(tic, x3, y3, x1, y1, color, triPixelFunc); u8 final_color = mapColor(&machine->memory, color); s32 yt = max(machine->state.clip.t, min(y1, min(y2, y3))); @@ -956,7 +956,7 @@ typedef struct } TexVert; -static void ticTexLine(tic_mem* memory, TexVert *v0, TexVert *v1) +static void ticTexLine(tic_mem* tic, TexVert *v0, TexVert *v1) { TexVert *top = v0; TexVert *bot = v1; @@ -1008,12 +1008,12 @@ static void ticTexLine(tic_mem* memory, TexVert *v0, TexVert *v1) } } -static void api_textri(tic_mem* memory, float x1, float y1, float x2, float y2, float x3, float y3, float u1, float v1, float u2, float v2, float u3, float v3, bool use_map, u8 chroma) +static void api_textri(tic_mem* tic, float x1, float y1, float x2, float y2, float x3, float y3, float u1, float v1, float u2, float v2, float u3, float v3, bool use_map, u8 chroma) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; TexVert V0, V1, V2; - const u8* ptr = memory->ram.tiles.data[0].data; - const u8* map = memory->ram.map.data; + const u8* ptr = tic->ram.tiles.data[0].data; + const u8* map = tic->ram.map.data; V0.x = x1; V0.y = y1; V0.u = u1; V0.v = v1; V1.x = x2; V1.y = y2; V1.u = u2; V1.v = v2; @@ -1037,9 +1037,9 @@ static void api_textri(tic_mem* memory, float x1, float y1, float x2, float y2, // fill the buffer initSidesBuffer(); // parse each line and decide where in the buffer to store them ( left or right ) - ticTexLine(memory, &V0, &V1); - ticTexLine(memory, &V1, &V2); - ticTexLine(memory, &V2, &V0); + ticTexLine(tic, &V0, &V1); + ticTexLine(tic, &V1, &V2); + ticTexLine(tic, &V2, &V0); for (s32 y = 0; y < TIC80_HEIGHT; y++) { @@ -1106,38 +1106,38 @@ static void api_textri(tic_mem* memory, float x1, float y1, float x2, float y2, } -static void api_sprite(tic_mem* memory, const tic_tiles* src, s32 index, s32 x, s32 y, u8* colors, s32 count) +static void api_sprite(tic_mem* tic, const tic_tiles* src, s32 index, s32 x, s32 y, u8* colors, s32 count) { - drawSprite(memory, src, index, x, y, colors, count, 1, tic_no_flip, tic_no_rotate); + drawSprite(tic, src, index, x, y, colors, count, 1, tic_no_flip, tic_no_rotate); } -static void api_map(tic_mem* memory, const tic_map* src, const tic_tiles* tiles, s32 x, s32 y, s32 width, s32 height, s32 sx, s32 sy, u8 chromakey, s32 scale) +static void api_map(tic_mem* tic, const tic_map* src, const tic_tiles* tiles, s32 x, s32 y, s32 width, s32 height, s32 sx, s32 sy, u8 chromakey, s32 scale) { - drawMap((tic_machine*)memory, src, tiles, x, y, width, height, sx, sy, chromakey, scale, NULL, NULL); + drawMap((tic_machine*)tic, src, tiles, x, y, width, height, sx, sy, chromakey, scale, NULL, NULL); } -static void api_remap(tic_mem* memory, const tic_map* src, const tic_tiles* tiles, s32 x, s32 y, s32 width, s32 height, s32 sx, s32 sy, u8 chromakey, s32 scale, RemapFunc remap, void* data) +static void api_remap(tic_mem* tic, const tic_map* src, const tic_tiles* tiles, s32 x, s32 y, s32 width, s32 height, s32 sx, s32 sy, u8 chromakey, s32 scale, RemapFunc remap, void* data) { - drawMap((tic_machine*)memory, src, tiles, x, y, width, height, sx, sy, chromakey, scale, remap, data); + drawMap((tic_machine*)tic, src, tiles, x, y, width, height, sx, sy, chromakey, scale, remap, data); } -static void api_map_set(tic_mem* memory, tic_map* src, s32 x, s32 y, u8 value) +static void api_map_set(tic_mem* tic, tic_map* src, s32 x, s32 y, u8 value) { if(x < 0 || x >= TIC_MAP_WIDTH || y < 0 || y >= TIC_MAP_HEIGHT) return; *(src->data + y * TIC_MAP_WIDTH + x) = value; } -static u8 api_map_get(tic_mem* memory, const tic_map* src, s32 x, s32 y) +static u8 api_map_get(tic_mem* tic, const tic_map* src, s32 x, s32 y) { if(x < 0 || x >= TIC_MAP_WIDTH || y < 0 || y >= TIC_MAP_HEIGHT) return 0; return *(src->data + y * TIC_MAP_WIDTH + x); } -static void api_line(tic_mem* memory, s32 x0, s32 y0, s32 x1, s32 y1, u8 color) +static void api_line(tic_mem* tic, s32 x0, s32 y0, s32 x1, s32 y1, u8 color) { - ticLine(memory, x0, y0, x1, y1, color, api_pixel); + ticLine(tic, x0, y0, x1, y1, color, api_pixel); } static s32 calcLoopPos(const tic_sound_loop* loop, s32 pos) @@ -1158,9 +1158,9 @@ static s32 calcLoopPos(const tic_sound_loop* loop, s32 pos) return offset; } -static void sfx(tic_mem* memory, s32 index, s32 freq, Channel* channel, tic_sound_register* reg) +static void sfx(tic_mem* tic, s32 index, s32 freq, Channel* channel, tic_sound_register* reg) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; if(channel->duration > 0) channel->duration--; @@ -1204,13 +1204,13 @@ static void sfx(tic_mem* memory, s32 index, s32 freq, Channel* channel, tic_soun } } -static void processMusic(tic_mem* memory) +static void processMusic(tic_mem* tic) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; if(machine->state.music.play == MusicStop) return; - const tic_track* track = &machine->sound.music->tracks.data[memory->ram.music_pos.track]; + const tic_track* track = &machine->sound.music->tracks.data[tic->ram.music_pos.track]; s32 row = machine->state.music.ticks * (track->tempo + DEFAULT_TEMPO) * DEFAULT_SPEED / (track->speed + DEFAULT_SPEED) / NOTES_PER_MUNUTE; s32 rows = MUSIC_PATTERN_ROWS - track->rows; @@ -1218,19 +1218,19 @@ static void processMusic(tic_mem* memory) { row = 0; machine->state.music.ticks = 0; - resetMusic(memory); + resetMusic(tic); if(machine->state.music.play == MusicPlay) { - memory->ram.music_pos.frame++; + tic->ram.music_pos.frame++; - if(memory->ram.music_pos.frame >= MUSIC_FRAMES) + if(tic->ram.music_pos.frame >= MUSIC_FRAMES) { - if(memory->ram.music_pos.flag.loop) - memory->ram.music_pos.frame = 0; + if(tic->ram.music_pos.flag.loop) + tic->ram.music_pos.frame = 0; else { - api_music(memory, -1, 0, 0, false); + api_music(tic, -1, 0, 0, false); return; } } @@ -1238,15 +1238,15 @@ static void processMusic(tic_mem* memory) { s32 val = 0; for (s32 c = 0; c < TIC_SOUND_CHANNELS; c++) - val += tic_tool_get_pattern_id(track, memory->ram.music_pos.frame, c); + val += tic_tool_get_pattern_id(track, tic->ram.music_pos.frame, c); if(!val) { - if(memory->ram.music_pos.flag.loop) - memory->ram.music_pos.frame = 0; + if(tic->ram.music_pos.flag.loop) + tic->ram.music_pos.frame = 0; else { - api_music(memory, -1, 0, 0, false); + api_music(tic, -1, 0, 0, false); return; } } @@ -1254,37 +1254,37 @@ static void processMusic(tic_mem* memory) } else if(machine->state.music.play == MusicPlayFrame) { - if(!memory->ram.music_pos.flag.loop) + if(!tic->ram.music_pos.flag.loop) { - api_music(memory, -1, 0, 0, false); + api_music(tic, -1, 0, 0, false); return; } } } - if (row != memory->ram.music_pos.row) + if (row != tic->ram.music_pos.row) { - memory->ram.music_pos.row = row; + tic->ram.music_pos.row = row; for (s32 channel = 0; channel < TIC_SOUND_CHANNELS; channel++) { - s32 patternId = tic_tool_get_pattern_id(track, memory->ram.music_pos.frame, channel); + s32 patternId = tic_tool_get_pattern_id(track, tic->ram.music_pos.frame, channel); if (!patternId) continue; const tic_track_pattern* pattern = &machine->sound.music->patterns.data[patternId - PATTERN_START]; - s32 note = pattern->rows[memory->ram.music_pos.row].note; + s32 note = pattern->rows[tic->ram.music_pos.row].note; if (note > NoteNone) { - musicSfx(memory, -1, 0, 0, 0, channel); + musicSfx(tic, -1, 0, 0, 0, channel); if (note >= NoteStart) { - s32 octave = pattern->rows[memory->ram.music_pos.row].octave; + s32 octave = pattern->rows[tic->ram.music_pos.row].octave; s32 sfx = (pattern->rows[row].sfxhi << MUSIC_SFXID_LOW_BITS) | pattern->rows[row].sfxlow; - s32 volume = pattern->rows[memory->ram.music_pos.row].volume; - musicSfx(memory, sfx, note - NoteStart, octave, volume, channel); + s32 volume = pattern->rows[tic->ram.music_pos.row].volume; + musicSfx(tic, sfx, note - NoteStart, octave, volume, channel); } } } @@ -1295,7 +1295,7 @@ static void processMusic(tic_mem* memory) Channel* c = &machine->state.music.channels[i]; if(c->index >= 0) - sfx(memory, c->index, c->freq, c, &memory->ram.registers[i]); + sfx(tic, c->index, c->freq, c, &tic->ram.registers[i]); } machine->state.music.ticks++; @@ -1317,24 +1317,24 @@ static bool isKeyPressed(const tic80_keyboard* input, tic_key key) return false; } -static void api_tick_start(tic_mem* memory, const tic_sfx* sfxsrc, const tic_music* music) +static void api_tick_start(tic_mem* tic, const tic_sfx* sfxsrc, const tic_music* music) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; machine->sound.sfx = sfxsrc; machine->sound.music = music; for (s32 i = 0; i < TIC_SOUND_CHANNELS; ++i ) - memset(&memory->ram.registers[i], 0, sizeof(tic_sound_register)); + memset(&tic->ram.registers[i], 0, sizeof(tic_sound_register)); - processMusic(memory); + processMusic(tic); for (s32 i = 0; i < TIC_SOUND_CHANNELS; ++i ) { Channel* c = &machine->state.channels[i]; if(c->index >= 0) - sfx(memory, c->index, c->freq, c, &memory->ram.registers[i]); + sfx(tic, c->index, c->freq, c, &tic->ram.registers[i]); } // process gamepad @@ -1342,7 +1342,7 @@ static void api_tick_start(tic_mem* memory, const tic_sfx* sfxsrc, const tic_mus { u32 mask = 1 << i; u32 prevDown = machine->state.gamepads.previous.data & mask; - u32 down = memory->ram.input.gamepads.data & mask; + u32 down = tic->ram.input.gamepads.data & mask; u32* hold = &machine->state.gamepads.holds[i]; if(prevDown && prevDown == down) (*hold)++; @@ -1353,7 +1353,7 @@ static void api_tick_start(tic_mem* memory, const tic_sfx* sfxsrc, const tic_mus for(s32 i = 0; i < tic_keys_count; i++) { bool prevDown = isKeyPressed(&machine->state.keyboard.previous, i); - bool down = isKeyPressed(&memory->ram.input.keyboard, i); + bool down = isKeyPressed(&tic->ram.input.keyboard, i); u32* hold = &machine->state.keyboard.holds[i]; @@ -1367,9 +1367,9 @@ static void api_tick_start(tic_mem* memory, const tic_sfx* sfxsrc, const tic_mus machine->state.drawhline = drawHLineDma; } -static void api_tick_end(tic_mem* memory) +static void api_tick_end(tic_mem* tic) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; machine->state.gamepads.previous.data = machine->memory.ram.input.gamepads.data; machine->state.keyboard.previous.data = machine->memory.ram.input.keyboard.data; @@ -1377,7 +1377,7 @@ static void api_tick_end(tic_mem* memory) enum {EndTime = CLOCKRATE / TIC_FRAMERATE}; for (s32 i = 0; i < TIC_SOUND_CHANNELS; ++i ) { - tic_sound_register* reg = &memory->ram.registers[i]; + tic_sound_register* reg = &tic->ram.registers[i]; tic_sound_register_data* data = &machine->state.registers[i]; isNoiseWaveform(®->waveform) @@ -1396,34 +1396,34 @@ static void api_tick_end(tic_mem* memory) } -static tic_sfx_pos api_sfx_pos(tic_mem* memory, s32 channel) +static tic_sfx_pos api_sfx_pos(tic_mem* tic, s32 channel) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; Channel* c = &machine->state.channels[channel]; return c->pos; } -static void api_sfx_ex(tic_mem* memory, s32 index, s32 note, s32 octave, s32 duration, s32 channel, s32 volume, s32 speed) +static void api_sfx_ex(tic_mem* tic, s32 index, s32 note, s32 octave, s32 duration, s32 channel, s32 volume, s32 speed) { - tic_machine* machine = (tic_machine*)memory; - channelSfx(memory, index, note, octave, duration, &machine->state.channels[channel], volume, speed); + tic_machine* machine = (tic_machine*)tic; + channelSfx(tic, index, note, octave, duration, &machine->state.channels[channel], volume, speed); } -static void api_sfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 duration, s32 channel) +static void api_sfx(tic_mem* tic, s32 index, s32 note, s32 octave, s32 duration, s32 channel) { - api_sfx_ex(memory, index, note, octave, duration, channel, MAX_VOLUME, SFX_DEF_SPEED); + api_sfx_ex(tic, index, note, octave, duration, channel, MAX_VOLUME, SFX_DEF_SPEED); } -static void api_sfx_stop(tic_mem* memory, s32 channel) +static void api_sfx_stop(tic_mem* tic, s32 channel) { - api_sfx(memory, -1, 0, 0, -1, channel); + api_sfx(tic, -1, 0, 0, -1, channel); } -static void api_music_frame(tic_mem* memory, s32 index, s32 frame, s32 row, bool loop) +static void api_music_frame(tic_mem* tic, s32 index, s32 frame, s32 row, bool loop) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; setMusic(machine, index, frame, row, loop); @@ -1492,11 +1492,11 @@ static void api_sync(tic_mem* tic, u32 mask, s32 bank, bool toCart) machine->state.synced |= mask; } -static void cart2ram(tic_mem* memory) +static void cart2ram(tic_mem* tic) { - api_sync(memory, 0, 0, false); + api_sync(tic, 0, 0, false); - initCover(memory); + initCover(tic); } static const char* readMetatag(const char* code, const char* tag, const char* comment) @@ -1586,18 +1586,18 @@ static const tic_script_config* getScriptConfig(const char* code) #endif } -static const tic_script_config* api_get_script_config(tic_mem* memory) +static const tic_script_config* api_get_script_config(tic_mem* tic) { - return getScriptConfig(memory->cart.bank0.code.data); + return getScriptConfig(tic->cart.bank0.code.data); } -static void updateSaveid(tic_mem* memory) +static void updateSaveid(tic_mem* tic) { - memset(memory->saveid, 0, sizeof memory->saveid); - const char* saveid = readMetatag(memory->cart.bank0.code.data, "saveid", api_get_script_config(memory)->singleComment); + memset(tic->saveid, 0, sizeof tic->saveid); + const char* saveid = readMetatag(tic->cart.bank0.code.data, "saveid", api_get_script_config(tic)->singleComment); if(saveid) { - strncpy(memory->saveid, saveid, TIC_SAVEID_SIZE-1); + strncpy(tic->saveid, saveid, TIC_SAVEID_SIZE-1); free((void*)saveid); } } @@ -1673,25 +1673,25 @@ static void api_tick(tic_mem* tic, tic_tick_data* data) machine->state.tick(tic); } -static void api_scanline(tic_mem* memory, s32 row, void* data) +static void api_scanline(tic_mem* tic, s32 row, void* data) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; if(machine->state.initialized) - machine->state.scanline(memory, row, data); + machine->state.scanline(tic, row, data); } -static void api_overline(tic_mem* memory, void* data) +static void api_overline(tic_mem* tic, void* data) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; if(machine->state.initialized) - machine->state.ovr.callback(memory, data); + machine->state.ovr.callback(tic, data); } -static double api_time(tic_mem* memory) +static double api_time(tic_mem* tic) { - tic_machine* machine = (tic_machine*)memory; + tic_machine* machine = (tic_machine*)tic; return (double)((machine->data->counter() - machine->data->start)*1000)/machine->data->freq(); } diff --git a/src/tic.h b/src/tic.h index 2e88631..0c1ba31 100644 --- a/src/tic.h +++ b/src/tic.h @@ -53,8 +53,6 @@ #define TIC_VRAM_SIZE (16*1024) //16K #define TIC_RAM_SIZE (80*1024) //80K -#define TIC_FONT_WIDTH 6 -#define TIC_FONT_HEIGHT 6 #define TIC_PALETTE_BPP 4 #define TIC_PALETTE_SIZE (1 << TIC_PALETTE_BPP) #define TIC_FRAMERATE 60 @@ -111,7 +109,6 @@ #define TIC_GAMEPADS (sizeof(tic80_gamepads) / sizeof(tic80_gamepad)) #define SFX_NOTES {"C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"} -#define TIC_FONT_CHARS 128 enum { @@ -359,11 +356,6 @@ typedef struct tic_cover_image cover; } tic_cartridge; -typedef struct -{ - u8 data[TIC_FONT_CHARS * BITS_IN_BYTE]; -} tic_font; - typedef struct { u8 data[TIC80_WIDTH * TIC80_HEIGHT * TIC_PALETTE_BPP / BITS_IN_BYTE]; diff --git a/src/tic80.c b/src/tic80.c index f92f6b3..82f577a 100644 --- a/src/tic80.c +++ b/src/tic80.c @@ -73,11 +73,15 @@ tic80* tic80_create(s32 samplerate) { memset(tic80, 0, sizeof(tic80_local)); - tic80->memory = tic_create(samplerate); + tic_mem* tic = tic80->memory = tic_create(samplerate); { + enum{FontWidth = 6, FontHeight = 6}; + static const u8 Font[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x00, 0x00, 0x00, 0x78, 0xa0, 0x70, 0x28, 0xf0, 0x00, 0x00, 0x00, 0x88, 0x10, 0x20, 0x40, 0x88, 0x00, 0x00, 0x00, 0x40, 0xa0, 0x68, 0x90, 0x68, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x40, 0x20, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, 0x20, 0xa8, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x70, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x70, 0xc8, 0xc8, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x30, 0x70, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0xf0, 0x18, 0x70, 0xc0, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x30, 0x98, 0x70, 0x00, 0x00, 0x00, 0x30, 0x70, 0xd0, 0xf8, 0x10, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0xf0, 0x18, 0xf0, 0x00, 0x00, 0x00, 0x70, 0xc0, 0xf0, 0xc8, 0x70, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x70, 0xc8, 0x70, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x70, 0xc8, 0x78, 0x08, 0x70, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x20, 0x40, 0x00, 0x00, 0x10, 0x20, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x78, 0x18, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0xa8, 0xb8, 0x80, 0x70, 0x00, 0x00, 0x00, 0x70, 0xc8, 0xc8, 0xf8, 0xc8, 0x00, 0x00, 0x00, 0xf0, 0xc8, 0xf0, 0xc8, 0xf0, 0x00, 0x00, 0x00, 0x70, 0xc8, 0xc0, 0xc8, 0x70, 0x00, 0x00, 0x00, 0xf0, 0xc8, 0xc8, 0xc8, 0xf0, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0xf0, 0xc0, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0xf0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x78, 0xc0, 0xd8, 0xc8, 0x78, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0xf8, 0xc8, 0xc8, 0x00, 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0xc8, 0xd0, 0xe0, 0xd0, 0xc8, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8, 0x00, 0x00, 0x00, 0xd8, 0xf8, 0xf8, 0xa8, 0x88, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xf8, 0xd8, 0xc8, 0x00, 0x00, 0x00, 0x70, 0xc8, 0xc8, 0xc8, 0x70, 0x00, 0x00, 0x00, 0xf0, 0xc8, 0xc8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x70, 0xc8, 0xc8, 0xc8, 0x70, 0x08, 0x00, 0x00, 0xf0, 0xc8, 0xc8, 0xf0, 0xc8, 0x00, 0x00, 0x00, 0x78, 0xe0, 0x70, 0x38, 0xf0, 0x00, 0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0xc8, 0xc8, 0x70, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0xc8, 0x70, 0x20, 0x00, 0x00, 0x00, 0x88, 0xa8, 0xf8, 0xf8, 0xd8, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0x70, 0xc8, 0xc8, 0x00, 0x00, 0x00, 0x68, 0x68, 0x78, 0x30, 0x30, 0x00, 0x00, 0x00, 0xf8, 0x30, 0x60, 0xc0, 0xf8, 0x00, 0x00, 0x00, 0x60, 0x40, 0x40, 0x40, 0x60, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x60, 0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x98, 0x98, 0x78, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0xc8, 0xc8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe0, 0xe0, 0x78, 0x00, 0x00, 0x00, 0x18, 0x78, 0x98, 0x98, 0x78, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xe0, 0x70, 0x00, 0x00, 0x00, 0x38, 0x60, 0xf8, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x70, 0x98, 0xf8, 0x18, 0x70, 0x00, 0x00, 0xc0, 0xf0, 0xc8, 0xc8, 0xc8, 0x00, 0x00, 0x00, 0x30, 0x00, 0x70, 0x30, 0x78, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x98, 0x70, 0x00, 0x00, 0xc0, 0xc8, 0xf0, 0xc8, 0xc8, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x38, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf8, 0xa8, 0xa8, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc8, 0xc8, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc8, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc8, 0xc8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x78, 0x98, 0x98, 0x78, 0x18, 0x00, 0x00, 0x00, 0xf0, 0xc8, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe0, 0x38, 0xf0, 0x00, 0x00, 0x00, 0x60, 0xf8, 0x60, 0x60, 0x38, 0x00, 0x00, 0x00, 0x00, 0x98, 0x98, 0x98, 0x78, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0xd0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x88, 0xa8, 0xf8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x70, 0x70, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x98, 0x98, 0x78, 0x18, 0x70, 0x00, 0x00, 0x00, 0xf8, 0x30, 0x60, 0xf8, 0x00, 0x00, 0x00, 0x30, 0x20, 0x60, 0x20, 0x30, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x60, 0x20, 0x30, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00, 0x28, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - memcpy(tic80->memory->font.data, Font, sizeof(tic_font)); + memcpy(tic->font.data, Font, sizeof tic->font.data); + tic->font.width = FontWidth; + tic->font.height = FontHeight; } return &tic80->tic; diff --git a/src/ticapi.h b/src/ticapi.h index 5b530f3..05c5baa 100644 --- a/src/ticapi.h +++ b/src/ticapi.h @@ -24,6 +24,8 @@ #include "tic.h" +#define TIC_FONT_CHARS 128 + typedef struct { u8 index; tic_flip flip; tic_rotate rotate; } RemapResult; typedef void(*RemapFunc)(void*, s32 x, s32 y, RemapResult* result); typedef struct @@ -173,7 +175,6 @@ struct tic_mem { tic_ram ram; tic_cartridge cart; - tic_font font; tic_api api; tic_persistent persistent; @@ -198,6 +199,13 @@ struct tic_mem } samples; u32 screen[TIC80_FULLWIDTH * TIC80_FULLHEIGHT]; + + struct + { + u8 data[TIC_FONT_CHARS * BITS_IN_BYTE]; + s32 width; + s32 height; + } font; }; tic_mem* tic_create(s32 samplerate);