Skip to content

Commit 38ec80b

Browse files
committed
#509: fixed custom cursor rendering
1 parent 9ba97ef commit 38ec80b

File tree

5 files changed

+11
-44
lines changed

5 files changed

+11
-44
lines changed

build/assets/config.tic.dat

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

config.lua

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
THEME=
22
{
3-
CURSOR=
4-
{
5-
ARROW=64,
6-
HAND=65,
7-
IBEAM=66,
8-
},
9-
103
CODE =
114
{
125
BG =15,
@@ -243,9 +236,6 @@ CRT_SHADER=
243236
-- 048:c2ccccccc2222222c222ccccc2222cccc2222222c1111111cc000cccecccccec
244237
-- 049:ccc200cc22220ccec2220cee22220cee22220cee1111ccee000cceeecccceeee
245238
-- 052:000000000fffff00000000000000000000000000000000000000000000000000
246-
-- 064:ff000000fcf00000fccf0000fcccf000fccccf00fcccf000fcffcf000f00f000
247-
-- 065:000f000000fcf00000fcff000ffcccf0fcfccccf0fcccccf00fcccf0000fff00
248-
-- 066:0fff0000fcccf0000fcf00000fcf00000fcf00000fcf0000fcccf0000fff0000
249239
-- 080:0000000000c0c00000c0c000000c00000cc0cc000cc0cc000000000000000000
250240
-- 081:000000000cccc0000c00c0000c0ccc000ccc0c00000ccc000000000000000000
251241
-- 082:0000000000ccc0000c000c000ccccc000cc0cc000ccccc000000000000000000
@@ -375,6 +365,9 @@ CRT_SHADER=
375365
-- </TILES>
376366

377367
-- <SPRITES>
368+
-- 000:ff000000fcf00000fccf0000fcccf000fccccf00fcccf000fcffcf000f00f000
369+
-- 001:000f000000fcf00000fcff000ffcccf0fcfccccf0fcccccf00fcccf0000fff00
370+
-- 002:0fff0000fcccf0000fcf00000fcf00000fcf00000fcf0000fcccf0000fff0000
378371
-- 033:00cc000000cc000000cc00000000000000cc0000000000000000000000000000
379372
-- 034:0c0c00000c0c0000000000000000000000000000000000000000000000000000
380373
-- 035:0c0c0000ccccc0000c0c0000ccccc0000c0c0000000000000000000000000000

src/studio/config.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,6 @@ static void readConfigCrtShader(Config* config, lua_State* lua)
126126

127127
#endif
128128

129-
static void readCursorTheme(Config* config, lua_State* lua)
130-
{
131-
lua_getfield(lua, -1, "CURSOR");
132-
133-
if(lua_type(lua, -1) == LUA_TTABLE)
134-
{
135-
readInteger(lua, "ARROW", &config->data.theme.cursor.arrow);
136-
readInteger(lua, "HAND", &config->data.theme.cursor.hand);
137-
readInteger(lua, "IBEAM", &config->data.theme.cursor.ibeam);
138-
}
139-
140-
lua_pop(lua, 1);
141-
}
142-
143129
static void readCodeTheme(Config* config, lua_State* lua)
144130
{
145131
lua_getfield(lua, -1, "CODE");
@@ -187,7 +173,6 @@ static void readTheme(Config* config, lua_State* lua)
187173

188174
if(lua_type(lua, -1) == LUA_TTABLE)
189175
{
190-
readCursorTheme(config, lua);
191176
readCodeTheme(config, lua);
192177
readGamepadTheme(config, lua);
193178
}

src/studio/studio.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,27 +1941,23 @@ static void blitCursor()
19411941
{
19421942
const tic_bank* bank = &tic->cart.bank0;
19431943

1944-
struct CursorInfo
1945-
{
1946-
tic_cursor cursor;
1947-
tic_point hot;
1948-
} info = {tic->ram.vram.vars.cursor.sprite};
1944+
tic_point hot = {0};
19491945

19501946
if(tic->ram.vram.vars.cursor.system)
19511947
{
19521948
bank = &getConfig()->cart->bank0;
1953-
info = (struct CursorInfo[])
1949+
hot = (tic_point[])
19541950
{
1955-
{getConfig()->theme.cursor.arrow, {0, 0}},
1956-
{getConfig()->theme.cursor.hand, {3, 0}},
1957-
{getConfig()->theme.cursor.ibeam, {2, 3}},
1951+
{0, 0},
1952+
{3, 0},
1953+
{2, 3},
19581954
}[tic->ram.vram.vars.cursor.sprite];
19591955
}
19601956

19611957
const tic_palette* pal = &bank->palette.scn;
1962-
const tic_tile* tile = &bank->tiles.data[info.cursor];
1958+
const tic_tile* tile = &bank->sprites.data[tic->ram.vram.vars.cursor.sprite];
19631959

1964-
u32 *dst = tic->screen + (m->x - info.hot.x) + (m->y - info.hot.y) * TIC80_FULLWIDTH,
1960+
u32 *dst = tic->screen + (m->x - hot.x) + (m->y - hot.y) * TIC80_FULLWIDTH,
19651961
*end = tic->screen + TIC80_FULLWIDTH * TIC80_FULLHEIGHT;
19661962

19671963
for(s32 src = 0; src != TIC_SPRITESIZE * TIC_SPRITESIZE; dst += TIC80_FULLWIDTH - TIC_SPRITESIZE)

src/studio/system.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ typedef struct
7777
{
7878
struct
7979
{
80-
s32 arrow;
81-
s32 hand;
82-
s32 ibeam;
83-
} cursor;
84-
85-
struct
86-
{
8780
#define CODE_COLOR_DEF(VAR) u8 VAR;
8881
CODE_COLORS_LIST(CODE_COLOR_DEF)
8982
#undef CODE_COLOR_DEF

0 commit comments

Comments
 (0)