no message
This commit is contained in:
parent
96f956790a
commit
e4eac02295
94
src/code.c
94
src/code.c
|
@ -884,14 +884,14 @@ static void processKeyboard(Code* code)
|
||||||
bool ctrl = tic->api.key(tic, tic_key_ctrl);
|
bool ctrl = tic->api.key(tic, tic_key_ctrl);
|
||||||
bool alt = tic->api.key(tic, tic_key_alt);
|
bool alt = tic->api.key(tic, tic_key_alt);
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_up)
|
if(keyWasPressed(tic_key_up)
|
||||||
|| isKeyBeenPressed(tic_key_down)
|
|| keyWasPressed(tic_key_down)
|
||||||
|| isKeyBeenPressed(tic_key_left)
|
|| keyWasPressed(tic_key_left)
|
||||||
|| isKeyBeenPressed(tic_key_right)
|
|| keyWasPressed(tic_key_right)
|
||||||
|| isKeyBeenPressed(tic_key_home)
|
|| keyWasPressed(tic_key_home)
|
||||||
|| isKeyBeenPressed(tic_key_end)
|
|| keyWasPressed(tic_key_end)
|
||||||
|| isKeyBeenPressed(tic_key_pageup)
|
|| keyWasPressed(tic_key_pageup)
|
||||||
|| isKeyBeenPressed(tic_key_pagedown))
|
|| keyWasPressed(tic_key_pagedown))
|
||||||
{
|
{
|
||||||
if(!shift) code->cursor.selection = NULL;
|
if(!shift) code->cursor.selection = NULL;
|
||||||
else if(code->cursor.selection == NULL) code->cursor.selection = code->cursor.position;
|
else if(code->cursor.selection == NULL) code->cursor.selection = code->cursor.position;
|
||||||
|
@ -901,9 +901,9 @@ static void processKeyboard(Code* code)
|
||||||
{
|
{
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_left)) leftWord(code);
|
if(keyWasPressed(tic_key_left)) leftWord(code);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) rightWord(code);
|
else if(keyWasPressed(tic_key_right)) rightWord(code);
|
||||||
else if(isKeyBeenPressed(tic_key_tab)) doTab(code, shift, ctrl);
|
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
|
||||||
}
|
}
|
||||||
// else if(keymod & KMOD_GUI)
|
// else if(keymod & KMOD_GUI)
|
||||||
// {
|
// {
|
||||||
|
@ -914,35 +914,35 @@ static void processKeyboard(Code* code)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_a)) selectAll(code);
|
if(keyWasPressed(tic_key_a)) selectAll(code);
|
||||||
else if(isKeyBeenPressed(tic_key_z)) undo(code);
|
else if(keyWasPressed(tic_key_z)) undo(code);
|
||||||
else if(isKeyBeenPressed(tic_key_y)) redo(code);
|
else if(keyWasPressed(tic_key_y)) redo(code);
|
||||||
else if(isKeyBeenPressed(tic_key_f)) setCodeMode(code, TEXT_FIND_MODE);
|
else if(keyWasPressed(tic_key_f)) setCodeMode(code, TEXT_FIND_MODE);
|
||||||
else if(isKeyBeenPressed(tic_key_g)) setCodeMode(code, TEXT_GOTO_MODE);
|
else if(keyWasPressed(tic_key_g)) setCodeMode(code, TEXT_GOTO_MODE);
|
||||||
else if(isKeyBeenPressed(tic_key_o)) setCodeMode(code, TEXT_OUTLINE_MODE);
|
else if(keyWasPressed(tic_key_o)) setCodeMode(code, TEXT_OUTLINE_MODE);
|
||||||
else if(isKeyBeenPressed(tic_key_slash)) commentLine(code);
|
else if(keyWasPressed(tic_key_slash)) commentLine(code);
|
||||||
else if(isKeyBeenPressed(tic_key_home)) goCodeHome(code);
|
else if(keyWasPressed(tic_key_home)) goCodeHome(code);
|
||||||
else if(isKeyBeenPressed(tic_key_end)) goCodeEnd(code);
|
else if(keyWasPressed(tic_key_end)) goCodeEnd(code);
|
||||||
}
|
}
|
||||||
else if(alt)
|
else if(alt)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_left)) leftWord(code);
|
if(keyWasPressed(tic_key_left)) leftWord(code);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) rightWord(code);
|
else if(keyWasPressed(tic_key_right)) rightWord(code);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up)) upLine(code);
|
if(keyWasPressed(tic_key_up)) upLine(code);
|
||||||
else if(isKeyBeenPressed(tic_key_down)) downLine(code);
|
else if(keyWasPressed(tic_key_down)) downLine(code);
|
||||||
else if(isKeyBeenPressed(tic_key_left)) leftColumn(code);
|
else if(keyWasPressed(tic_key_left)) leftColumn(code);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) rightColumn(code);
|
else if(keyWasPressed(tic_key_right)) rightColumn(code);
|
||||||
else if(isKeyBeenPressed(tic_key_home)) goHome(code);
|
else if(keyWasPressed(tic_key_home)) goHome(code);
|
||||||
else if(isKeyBeenPressed(tic_key_end)) goEnd(code);
|
else if(keyWasPressed(tic_key_end)) goEnd(code);
|
||||||
else if(isKeyBeenPressed(tic_key_pageup)) pageUp(code);
|
else if(keyWasPressed(tic_key_pageup)) pageUp(code);
|
||||||
else if(isKeyBeenPressed(tic_key_pagedown)) pageDown(code);
|
else if(keyWasPressed(tic_key_pagedown)) pageDown(code);
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) deleteChar(code);
|
else if(keyWasPressed(tic_key_delete)) deleteChar(code);
|
||||||
else if(isKeyBeenPressed(tic_key_backspace)) backspaceChar(code);
|
else if(keyWasPressed(tic_key_backspace)) backspaceChar(code);
|
||||||
else if(isKeyBeenPressed(tic_key_return)) newLine(code);
|
else if(keyWasPressed(tic_key_return)) newLine(code);
|
||||||
else if(isKeyBeenPressed(tic_key_tab)) doTab(code, shift, ctrl);
|
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateEditor(code);
|
updateEditor(code);
|
||||||
|
@ -1124,22 +1124,22 @@ static char* downStrStr(const char* start, const char* from, const char* substr)
|
||||||
|
|
||||||
static void textFindTick(Code* code)
|
static void textFindTick(Code* code)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_return)) setCodeMode(code, TEXT_EDIT_MODE);
|
if(keyWasPressed(tic_key_return)) setCodeMode(code, TEXT_EDIT_MODE);
|
||||||
else if(isKeyBeenPressed(tic_key_up)
|
else if(keyWasPressed(tic_key_up)
|
||||||
|| isKeyBeenPressed(tic_key_down)
|
|| keyWasPressed(tic_key_down)
|
||||||
|| isKeyBeenPressed(tic_key_left)
|
|| keyWasPressed(tic_key_left)
|
||||||
|| isKeyBeenPressed(tic_key_right))
|
|| keyWasPressed(tic_key_right))
|
||||||
{
|
{
|
||||||
if(*code->popup.text)
|
if(*code->popup.text)
|
||||||
{
|
{
|
||||||
bool reverse = isKeyBeenPressed(tic_key_up) || isKeyBeenPressed(tic_key_left);
|
bool reverse = keyWasPressed(tic_key_up) || keyWasPressed(tic_key_left);
|
||||||
char* (*func)(const char*, const char*, const char*) = reverse ? upStrStr : downStrStr;
|
char* (*func)(const char*, const char*, const char*) = reverse ? upStrStr : downStrStr;
|
||||||
char* from = reverse ? MIN(code->cursor.position, code->cursor.selection) : MAX(code->cursor.position, code->cursor.selection);
|
char* from = reverse ? MIN(code->cursor.position, code->cursor.selection) : MAX(code->cursor.position, code->cursor.selection);
|
||||||
char* pos = func(code->src, from, code->popup.text);
|
char* pos = func(code->src, from, code->popup.text);
|
||||||
updateFindCode(code, pos);
|
updateFindCode(code, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_backspace))
|
else if(keyWasPressed(tic_key_backspace))
|
||||||
{
|
{
|
||||||
if(*code->popup.text)
|
if(*code->popup.text)
|
||||||
{
|
{
|
||||||
|
@ -1190,14 +1190,14 @@ static void textGoToTick(Code* code)
|
||||||
{
|
{
|
||||||
tic_mem* tic = code->tic;
|
tic_mem* tic = code->tic;
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_return))
|
if(keyWasPressed(tic_key_return))
|
||||||
{
|
{
|
||||||
if(*code->popup.text)
|
if(*code->popup.text)
|
||||||
updateGotoCode(code);
|
updateGotoCode(code);
|
||||||
|
|
||||||
setCodeMode(code, TEXT_EDIT_MODE);
|
setCodeMode(code, TEXT_EDIT_MODE);
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_backspace))
|
else if(keyWasPressed(tic_key_backspace))
|
||||||
{
|
{
|
||||||
if(*code->popup.text)
|
if(*code->popup.text)
|
||||||
{
|
{
|
||||||
|
@ -1276,7 +1276,7 @@ static void drawOutlineBar(Code* code, s32 x, s32 y)
|
||||||
|
|
||||||
static void textOutlineTick(Code* code)
|
static void textOutlineTick(Code* code)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up))
|
if(keyWasPressed(tic_key_up))
|
||||||
{
|
{
|
||||||
if(code->outline.index > 0)
|
if(code->outline.index > 0)
|
||||||
{
|
{
|
||||||
|
@ -1284,7 +1284,7 @@ static void textOutlineTick(Code* code)
|
||||||
updateOutlineCode(code);
|
updateOutlineCode(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_down))
|
else if(keyWasPressed(tic_key_down))
|
||||||
{
|
{
|
||||||
if(code->outline.index < OUTLINE_SIZE - 1 && code->outline.items[code->outline.index + 1].pos)
|
if(code->outline.index < OUTLINE_SIZE - 1 && code->outline.items[code->outline.index + 1].pos)
|
||||||
{
|
{
|
||||||
|
@ -1292,12 +1292,12 @@ static void textOutlineTick(Code* code)
|
||||||
updateOutlineCode(code);
|
updateOutlineCode(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_return))
|
else if(keyWasPressed(tic_key_return))
|
||||||
{
|
{
|
||||||
updateOutlineCode(code);
|
updateOutlineCode(code);
|
||||||
setCodeMode(code, TEXT_EDIT_MODE);
|
setCodeMode(code, TEXT_EDIT_MODE);
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_backspace))
|
else if(keyWasPressed(tic_key_backspace))
|
||||||
{
|
{
|
||||||
if(*code->popup.text)
|
if(*code->popup.text)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2571,28 +2571,28 @@ static void tick(Console* console)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up)) onHistoryUp(console);
|
if(keyWasPressed(tic_key_up)) onHistoryUp(console);
|
||||||
else if(isKeyBeenPressed(tic_key_down)) onHistoryDown(console);
|
else if(keyWasPressed(tic_key_down)) onHistoryDown(console);
|
||||||
else if(isKeyBeenPressed(tic_key_left))
|
else if(keyWasPressed(tic_key_left))
|
||||||
{
|
{
|
||||||
if(console->inputPosition > 0)
|
if(console->inputPosition > 0)
|
||||||
console->inputPosition--;
|
console->inputPosition--;
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_right))
|
else if(keyWasPressed(tic_key_right))
|
||||||
{
|
{
|
||||||
console->inputPosition++;
|
console->inputPosition++;
|
||||||
size_t len = strlen(console->inputBuffer);
|
size_t len = strlen(console->inputBuffer);
|
||||||
if(console->inputPosition > len)
|
if(console->inputPosition > len)
|
||||||
console->inputPosition = len;
|
console->inputPosition = len;
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_return)) processConsoleCommand(console);
|
else if(keyWasPressed(tic_key_return)) processConsoleCommand(console);
|
||||||
else if(isKeyBeenPressed(tic_key_backspace)) processConsoleBackspace(console);
|
else if(keyWasPressed(tic_key_backspace)) processConsoleBackspace(console);
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) processConsoleDel(console);
|
else if(keyWasPressed(tic_key_delete)) processConsoleDel(console);
|
||||||
else if(isKeyBeenPressed(tic_key_home)) processConsoleHome(console);
|
else if(keyWasPressed(tic_key_home)) processConsoleHome(console);
|
||||||
else if(isKeyBeenPressed(tic_key_end)) processConsoleEnd(console);
|
else if(keyWasPressed(tic_key_end)) processConsoleEnd(console);
|
||||||
else if(isKeyBeenPressed(tic_key_tab)) processConsoleTab(console);
|
else if(keyWasPressed(tic_key_tab)) processConsoleTab(console);
|
||||||
|
|
||||||
if(isAnyKeyBeenPressed())
|
if(anyKeyWasPressed())
|
||||||
{
|
{
|
||||||
scrollConsole(console);
|
scrollConsole(console);
|
||||||
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
||||||
|
|
|
@ -93,17 +93,17 @@ static void onNo(Dialog* dlg)
|
||||||
|
|
||||||
static void processKeyboard(Dialog* dlg)
|
static void processKeyboard(Dialog* dlg)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_left))
|
if(keyWasPressed(tic_key_left))
|
||||||
{
|
{
|
||||||
dlg->focus = (dlg->focus-1) % 2;
|
dlg->focus = (dlg->focus-1) % 2;
|
||||||
playSystemSfx(2);
|
playSystemSfx(2);
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_right) || isKeyBeenPressed(tic_key_tab))
|
else if(keyWasPressed(tic_key_right) || keyWasPressed(tic_key_tab))
|
||||||
{
|
{
|
||||||
dlg->focus = (dlg->focus+1) % 2;
|
dlg->focus = (dlg->focus+1) % 2;
|
||||||
playSystemSfx(2);
|
playSystemSfx(2);
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_return) || isKeyBeenPressed(tic_key_space))
|
else if(keyWasPressed(tic_key_return) || keyWasPressed(tic_key_space))
|
||||||
{
|
{
|
||||||
dlg->focus == 0 ? onYes(dlg) : onNo(dlg);
|
dlg->focus == 0 ? onYes(dlg) : onNo(dlg);
|
||||||
}
|
}
|
||||||
|
|
18
src/map.c
18
src/map.c
|
@ -1021,18 +1021,18 @@ static void processKeyboard(Map* map)
|
||||||
|
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_z)) undo(map);
|
if(keyWasPressed(tic_key_z)) undo(map);
|
||||||
else if(isKeyBeenPressed(tic_key_y)) redo(map);
|
else if(keyWasPressed(tic_key_y)) redo(map);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_tab)) setStudioMode(TIC_WORLD_MODE);
|
if(keyWasPressed(tic_key_tab)) setStudioMode(TIC_WORLD_MODE);
|
||||||
else if(isKeyBeenPressed(tic_key_1)) map->mode = MAP_DRAW_MODE;
|
else if(keyWasPressed(tic_key_1)) map->mode = MAP_DRAW_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_2)) map->mode = MAP_DRAG_MODE;
|
else if(keyWasPressed(tic_key_2)) map->mode = MAP_DRAG_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_3)) map->mode = MAP_SELECT_MODE;
|
else if(keyWasPressed(tic_key_3)) map->mode = MAP_SELECT_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_4)) map->mode = MAP_FILL_MODE;
|
else if(keyWasPressed(tic_key_4)) map->mode = MAP_FILL_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) deleteSelection(map);
|
else if(keyWasPressed(tic_key_delete)) deleteSelection(map);
|
||||||
else if(isKeyBeenPressed(tic_key_grave)) map->canvas.grid = !map->canvas.grid;
|
else if(keyWasPressed(tic_key_grave)) map->canvas.grid = !map->canvas.grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shift)
|
if(shift)
|
||||||
|
|
|
@ -439,8 +439,8 @@ static void processKeyboard(Menu* menu)
|
||||||
if(menu->gamepad.selected < 0)
|
if(menu->gamepad.selected < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_escape));
|
if(keyWasPressed(tic_key_escape));
|
||||||
else if(isAnyKeyBeenPressed())
|
else if(anyKeyWasPressed())
|
||||||
{
|
{
|
||||||
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
|
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
|
||||||
{
|
{
|
||||||
|
|
86
src/music.c
86
src/music.c
|
@ -754,37 +754,37 @@ static void processTrackerKeyboard(Music* music)
|
||||||
|
|
||||||
if(shift)
|
if(shift)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up)
|
if(keyWasPressed(tic_key_up)
|
||||||
|| isKeyBeenPressed(tic_key_down)
|
|| keyWasPressed(tic_key_down)
|
||||||
|| isKeyBeenPressed(tic_key_left)
|
|| keyWasPressed(tic_key_left)
|
||||||
|| isKeyBeenPressed(tic_key_right)
|
|| keyWasPressed(tic_key_right)
|
||||||
|| isKeyBeenPressed(tic_key_home)
|
|| keyWasPressed(tic_key_home)
|
||||||
|| isKeyBeenPressed(tic_key_end)
|
|| keyWasPressed(tic_key_end)
|
||||||
|| isKeyBeenPressed(tic_key_pageup)
|
|| keyWasPressed(tic_key_pageup)
|
||||||
|| isKeyBeenPressed(tic_key_pagedown)
|
|| keyWasPressed(tic_key_pagedown)
|
||||||
|| isKeyBeenPressed(tic_key_tab))
|
|| keyWasPressed(tic_key_tab))
|
||||||
{
|
{
|
||||||
checkSelection(music);
|
checkSelection(music);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_up)) upRow(music);
|
if(keyWasPressed(tic_key_up)) upRow(music);
|
||||||
else if(isKeyBeenPressed(tic_key_down)) downRow(music);
|
else if(keyWasPressed(tic_key_down)) downRow(music);
|
||||||
else if(isKeyBeenPressed(tic_key_left)) leftCol(music);
|
else if(keyWasPressed(tic_key_left)) leftCol(music);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) rightCol(music);
|
else if(keyWasPressed(tic_key_right)) rightCol(music);
|
||||||
else if(isKeyBeenPressed(tic_key_home)) goHome(music);
|
else if(keyWasPressed(tic_key_home)) goHome(music);
|
||||||
else if(isKeyBeenPressed(tic_key_end)) goEnd(music);
|
else if(keyWasPressed(tic_key_end)) goEnd(music);
|
||||||
else if(isKeyBeenPressed(tic_key_pageup)) pageUp(music);
|
else if(keyWasPressed(tic_key_pageup)) pageUp(music);
|
||||||
else if(isKeyBeenPressed(tic_key_pagedown)) pageDown(music);
|
else if(keyWasPressed(tic_key_pagedown)) pageDown(music);
|
||||||
else if(isKeyBeenPressed(tic_key_tab)) doTab(music);
|
else if(keyWasPressed(tic_key_tab)) doTab(music);
|
||||||
else if(isKeyBeenPressed(tic_key_delete))
|
else if(keyWasPressed(tic_key_delete))
|
||||||
{
|
{
|
||||||
deleteSelection(music);
|
deleteSelection(music);
|
||||||
history_add(music->history);
|
history_add(music->history);
|
||||||
downRow(music);
|
downRow(music);
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressed(tic_key_space)) playNote(music);
|
else if(keyWasPressed(tic_key_space)) playNote(music);
|
||||||
else if(isKeyBeenPressed(tic_key_return))
|
else if(keyWasPressed(tic_key_return))
|
||||||
{
|
{
|
||||||
const tic_music_pos* pos = getMusicPos(music);
|
const tic_music_pos* pos = getMusicPos(music);
|
||||||
pos->track < 0
|
pos->track < 0
|
||||||
|
@ -794,15 +794,15 @@ static void processTrackerKeyboard(Music* music)
|
||||||
|
|
||||||
if(shift)
|
if(shift)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up)
|
if(keyWasPressed(tic_key_up)
|
||||||
|| isKeyBeenPressed(tic_key_down)
|
|| keyWasPressed(tic_key_down)
|
||||||
|| isKeyBeenPressed(tic_key_left)
|
|| keyWasPressed(tic_key_left)
|
||||||
|| isKeyBeenPressed(tic_key_right)
|
|| keyWasPressed(tic_key_right)
|
||||||
|| isKeyBeenPressed(tic_key_home)
|
|| keyWasPressed(tic_key_home)
|
||||||
|| isKeyBeenPressed(tic_key_end)
|
|| keyWasPressed(tic_key_end)
|
||||||
|| isKeyBeenPressed(tic_key_pageup)
|
|| keyWasPressed(tic_key_pageup)
|
||||||
|| isKeyBeenPressed(tic_key_pagedown)
|
|| keyWasPressed(tic_key_pagedown)
|
||||||
|| isKeyBeenPressed(tic_key_tab))
|
|| keyWasPressed(tic_key_tab))
|
||||||
{
|
{
|
||||||
updateSelection(music);
|
updateSelection(music);
|
||||||
}
|
}
|
||||||
|
@ -847,7 +847,7 @@ static void processTrackerKeyboard(Music* music)
|
||||||
{
|
{
|
||||||
case ColumnNote:
|
case ColumnNote:
|
||||||
case ColumnSemitone:
|
case ColumnSemitone:
|
||||||
if (isKeyBeenPressed(tic_key_1) || isKeyBeenPressed(tic_key_a))
|
if (keyWasPressed(tic_key_1) || keyWasPressed(tic_key_a))
|
||||||
{
|
{
|
||||||
setStopNote(music);
|
setStopNote(music);
|
||||||
downRow(music);
|
downRow(music);
|
||||||
|
@ -858,7 +858,7 @@ static void processTrackerKeyboard(Music* music)
|
||||||
|
|
||||||
for (s32 i = 0; i < COUNT_OF(Piano); i++)
|
for (s32 i = 0; i < COUNT_OF(Piano); i++)
|
||||||
{
|
{
|
||||||
if (isKeyBeenPressed(Piano[i]))
|
if (keyWasPressed(Piano[i]))
|
||||||
{
|
{
|
||||||
s32 note = i % NOTES;
|
s32 note = i % NOTES;
|
||||||
|
|
||||||
|
@ -951,12 +951,12 @@ static void processPatternKeyboard(Music* music)
|
||||||
{
|
{
|
||||||
s32 channel = music->tracker.col / CHANNEL_COLS;
|
s32 channel = music->tracker.col / CHANNEL_COLS;
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_delete)) setChannelPatternValue(music, 0, channel);
|
if(keyWasPressed(tic_key_delete)) setChannelPatternValue(music, 0, channel);
|
||||||
else if(isKeyBeenPressed(tic_key_tab)) nextPattern(music);
|
else if(keyWasPressed(tic_key_tab)) nextPattern(music);
|
||||||
else if(isKeyBeenPressed(tic_key_left)) patternColLeft(music);
|
else if(keyWasPressed(tic_key_left)) patternColLeft(music);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) patternColRight(music);
|
else if(keyWasPressed(tic_key_right)) patternColRight(music);
|
||||||
else if(isKeyBeenPressed(tic_key_down)
|
else if(keyWasPressed(tic_key_down)
|
||||||
|| isKeyBeenPressed(tic_key_return))
|
|| keyWasPressed(tic_key_return))
|
||||||
music->tracker.row = music->tracker.scroll;
|
music->tracker.row = music->tracker.scroll;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1015,11 +1015,11 @@ static void processKeyboard(Music* music)
|
||||||
|
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_a)) selectAll(music);
|
if(keyWasPressed(tic_key_a)) selectAll(music);
|
||||||
else if(isKeyBeenPressed(tic_key_z)) undo(music);
|
else if(keyWasPressed(tic_key_z)) undo(music);
|
||||||
else if(isKeyBeenPressed(tic_key_y)) redo(music);
|
else if(keyWasPressed(tic_key_y)) redo(music);
|
||||||
else if(isKeyBeenPressed(tic_key_up)) upFrame(music);
|
else if(keyWasPressed(tic_key_up)) upFrame(music);
|
||||||
else if(isKeyBeenPressed(tic_key_down)) downFrame(music);
|
else if(keyWasPressed(tic_key_down)) downFrame(music);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
24
src/sfx.c
24
src/sfx.c
|
@ -689,14 +689,14 @@ static void processEnvelopesKeyboard(Sfx* sfx)
|
||||||
|
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_z)) undo(sfx);
|
if(keyWasPressed(tic_key_z)) undo(sfx);
|
||||||
else if(isKeyBeenPressed(tic_key_y)) redo(sfx);
|
else if(keyWasPressed(tic_key_y)) redo(sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_tab)) sfx->tab = SFX_WAVEFORM_TAB;
|
if(keyWasPressed(tic_key_tab)) sfx->tab = SFX_WAVEFORM_TAB;
|
||||||
else if(isKeyBeenPressed(tic_key_left)) sfx->index--;
|
else if(keyWasPressed(tic_key_left)) sfx->index--;
|
||||||
else if(isKeyBeenPressed(tic_key_right)) sfx->index++;
|
else if(keyWasPressed(tic_key_right)) sfx->index++;
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) resetSfx(sfx);
|
else if(keyWasPressed(tic_key_delete)) resetSfx(sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void processWaveformKeyboard(Sfx* sfx)
|
static void processWaveformKeyboard(Sfx* sfx)
|
||||||
|
@ -715,14 +715,14 @@ static void processWaveformKeyboard(Sfx* sfx)
|
||||||
|
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_z)) undo(sfx);
|
if(keyWasPressed(tic_key_z)) undo(sfx);
|
||||||
else if(isKeyBeenPressed(tic_key_y)) redo(sfx);
|
else if(keyWasPressed(tic_key_y)) redo(sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_tab)) sfx->tab = SFX_ENVELOPES_TAB;
|
if(keyWasPressed(tic_key_tab)) sfx->tab = SFX_ENVELOPES_TAB;
|
||||||
else if(isKeyBeenPressed(tic_key_left)) sfx->waveform.index--;
|
else if(keyWasPressed(tic_key_left)) sfx->waveform.index--;
|
||||||
else if(isKeyBeenPressed(tic_key_right)) sfx->waveform.index++;
|
else if(keyWasPressed(tic_key_right)) sfx->waveform.index++;
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) resetWave(sfx);
|
else if(keyWasPressed(tic_key_delete)) resetWave(sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawModeTabs(Sfx* sfx)
|
static void drawModeTabs(Sfx* sfx)
|
||||||
|
|
46
src/sprite.c
46
src/sprite.c
|
@ -1443,45 +1443,45 @@ static void processKeyboard(Sprite* sprite)
|
||||||
|
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_z)) undo(sprite);
|
if(keyWasPressed(tic_key_z)) undo(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_y)) redo(sprite);
|
else if(keyWasPressed(tic_key_y)) redo(sprite);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(hasCanvasSelection(sprite))
|
if(hasCanvasSelection(sprite))
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up)) upCanvas(sprite);
|
if(keyWasPressed(tic_key_up)) upCanvas(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_down)) downCanvas(sprite);
|
else if(keyWasPressed(tic_key_down)) downCanvas(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_left)) leftCanvas(sprite);
|
else if(keyWasPressed(tic_key_left)) leftCanvas(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) rightCanvas(sprite);
|
else if(keyWasPressed(tic_key_right)) rightCanvas(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) deleteCanvas(sprite);
|
else if(keyWasPressed(tic_key_delete)) deleteCanvas(sprite);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_up)) upSprite(sprite);
|
if(keyWasPressed(tic_key_up)) upSprite(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_down)) downSprite(sprite);
|
else if(keyWasPressed(tic_key_down)) downSprite(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_left)) leftSprite(sprite);
|
else if(keyWasPressed(tic_key_left)) leftSprite(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_right)) rightSprite(sprite);
|
else if(keyWasPressed(tic_key_right)) rightSprite(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_delete)) deleteSprite(sprite);
|
else if(keyWasPressed(tic_key_delete)) deleteSprite(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_tab)) switchBanks(sprite);
|
else if(keyWasPressed(tic_key_tab)) switchBanks(sprite);
|
||||||
|
|
||||||
if(!sprite->editPalette)
|
if(!sprite->editPalette)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(isKeyBeenPressed(tic_key_1)) sprite->mode = SPRITE_DRAW_MODE;
|
if(keyWasPressed(tic_key_1)) sprite->mode = SPRITE_DRAW_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_2)) sprite->mode = SPRITE_PICK_MODE;
|
else if(keyWasPressed(tic_key_2)) sprite->mode = SPRITE_PICK_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_3)) sprite->mode = SPRITE_SELECT_MODE;
|
else if(keyWasPressed(tic_key_3)) sprite->mode = SPRITE_SELECT_MODE;
|
||||||
else if(isKeyBeenPressed(tic_key_4)) sprite->mode = SPRITE_FILL_MODE;
|
else if(keyWasPressed(tic_key_4)) sprite->mode = SPRITE_FILL_MODE;
|
||||||
|
|
||||||
else if(isKeyBeenPressed(tic_key_5)) flipSpriteHorz(sprite);
|
else if(keyWasPressed(tic_key_5)) flipSpriteHorz(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_6)) flipSpriteVert(sprite);
|
else if(keyWasPressed(tic_key_6)) flipSpriteVert(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_7)) rotateSprite(sprite);
|
else if(keyWasPressed(tic_key_7)) rotateSprite(sprite);
|
||||||
else if(isKeyBeenPressed(tic_key_8)) deleteSprite(sprite);
|
else if(keyWasPressed(tic_key_8)) deleteSprite(sprite);
|
||||||
|
|
||||||
if(sprite->mode == SPRITE_DRAW_MODE)
|
if(sprite->mode == SPRITE_DRAW_MODE)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_leftbracket)) {if(sprite->brushSize > 1) sprite->brushSize--;}
|
if(keyWasPressed(tic_key_leftbracket)) {if(sprite->brushSize > 1) sprite->brushSize--;}
|
||||||
else if(isKeyBeenPressed(tic_key_rightbracket)) {if(sprite->brushSize < 4) sprite->brushSize++;}
|
else if(keyWasPressed(tic_key_rightbracket)) {if(sprite->brushSize < 4) sprite->brushSize++;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
74
src/studio.c
74
src/studio.c
|
@ -273,13 +273,13 @@ char getKeyboardText()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isKeyBeenPressed(tic_key key)
|
bool keyWasPressed(tic_key key)
|
||||||
{
|
{
|
||||||
tic_mem* tic = studioImpl.studio.tic;
|
tic_mem* tic = studioImpl.studio.tic;
|
||||||
return tic->api.keyp(tic, key, KEYBOARD_HOLD, KEYBOARD_PERIOD);
|
return tic->api.keyp(tic, key, KEYBOARD_HOLD, KEYBOARD_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAnyKeyBeenPressed()
|
bool anyKeyWasPressed()
|
||||||
{
|
{
|
||||||
tic_mem* tic = studioImpl.studio.tic;
|
tic_mem* tic = studioImpl.studio.tic;
|
||||||
|
|
||||||
|
@ -833,14 +833,14 @@ ClipboardEvent getClipboardEvent()
|
||||||
|
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_insert) || isKeyBeenPressed(tic_key_c)) return TIC_CLIPBOARD_COPY;
|
if(keyWasPressed(tic_key_insert) || keyWasPressed(tic_key_c)) return TIC_CLIPBOARD_COPY;
|
||||||
else if(isKeyBeenPressed(tic_key_x)) return TIC_CLIPBOARD_CUT;
|
else if(keyWasPressed(tic_key_x)) return TIC_CLIPBOARD_CUT;
|
||||||
else if(isKeyBeenPressed(tic_key_v)) return TIC_CLIPBOARD_PASTE;
|
else if(keyWasPressed(tic_key_v)) return TIC_CLIPBOARD_PASTE;
|
||||||
}
|
}
|
||||||
else if(shift)
|
else if(shift)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_delete)) return TIC_CLIPBOARD_CUT;
|
if(keyWasPressed(tic_key_delete)) return TIC_CLIPBOARD_CUT;
|
||||||
else if(isKeyBeenPressed(tic_key_insert)) return TIC_CLIPBOARD_PASTE;
|
else if(keyWasPressed(tic_key_insert)) return TIC_CLIPBOARD_PASTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TIC_CLIPBOARD_NONE;
|
return TIC_CLIPBOARD_NONE;
|
||||||
|
@ -1699,7 +1699,7 @@ static void takeScreenshot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isKeyBeenPressedOnce(s32 key)
|
static inline bool keyWasPressedOnce(s32 key)
|
||||||
{
|
{
|
||||||
tic_mem* tic = studioImpl.studio.tic;
|
tic_mem* tic = studioImpl.studio.tic;
|
||||||
|
|
||||||
|
@ -1718,58 +1718,58 @@ static void processShortcuts()
|
||||||
|
|
||||||
if(isGameMenu())
|
if(isGameMenu())
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressedOnce(tic_key_escape))
|
if(keyWasPressedOnce(tic_key_escape))
|
||||||
{
|
{
|
||||||
studioImpl.mode == TIC_MENU_MODE ? hideGameMenu() : showGameMenu();
|
studioImpl.mode == TIC_MENU_MODE ? hideGameMenu() : showGameMenu();
|
||||||
// studioImpl.gamepad.backProcessed = true;
|
// studioImpl.gamepad.backProcessed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f11)) goFullscreen();
|
else if(keyWasPressedOnce(tic_key_f11)) goFullscreen();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_return))
|
else if(keyWasPressedOnce(tic_key_return))
|
||||||
{
|
{
|
||||||
if(alt) goFullscreen();
|
if(alt) goFullscreen();
|
||||||
}
|
}
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f7)) setCoverImage();
|
else if(keyWasPressedOnce(tic_key_f7)) setCoverImage();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f8)) takeScreenshot();
|
else if(keyWasPressedOnce(tic_key_f8)) takeScreenshot();
|
||||||
#if !defined(__EMSCRIPTEN__)
|
#if !defined(__EMSCRIPTEN__)
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f9)) startVideoRecord();
|
else if(keyWasPressedOnce(tic_key_f9)) startVideoRecord();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(alt)
|
if(alt)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressedOnce(tic_key_grave)) setStudioMode(TIC_CONSOLE_MODE);
|
if(keyWasPressedOnce(tic_key_grave)) setStudioMode(TIC_CONSOLE_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_1)) setStudioMode(TIC_CODE_MODE);
|
else if(keyWasPressedOnce(tic_key_1)) setStudioMode(TIC_CODE_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_2)) setStudioMode(TIC_SPRITE_MODE);
|
else if(keyWasPressedOnce(tic_key_2)) setStudioMode(TIC_SPRITE_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_3)) setStudioMode(TIC_MAP_MODE);
|
else if(keyWasPressedOnce(tic_key_3)) setStudioMode(TIC_MAP_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_4)) setStudioMode(TIC_SFX_MODE);
|
else if(keyWasPressedOnce(tic_key_4)) setStudioMode(TIC_SFX_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_5)) setStudioMode(TIC_MUSIC_MODE);
|
else if(keyWasPressedOnce(tic_key_5)) setStudioMode(TIC_MUSIC_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_return)) goFullscreen();
|
else if(keyWasPressedOnce(tic_key_return)) goFullscreen();
|
||||||
}
|
}
|
||||||
else if(ctrl)
|
else if(ctrl)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressedOnce(tic_key_pageup)) changeStudioMode(-1);
|
if(keyWasPressedOnce(tic_key_pageup)) changeStudioMode(-1);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_pagedown)) changeStudioMode(1);
|
else if(keyWasPressedOnce(tic_key_pagedown)) changeStudioMode(1);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_q)) exitStudio();
|
else if(keyWasPressedOnce(tic_key_q)) exitStudio();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_r)) runProject();
|
else if(keyWasPressedOnce(tic_key_r)) runProject();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_return)) runProject();
|
else if(keyWasPressedOnce(tic_key_return)) runProject();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_s)) saveProject();
|
else if(keyWasPressedOnce(tic_key_s)) saveProject();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressedOnce(tic_key_f1)) setStudioMode(TIC_CODE_MODE);
|
if(keyWasPressedOnce(tic_key_f1)) setStudioMode(TIC_CODE_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f2)) setStudioMode(TIC_SPRITE_MODE);
|
else if(keyWasPressedOnce(tic_key_f2)) setStudioMode(TIC_SPRITE_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f3)) setStudioMode(TIC_MAP_MODE);
|
else if(keyWasPressedOnce(tic_key_f3)) setStudioMode(TIC_MAP_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f4)) setStudioMode(TIC_SFX_MODE);
|
else if(keyWasPressedOnce(tic_key_f4)) setStudioMode(TIC_SFX_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f5)) setStudioMode(TIC_MUSIC_MODE);
|
else if(keyWasPressedOnce(tic_key_f5)) setStudioMode(TIC_MUSIC_MODE);
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f7)) setCoverImage();
|
else if(keyWasPressedOnce(tic_key_f7)) setCoverImage();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f8)) takeScreenshot();
|
else if(keyWasPressedOnce(tic_key_f8)) takeScreenshot();
|
||||||
#if !defined(__EMSCRIPTEN__)
|
#if !defined(__EMSCRIPTEN__)
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f9)) startVideoRecord();
|
else if(keyWasPressedOnce(tic_key_f9)) startVideoRecord();
|
||||||
#endif
|
#endif
|
||||||
else if(isKeyBeenPressedOnce(tic_key_f11)) goFullscreen();
|
else if(keyWasPressedOnce(tic_key_f11)) goFullscreen();
|
||||||
else if(isKeyBeenPressedOnce(tic_key_escape))
|
else if(keyWasPressedOnce(tic_key_escape))
|
||||||
{
|
{
|
||||||
Code* code = studioImpl.editor[studioImpl.bank.index.code].code;
|
Code* code = studioImpl.editor[studioImpl.bank.index.code].code;
|
||||||
|
|
||||||
|
|
|
@ -240,8 +240,8 @@ TIC80_API void studioTick(void* pixels);
|
||||||
TIC80_API void studioClose();
|
TIC80_API void studioClose();
|
||||||
|
|
||||||
char getKeyboardText();
|
char getKeyboardText();
|
||||||
bool isKeyBeenPressed(tic_key key);
|
bool keyWasPressed(tic_key key);
|
||||||
bool isAnyKeyBeenPressed();
|
bool anyKeyWasPressed();
|
||||||
|
|
||||||
void setClipboardText(const char* text);
|
void setClipboardText(const char* text);
|
||||||
bool hasClipboardText();
|
bool hasClipboardText();
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void drawGrid(World* world)
|
||||||
|
|
||||||
static void tick(World* world)
|
static void tick(World* world)
|
||||||
{
|
{
|
||||||
if(isKeyBeenPressed(tic_key_tab)) setStudioMode(TIC_MAP_MODE);
|
if(keyWasPressed(tic_key_tab)) setStudioMode(TIC_MAP_MODE);
|
||||||
|
|
||||||
memcpy(&world->tic->ram.vram, world->preview, PREVIEW_SIZE);
|
memcpy(&world->tic->ram.vram, world->preview, PREVIEW_SIZE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue