fixed mouse input
This commit is contained in:
parent
b3f88b73ac
commit
9d23c9134d
|
@ -68,6 +68,7 @@
|
|||
<ClCompile Include="..\..\..\src\fs.c" />
|
||||
<ClCompile Include="..\..\..\src\history.c" />
|
||||
<ClCompile Include="..\..\..\src\html.c" />
|
||||
<ClCompile Include="..\..\..\src\main.c" />
|
||||
<ClCompile Include="..\..\..\src\map.c" />
|
||||
<ClCompile Include="..\..\..\src\menu.c" />
|
||||
<ClCompile Include="..\..\..\src\music.c" />
|
||||
|
|
|
@ -90,6 +90,9 @@
|
|||
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetTCP.c">
|
||||
<Filter>src\ext\net</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\main.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon.ico">
|
||||
|
|
12
src/code.c
12
src/code.c
|
@ -997,7 +997,7 @@ static void processMouse(Code* code)
|
|||
|
||||
if(code->scroll.active)
|
||||
{
|
||||
if(checkMouseDown(&code->rect, SDL_BUTTON_RIGHT))
|
||||
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;
|
||||
|
@ -1008,7 +1008,7 @@ static void processMouse(Code* code)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(checkMouseDown(&code->rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&code->rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX();
|
||||
s32 my = getMouseY();
|
||||
|
@ -1038,7 +1038,7 @@ static void processMouse(Code* code)
|
|||
code->cursor.mouseDownPosition = NULL;
|
||||
}
|
||||
|
||||
if(checkMouseDown(&code->rect, SDL_BUTTON_RIGHT))
|
||||
if(checkMouseDown(&code->rect, tic_mouse_right))
|
||||
{
|
||||
code->scroll.active = true;
|
||||
|
||||
|
@ -1287,14 +1287,14 @@ static void drawOutlineBar(Code* code, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
code->outline.index = mx;
|
||||
updateOutlineCode(code);
|
||||
|
||||
}
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
setCodeMode(code, TEXT_EDIT_MODE);
|
||||
}
|
||||
}
|
||||
|
@ -1440,7 +1440,7 @@ static void drawCodeToolbar(Code* code)
|
|||
|
||||
over = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
if (i == TEXT_RUN_CODE)
|
||||
{
|
||||
|
|
|
@ -37,13 +37,13 @@ static void drawButton(Dialog* dlg, const char* label, s32 x, s32 y, u8 color, u
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
down = true;
|
||||
dlg->focus = id;
|
||||
}
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
callback(dlg);
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ static void drawDialog(Dialog* dlg)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&header, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&header, tic_mouse_left))
|
||||
{
|
||||
if(!dlg->drag.active)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ static void drawDialog(Dialog* dlg)
|
|||
dlg->pos.y = dlg->drag.start.y - getMouseY();
|
||||
|
||||
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
|
||||
if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(!checkMouseDown(&rect, tic_mouse_left))
|
||||
dlg->drag.active = false;
|
||||
}
|
||||
|
||||
|
|
26
src/map.c
26
src/map.c
|
@ -95,7 +95,7 @@ static s32 drawWorldButton(Map* map, s32 x, s32 y)
|
|||
|
||||
showTooltip("WORLD MAP [tab]");
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
setStudioMode(TIC_WORLD_MODE);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ static s32 drawGridButton(Map* map, s32 x, s32 y)
|
|||
|
||||
showTooltip("SHOW/HIDE GRID [`]");
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
map->canvas.grid = !map->canvas.grid;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ static s32 drawSheetButton(Map* map, s32 x, s32 y)
|
|||
over = true;
|
||||
showTooltip("SHOW TILES [shift]");
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
map->sheet.show = !map->sheet.show;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ static s32 drawToolButton(Map* map, s32 x, s32 y, const u8* Icon, s32 width, con
|
|||
|
||||
showTooltip(tip);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
map->mode = mode;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ static void drawSheetOvr(Map* map, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX() - rect.x;
|
||||
s32 my = getMouseY() - rect.y;
|
||||
|
@ -484,7 +484,7 @@ static void processMouseDrawMode(Map* map)
|
|||
|
||||
drawTileCursor(map);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 tx = 0, ty = 0;
|
||||
getMouseMap(map, &tx, &ty);
|
||||
|
@ -551,8 +551,8 @@ static void processMouseDragMode(Map* map)
|
|||
{
|
||||
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
|
||||
|
||||
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_LEFT) ||
|
||||
checkMouseDown(&rect, SDL_BUTTON_RIGHT));
|
||||
processScrolling(map, checkMouseDown(&rect, tic_mouse_left) ||
|
||||
checkMouseDown(&rect, tic_mouse_right));
|
||||
}
|
||||
|
||||
static void resetSelection(Map* map)
|
||||
|
@ -584,7 +584,7 @@ static void drawPasteData(Map* map)
|
|||
|
||||
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
normalizeMap(&mx, &my);
|
||||
|
||||
|
@ -634,7 +634,7 @@ static void processMouseSelectMode(Map* map)
|
|||
drawPasteData(map);
|
||||
else
|
||||
{
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX() + map->scroll.x;
|
||||
s32 my = getMouseY() + map->scroll.y;
|
||||
|
@ -796,7 +796,7 @@ static void processMouseFillMode(Map* map)
|
|||
|
||||
drawTileCursor(map);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 tx = 0, ty = 0;
|
||||
getMouseMap(map, &tx, &ty);
|
||||
|
@ -884,7 +884,7 @@ static void drawMapOvr(Map* map)
|
|||
if(tic->api.key(tic, tic_key_space))
|
||||
// if(getKeyboard()[SDL_SCANCODE_SPACE])
|
||||
{
|
||||
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_LEFT) || checkMouseDown(&rect, SDL_BUTTON_RIGHT));
|
||||
processScrolling(map, checkMouseDown(&rect, tic_mouse_left) || checkMouseDown(&rect, tic_mouse_right));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ static void drawMapOvr(Map* map)
|
|||
Handlers[map->mode](map);
|
||||
|
||||
if(map->mode != MAP_DRAG_MODE)
|
||||
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_RIGHT));
|
||||
processScrolling(map, checkMouseDown(&rect, tic_mouse_right));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
src/menu.c
16
src/menu.c
|
@ -84,7 +84,7 @@ static void drawDialog(Menu* menu)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&header, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&header, tic_mouse_left))
|
||||
{
|
||||
if(!menu->drag.active)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ static void drawDialog(Menu* menu)
|
|||
menu->pos.y = menu->drag.start.y - getMouseY();
|
||||
|
||||
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
|
||||
if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(!checkMouseDown(&rect, tic_mouse_left))
|
||||
menu->drag.active = false;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ static void drawTabDisabled(Menu* menu, s32 x, s32 y, s32 id)
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
menu->gamepad.tab = id;
|
||||
menu->gamepad.selected = -1;
|
||||
|
@ -200,7 +200,7 @@ static void drawPlayerButtons(Menu* menu, s32 x, s32 y)
|
|||
|
||||
over = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
menu->gamepad.selected = menu->gamepad.selected != index ? index : -1;
|
||||
}
|
||||
|
@ -261,12 +261,12 @@ static void drawGamepadMenu(Menu* menu)
|
|||
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
down = true;
|
||||
}
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
menu->gamepad.selected = -1;
|
||||
menu->mode = MAIN_MENU_MODE;
|
||||
|
@ -328,13 +328,13 @@ static void drawMainMenu(Menu* menu)
|
|||
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&label, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&label, tic_mouse_left))
|
||||
{
|
||||
down = true;
|
||||
menu->main.focus = i;
|
||||
}
|
||||
|
||||
if(checkMouseClick(&label, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&label, tic_mouse_left))
|
||||
{
|
||||
MenuHandlers[i](menu);
|
||||
return;
|
||||
|
|
30
src/music.c
30
src/music.c
|
@ -100,10 +100,10 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
set(music, -1, channel);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
music->tracker.row = -1;
|
||||
music->tracker.col = channel * CHANNEL_COLS;
|
||||
|
@ -154,10 +154,10 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
set(music, +1, channel);
|
||||
}
|
||||
|
||||
|
@ -207,10 +207,10 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value,
|
|||
|
||||
over = true;
|
||||
|
||||
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
set(music, -1, data);
|
||||
}
|
||||
|
||||
|
@ -237,10 +237,10 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value,
|
|||
|
||||
over = true;
|
||||
|
||||
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
set(music, +1, data);
|
||||
}
|
||||
|
||||
|
@ -1140,7 +1140,7 @@ static void drawTrackerFrames(Music* music, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 my = getMouseY() - rect.y - Border;
|
||||
music->tracker.frame = my / TIC_FONT_HEIGHT;
|
||||
|
@ -1222,7 +1222,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX() - rect.x - Border;
|
||||
s32 my = getMouseY() - rect.y - Border;
|
||||
|
@ -1247,7 +1247,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
|
|||
if(music->tracker.select.drag)
|
||||
{
|
||||
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
|
||||
if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(!checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
music->tracker.select.drag = false;
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 index)
|
|||
|
||||
showTooltip("on/off channel");
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
if (SDL_GetModState() & KMOD_CTRL)
|
||||
{
|
||||
|
@ -1452,7 +1452,7 @@ static void drawPlayButtons(Music* music)
|
|||
|
||||
static void(*const Handlers[])(Music*) = { enableFollowMode, playFrame, playTrack, stopTrack };
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
Handlers[i](music);
|
||||
}
|
||||
|
||||
|
@ -1505,7 +1505,7 @@ static void drawModeTabs(Music* music)
|
|||
static const char* Tooltips[] = { "PIANO MODE", "TRACKER MODE" };
|
||||
showTooltip(Tooltips[i]);
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
music->tab = Tabs[i];
|
||||
}
|
||||
|
||||
|
|
28
src/sfx.c
28
src/sfx.c
|
@ -74,7 +74,7 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
set(sfx, -1);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
set(sfx, +1);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y)
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
sfx->waveform.index = i;
|
||||
sfx->tab = SFX_WAVEFORM_TAB;
|
||||
|
@ -246,7 +246,7 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y)
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if(checkMouseClick(&iconRect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&iconRect, tic_mouse_left))
|
||||
{
|
||||
tic_sample* effect = getEffect(sfx);
|
||||
for(s32 c = 0; c < SFX_TICKS; c++)
|
||||
|
@ -301,7 +301,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
sfx->canvasTab = i;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
effect->pitch16x++;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
effect->reverse++;
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y)
|
|||
mx -= mx % CANVAS_SIZE;
|
||||
my -= my % CANVAS_SIZE;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
mx /= CANVAS_SIZE;
|
||||
my /= CANVAS_SIZE;
|
||||
|
@ -480,7 +480,7 @@ static void drawPiano(Sfx* sfx, s32 x, s32 y)
|
|||
}
|
||||
}
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
for(s32 i = COUNT_OF(buttons) - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -531,7 +531,7 @@ static void drawOctavePanel(Sfx* sfx, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
effect->octave = i;
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ static void drawModeTabs(Sfx* sfx)
|
|||
static const char* Tooltips[] = { "WAVEFORMS [tab]", "ENVELOPES [tab]" };
|
||||
showTooltip(Tooltips[i]);
|
||||
|
||||
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if (checkMouseClick(&rect, tic_mouse_left))
|
||||
sfx->tab = Tabs[i];
|
||||
}
|
||||
|
||||
|
@ -804,7 +804,7 @@ static void drawSfxToolbar(Sfx* sfx)
|
|||
|
||||
showTooltip("PLAY SFX [space]");
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
sfx->play.active = true;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ static void drawWaveformBar(Sfx* sfx, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
sfx->waveform.index = i;
|
||||
}
|
||||
|
||||
|
@ -925,7 +925,7 @@ static void drawWaveformCanvas(Sfx* sfx, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX() - x;
|
||||
s32 my = getMouseY() - y;
|
||||
|
|
60
src/sprite.c
60
src/sprite.c
|
@ -101,10 +101,10 @@ static void processPickerCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 s
|
|||
|
||||
drawCursorBorder(sprite, x + mx, y + my, Size, Size);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
sprite->color = getSheetPixel(sprite, sx + mx / Size, sy + my / Size);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_RIGHT))
|
||||
if(checkMouseDown(&rect, tic_mouse_right))
|
||||
sprite->color2 = getSheetPixel(sprite, sx + mx / Size, sy + my / Size);
|
||||
}
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ static void processDrawCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 sy)
|
|||
|
||||
drawCursorBorder(sprite, x + mx, y + my, brushSize, brushSize);
|
||||
|
||||
bool left = checkMouseDown(&rect, SDL_BUTTON_LEFT);
|
||||
bool right = checkMouseDown(&rect, SDL_BUTTON_RIGHT);
|
||||
bool left = checkMouseDown(&rect, tic_mouse_left);
|
||||
bool right = checkMouseDown(&rect, tic_mouse_right);
|
||||
|
||||
if(left || right)
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ static void processSelectCanvasMouse(Sprite* sprite, s32 x, s32 y)
|
|||
|
||||
drawCursorBorder(sprite, x + mx, y + my, Size, Size);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
if(sprite->select.drag)
|
||||
{
|
||||
|
@ -289,8 +289,8 @@ static void processFillCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 l, s32 t)
|
|||
|
||||
drawCursorBorder(sprite, x + mx, y + my, Size, Size);
|
||||
|
||||
bool left = checkMouseClick(&rect, SDL_BUTTON_LEFT);
|
||||
bool right = checkMouseClick(&rect, SDL_BUTTON_RIGHT);
|
||||
bool left = checkMouseClick(&rect, tic_mouse_left);
|
||||
bool right = checkMouseClick(&rect, tic_mouse_right);
|
||||
|
||||
if(left || right)
|
||||
{
|
||||
|
@ -333,7 +333,7 @@ static void drawBrushSlider(Sprite* sprite, s32 x, s32 y)
|
|||
showTooltip("BRUSH SIZE");
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 my = getMouseY() - y;
|
||||
|
||||
|
@ -638,9 +638,9 @@ static void drawMoveButtons(Sprite* sprite)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&Rects[i], SDL_BUTTON_LEFT)) down = true;
|
||||
if(checkMouseDown(&Rects[i], tic_mouse_left)) down = true;
|
||||
|
||||
if(checkMouseClick(&Rects[i], SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&Rects[i], tic_mouse_left))
|
||||
Func[i](sprite);
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX() - x;
|
||||
*value = mx * Max / (Size-1);
|
||||
|
@ -717,10 +717,10 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
(*value)--;
|
||||
}
|
||||
|
||||
|
@ -755,10 +755,10 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
(*value)++;
|
||||
}
|
||||
|
||||
|
@ -808,10 +808,10 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
|
|||
showTooltip("COPY PALETTE");
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
toClipboard(sprite->tic->cart.palette.data, sizeof(tic_palette), false);
|
||||
}
|
||||
|
||||
|
@ -851,10 +851,10 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
|
|||
showTooltip("PASTE PALETTE");
|
||||
over = true;
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
pasteColor(sprite);
|
||||
}
|
||||
|
@ -904,8 +904,8 @@ static void drawPalette(Sprite* sprite, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
bool left = checkMouseDown(&rect, SDL_BUTTON_LEFT);
|
||||
bool right = checkMouseDown(&rect, SDL_BUTTON_RIGHT);
|
||||
bool left = checkMouseDown(&rect, tic_mouse_left);
|
||||
bool right = checkMouseDown(&rect, tic_mouse_right);
|
||||
|
||||
if(left || right)
|
||||
{
|
||||
|
@ -957,10 +957,10 @@ static void drawPalette(Sprite* sprite, s32 x, s32 y)
|
|||
|
||||
showTooltip("EDIT PALETTE");
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
down = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
sprite->editPalette = !sprite->editPalette;
|
||||
}
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ static void drawSheet(Sprite* sprite, s32 x, s32 y)
|
|||
{
|
||||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 offset = (sprite->size - TIC_SPRITESIZE) / 2;
|
||||
selectSprite(sprite, getMouseX() - x - offset, getMouseY() - y - offset);
|
||||
|
@ -1210,9 +1210,9 @@ static void drawSpriteTools(Sprite* sprite, s32 x, s32 y)
|
|||
|
||||
showTooltip(Tooltips[i]);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT)) pushed = true;
|
||||
if(checkMouseDown(&rect, tic_mouse_left)) pushed = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
if(hasCanvasSelection(sprite))
|
||||
{
|
||||
|
@ -1295,7 +1295,7 @@ static void drawTools(Sprite* sprite, s32 x, s32 y)
|
|||
|
||||
showTooltip(Tooltips[i]);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
sprite->mode = i;
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ static void drawSpriteToolbar(Sprite* sprite)
|
|||
|
||||
showTooltip("CANVAS ZOOM");
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
s32 mx = getMouseX() - rect.x;
|
||||
mx /= 6;
|
||||
|
@ -1557,7 +1557,7 @@ static void drawSpriteToolbar(Sprite* sprite)
|
|||
|
||||
showTooltip("TILES [tab]");
|
||||
|
||||
if(!bg && checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(!bg && checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
sprite->index -= TIC_BANK_SPRITES;
|
||||
clearCanvasSelection(sprite);
|
||||
|
@ -1577,7 +1577,7 @@ static void drawSpriteToolbar(Sprite* sprite)
|
|||
|
||||
showTooltip("SPRITES [tab]");
|
||||
|
||||
if(bg && checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(bg && checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
sprite->index += TIC_BANK_SPRITES;
|
||||
clearCanvasSelection(sprite);
|
||||
|
|
20
src/studio.c
20
src/studio.c
|
@ -586,12 +586,12 @@ static void drawExtrabar(tic_mem* tic)
|
|||
color = Colors[i];
|
||||
showTooltip(Tips[i]);
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
bgcolor = color;
|
||||
color = (tic_color_white);
|
||||
}
|
||||
else if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
else if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
setStudioEvent(Events[i]);
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ static void drawBankIcon(s32 x, s32 y)
|
|||
|
||||
showTooltip("SWITCH BANK");
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
studioImpl.bank.show = !studioImpl.bank.show;
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ static void drawBankIcon(s32 x, s32 y)
|
|||
setCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
over = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
if(studioImpl.bank.chained)
|
||||
SDL_memset(studioImpl.bank.indexes, i, sizeof studioImpl.bank.indexes);
|
||||
|
@ -703,7 +703,7 @@ static void drawBankIcon(s32 x, s32 y)
|
|||
|
||||
over = true;
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
{
|
||||
studioImpl.bank.chained = !studioImpl.bank.chained;
|
||||
|
||||
|
@ -808,7 +808,7 @@ void drawToolbar(tic_mem* tic, u8 color, bool bg)
|
|||
|
||||
showTooltip(Tips[i]);
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
setStudioMode(Modes[i]);
|
||||
}
|
||||
|
||||
|
@ -1119,7 +1119,7 @@ bool checkMousePos(const SDL_Rect* rect)
|
|||
|
||||
bool checkMouseClick(const SDL_Rect* rect, s32 button)
|
||||
{
|
||||
MouseState* state = &studioImpl.mouse.state[button - 1];
|
||||
MouseState* state = &studioImpl.mouse.state[button];
|
||||
|
||||
bool value = state->click
|
||||
&& SDL_PointInRect(&state->start, rect)
|
||||
|
@ -1132,7 +1132,7 @@ bool checkMouseClick(const SDL_Rect* rect, s32 button)
|
|||
|
||||
bool checkMouseDown(const SDL_Rect* rect, s32 button)
|
||||
{
|
||||
MouseState* state = &studioImpl.mouse.state[button - 1];
|
||||
MouseState* state = &studioImpl.mouse.state[button];
|
||||
|
||||
return state->down && SDL_PointInRect(&state->start, rect);
|
||||
}
|
||||
|
@ -2898,14 +2898,14 @@ static void processMouseStates()
|
|||
{
|
||||
MouseState* state = &studioImpl.mouse.state[i];
|
||||
|
||||
if(!state->down && tic->ram.input.mouse.btns & (1 << i))
|
||||
if(!state->down && (tic->ram.input.mouse.btns & (1 << i)))
|
||||
{
|
||||
state->down = true;
|
||||
|
||||
state->start.x = tic->ram.input.mouse.x;
|
||||
state->start.y = tic->ram.input.mouse.y;
|
||||
}
|
||||
else if(state->down && tic->ram.input.mouse.btns & (1 << i))
|
||||
else if(state->down && !(tic->ram.input.mouse.btns & (1 << i)))
|
||||
{
|
||||
state->end.x = tic->ram.input.mouse.x;
|
||||
state->end.y = tic->ram.input.mouse.y;
|
||||
|
|
|
@ -512,3 +512,10 @@ enum
|
|||
|
||||
tic_keys_count
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
tic_mouse_left,
|
||||
tic_mouse_middle,
|
||||
tic_mouse_right,
|
||||
};
|
||||
|
|
|
@ -47,13 +47,13 @@ static void drawGrid(World* world)
|
|||
s32 mx = getMouseX();
|
||||
s32 my = getMouseY();
|
||||
|
||||
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseDown(&rect, tic_mouse_left))
|
||||
{
|
||||
map->scroll.x = (mx - TIC_MAP_SCREEN_WIDTH/2) * TIC_SPRITESIZE;
|
||||
map->scroll.y = (my - TIC_MAP_SCREEN_HEIGHT/2) * TIC_SPRITESIZE;
|
||||
}
|
||||
|
||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||
if(checkMouseClick(&rect, tic_mouse_left))
|
||||
setStudioMode(TIC_MAP_MODE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue