no message

This commit is contained in:
BADIM-PC\Vadim 2018-02-13 13:29:33 +03:00
parent 96f956790a
commit e4eac02295
11 changed files with 190 additions and 190 deletions

View File

@ -884,14 +884,14 @@ static void processKeyboard(Code* code)
bool ctrl = tic->api.key(tic, tic_key_ctrl);
bool alt = tic->api.key(tic, tic_key_alt);
if(isKeyBeenPressed(tic_key_up)
|| isKeyBeenPressed(tic_key_down)
|| isKeyBeenPressed(tic_key_left)
|| isKeyBeenPressed(tic_key_right)
|| isKeyBeenPressed(tic_key_home)
|| isKeyBeenPressed(tic_key_end)
|| isKeyBeenPressed(tic_key_pageup)
|| isKeyBeenPressed(tic_key_pagedown))
if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right)
|| keyWasPressed(tic_key_home)
|| keyWasPressed(tic_key_end)
|| keyWasPressed(tic_key_pageup)
|| keyWasPressed(tic_key_pagedown))
{
if(!shift) code->cursor.selection = NULL;
else if(code->cursor.selection == NULL) code->cursor.selection = code->cursor.position;
@ -901,9 +901,9 @@ static void processKeyboard(Code* code)
{
if(ctrl)
{
if(isKeyBeenPressed(tic_key_left)) leftWord(code);
else if(isKeyBeenPressed(tic_key_right)) rightWord(code);
else if(isKeyBeenPressed(tic_key_tab)) doTab(code, shift, ctrl);
if(keyWasPressed(tic_key_left)) leftWord(code);
else if(keyWasPressed(tic_key_right)) rightWord(code);
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
}
// else if(keymod & KMOD_GUI)
// {
@ -914,35 +914,35 @@ static void processKeyboard(Code* code)
// }
// }
if(isKeyBeenPressed(tic_key_a)) selectAll(code);
else if(isKeyBeenPressed(tic_key_z)) undo(code);
else if(isKeyBeenPressed(tic_key_y)) redo(code);
else if(isKeyBeenPressed(tic_key_f)) setCodeMode(code, TEXT_FIND_MODE);
else if(isKeyBeenPressed(tic_key_g)) setCodeMode(code, TEXT_GOTO_MODE);
else if(isKeyBeenPressed(tic_key_o)) setCodeMode(code, TEXT_OUTLINE_MODE);
else if(isKeyBeenPressed(tic_key_slash)) commentLine(code);
else if(isKeyBeenPressed(tic_key_home)) goCodeHome(code);
else if(isKeyBeenPressed(tic_key_end)) goCodeEnd(code);
if(keyWasPressed(tic_key_a)) selectAll(code);
else if(keyWasPressed(tic_key_z)) undo(code);
else if(keyWasPressed(tic_key_y)) redo(code);
else if(keyWasPressed(tic_key_f)) setCodeMode(code, TEXT_FIND_MODE);
else if(keyWasPressed(tic_key_g)) setCodeMode(code, TEXT_GOTO_MODE);
else if(keyWasPressed(tic_key_o)) setCodeMode(code, TEXT_OUTLINE_MODE);
else if(keyWasPressed(tic_key_slash)) commentLine(code);
else if(keyWasPressed(tic_key_home)) goCodeHome(code);
else if(keyWasPressed(tic_key_end)) goCodeEnd(code);
}
else if(alt)
{
if(isKeyBeenPressed(tic_key_left)) leftWord(code);
else if(isKeyBeenPressed(tic_key_right)) rightWord(code);
if(keyWasPressed(tic_key_left)) leftWord(code);
else if(keyWasPressed(tic_key_right)) rightWord(code);
}
else
{
if(isKeyBeenPressed(tic_key_up)) upLine(code);
else if(isKeyBeenPressed(tic_key_down)) downLine(code);
else if(isKeyBeenPressed(tic_key_left)) leftColumn(code);
else if(isKeyBeenPressed(tic_key_right)) rightColumn(code);
else if(isKeyBeenPressed(tic_key_home)) goHome(code);
else if(isKeyBeenPressed(tic_key_end)) goEnd(code);
else if(isKeyBeenPressed(tic_key_pageup)) pageUp(code);
else if(isKeyBeenPressed(tic_key_pagedown)) pageDown(code);
else if(isKeyBeenPressed(tic_key_delete)) deleteChar(code);
else if(isKeyBeenPressed(tic_key_backspace)) backspaceChar(code);
else if(isKeyBeenPressed(tic_key_return)) newLine(code);
else if(isKeyBeenPressed(tic_key_tab)) doTab(code, shift, ctrl);
if(keyWasPressed(tic_key_up)) upLine(code);
else if(keyWasPressed(tic_key_down)) downLine(code);
else if(keyWasPressed(tic_key_left)) leftColumn(code);
else if(keyWasPressed(tic_key_right)) rightColumn(code);
else if(keyWasPressed(tic_key_home)) goHome(code);
else if(keyWasPressed(tic_key_end)) goEnd(code);
else if(keyWasPressed(tic_key_pageup)) pageUp(code);
else if(keyWasPressed(tic_key_pagedown)) pageDown(code);
else if(keyWasPressed(tic_key_delete)) deleteChar(code);
else if(keyWasPressed(tic_key_backspace)) backspaceChar(code);
else if(keyWasPressed(tic_key_return)) newLine(code);
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
}
updateEditor(code);
@ -1124,22 +1124,22 @@ static char* downStrStr(const char* start, const char* from, const char* substr)
static void textFindTick(Code* code)
{
if(isKeyBeenPressed(tic_key_return)) setCodeMode(code, TEXT_EDIT_MODE);
else if(isKeyBeenPressed(tic_key_up)
|| isKeyBeenPressed(tic_key_down)
|| isKeyBeenPressed(tic_key_left)
|| isKeyBeenPressed(tic_key_right))
if(keyWasPressed(tic_key_return)) setCodeMode(code, TEXT_EDIT_MODE);
else if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right))
{
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* 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);
updateFindCode(code, pos);
}
}
else if(isKeyBeenPressed(tic_key_backspace))
else if(keyWasPressed(tic_key_backspace))
{
if(*code->popup.text)
{
@ -1190,14 +1190,14 @@ static void textGoToTick(Code* code)
{
tic_mem* tic = code->tic;
if(isKeyBeenPressed(tic_key_return))
if(keyWasPressed(tic_key_return))
{
if(*code->popup.text)
updateGotoCode(code);
setCodeMode(code, TEXT_EDIT_MODE);
}
else if(isKeyBeenPressed(tic_key_backspace))
else if(keyWasPressed(tic_key_backspace))
{
if(*code->popup.text)
{
@ -1276,7 +1276,7 @@ static void drawOutlineBar(Code* code, s32 x, s32 y)
static void textOutlineTick(Code* code)
{
if(isKeyBeenPressed(tic_key_up))
if(keyWasPressed(tic_key_up))
{
if(code->outline.index > 0)
{
@ -1284,7 +1284,7 @@ static void textOutlineTick(Code* 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)
{
@ -1292,12 +1292,12 @@ static void textOutlineTick(Code* code)
updateOutlineCode(code);
}
}
else if(isKeyBeenPressed(tic_key_return))
else if(keyWasPressed(tic_key_return))
{
updateOutlineCode(code);
setCodeMode(code, TEXT_EDIT_MODE);
}
else if(isKeyBeenPressed(tic_key_backspace))
else if(keyWasPressed(tic_key_backspace))
{
if(*code->popup.text)
{

View File

@ -2571,28 +2571,28 @@ static void tick(Console* console)
}
{
if(isKeyBeenPressed(tic_key_up)) onHistoryUp(console);
else if(isKeyBeenPressed(tic_key_down)) onHistoryDown(console);
else if(isKeyBeenPressed(tic_key_left))
if(keyWasPressed(tic_key_up)) onHistoryUp(console);
else if(keyWasPressed(tic_key_down)) onHistoryDown(console);
else if(keyWasPressed(tic_key_left))
{
if(console->inputPosition > 0)
console->inputPosition--;
}
else if(isKeyBeenPressed(tic_key_right))
else if(keyWasPressed(tic_key_right))
{
console->inputPosition++;
size_t len = strlen(console->inputBuffer);
if(console->inputPosition > len)
console->inputPosition = len;
}
else if(isKeyBeenPressed(tic_key_return)) processConsoleCommand(console);
else if(isKeyBeenPressed(tic_key_backspace)) processConsoleBackspace(console);
else if(isKeyBeenPressed(tic_key_delete)) processConsoleDel(console);
else if(isKeyBeenPressed(tic_key_home)) processConsoleHome(console);
else if(isKeyBeenPressed(tic_key_end)) processConsoleEnd(console);
else if(isKeyBeenPressed(tic_key_tab)) processConsoleTab(console);
else if(keyWasPressed(tic_key_return)) processConsoleCommand(console);
else if(keyWasPressed(tic_key_backspace)) processConsoleBackspace(console);
else if(keyWasPressed(tic_key_delete)) processConsoleDel(console);
else if(keyWasPressed(tic_key_home)) processConsoleHome(console);
else if(keyWasPressed(tic_key_end)) processConsoleEnd(console);
else if(keyWasPressed(tic_key_tab)) processConsoleTab(console);
if(isAnyKeyBeenPressed())
if(anyKeyWasPressed())
{
scrollConsole(console);
console->cursor.delay = CONSOLE_CURSOR_DELAY;

View File

@ -93,17 +93,17 @@ static void onNo(Dialog* dlg)
static void processKeyboard(Dialog* dlg)
{
if(isKeyBeenPressed(tic_key_left))
if(keyWasPressed(tic_key_left))
{
dlg->focus = (dlg->focus-1) % 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;
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);
}

View File

@ -1021,18 +1021,18 @@ static void processKeyboard(Map* map)
if(ctrl)
{
if(isKeyBeenPressed(tic_key_z)) undo(map);
else if(isKeyBeenPressed(tic_key_y)) redo(map);
if(keyWasPressed(tic_key_z)) undo(map);
else if(keyWasPressed(tic_key_y)) redo(map);
}
else
{
if(isKeyBeenPressed(tic_key_tab)) setStudioMode(TIC_WORLD_MODE);
else if(isKeyBeenPressed(tic_key_1)) map->mode = MAP_DRAW_MODE;
else if(isKeyBeenPressed(tic_key_2)) map->mode = MAP_DRAG_MODE;
else if(isKeyBeenPressed(tic_key_3)) map->mode = MAP_SELECT_MODE;
else if(isKeyBeenPressed(tic_key_4)) map->mode = MAP_FILL_MODE;
else if(isKeyBeenPressed(tic_key_delete)) deleteSelection(map);
else if(isKeyBeenPressed(tic_key_grave)) map->canvas.grid = !map->canvas.grid;
if(keyWasPressed(tic_key_tab)) setStudioMode(TIC_WORLD_MODE);
else if(keyWasPressed(tic_key_1)) map->mode = MAP_DRAW_MODE;
else if(keyWasPressed(tic_key_2)) map->mode = MAP_DRAG_MODE;
else if(keyWasPressed(tic_key_3)) map->mode = MAP_SELECT_MODE;
else if(keyWasPressed(tic_key_4)) map->mode = MAP_FILL_MODE;
else if(keyWasPressed(tic_key_delete)) deleteSelection(map);
else if(keyWasPressed(tic_key_grave)) map->canvas.grid = !map->canvas.grid;
}
if(shift)

View File

@ -439,8 +439,8 @@ static void processKeyboard(Menu* menu)
if(menu->gamepad.selected < 0)
return;
if(isKeyBeenPressed(tic_key_escape));
else if(isAnyKeyBeenPressed())
if(keyWasPressed(tic_key_escape));
else if(anyKeyWasPressed())
{
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
{

View File

@ -754,37 +754,37 @@ static void processTrackerKeyboard(Music* music)
if(shift)
{
if(isKeyBeenPressed(tic_key_up)
|| isKeyBeenPressed(tic_key_down)
|| isKeyBeenPressed(tic_key_left)
|| isKeyBeenPressed(tic_key_right)
|| isKeyBeenPressed(tic_key_home)
|| isKeyBeenPressed(tic_key_end)
|| isKeyBeenPressed(tic_key_pageup)
|| isKeyBeenPressed(tic_key_pagedown)
|| isKeyBeenPressed(tic_key_tab))
if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right)
|| keyWasPressed(tic_key_home)
|| keyWasPressed(tic_key_end)
|| keyWasPressed(tic_key_pageup)
|| keyWasPressed(tic_key_pagedown)
|| keyWasPressed(tic_key_tab))
{
checkSelection(music);
}
}
if(isKeyBeenPressed(tic_key_up)) upRow(music);
else if(isKeyBeenPressed(tic_key_down)) downRow(music);
else if(isKeyBeenPressed(tic_key_left)) leftCol(music);
else if(isKeyBeenPressed(tic_key_right)) rightCol(music);
else if(isKeyBeenPressed(tic_key_home)) goHome(music);
else if(isKeyBeenPressed(tic_key_end)) goEnd(music);
else if(isKeyBeenPressed(tic_key_pageup)) pageUp(music);
else if(isKeyBeenPressed(tic_key_pagedown)) pageDown(music);
else if(isKeyBeenPressed(tic_key_tab)) doTab(music);
else if(isKeyBeenPressed(tic_key_delete))
if(keyWasPressed(tic_key_up)) upRow(music);
else if(keyWasPressed(tic_key_down)) downRow(music);
else if(keyWasPressed(tic_key_left)) leftCol(music);
else if(keyWasPressed(tic_key_right)) rightCol(music);
else if(keyWasPressed(tic_key_home)) goHome(music);
else if(keyWasPressed(tic_key_end)) goEnd(music);
else if(keyWasPressed(tic_key_pageup)) pageUp(music);
else if(keyWasPressed(tic_key_pagedown)) pageDown(music);
else if(keyWasPressed(tic_key_tab)) doTab(music);
else if(keyWasPressed(tic_key_delete))
{
deleteSelection(music);
history_add(music->history);
downRow(music);
}
else if(isKeyBeenPressed(tic_key_space)) playNote(music);
else if(isKeyBeenPressed(tic_key_return))
else if(keyWasPressed(tic_key_space)) playNote(music);
else if(keyWasPressed(tic_key_return))
{
const tic_music_pos* pos = getMusicPos(music);
pos->track < 0
@ -794,15 +794,15 @@ static void processTrackerKeyboard(Music* music)
if(shift)
{
if(isKeyBeenPressed(tic_key_up)
|| isKeyBeenPressed(tic_key_down)
|| isKeyBeenPressed(tic_key_left)
|| isKeyBeenPressed(tic_key_right)
|| isKeyBeenPressed(tic_key_home)
|| isKeyBeenPressed(tic_key_end)
|| isKeyBeenPressed(tic_key_pageup)
|| isKeyBeenPressed(tic_key_pagedown)
|| isKeyBeenPressed(tic_key_tab))
if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right)
|| keyWasPressed(tic_key_home)
|| keyWasPressed(tic_key_end)
|| keyWasPressed(tic_key_pageup)
|| keyWasPressed(tic_key_pagedown)
|| keyWasPressed(tic_key_tab))
{
updateSelection(music);
}
@ -847,7 +847,7 @@ static void processTrackerKeyboard(Music* music)
{
case ColumnNote:
case ColumnSemitone:
if (isKeyBeenPressed(tic_key_1) || isKeyBeenPressed(tic_key_a))
if (keyWasPressed(tic_key_1) || keyWasPressed(tic_key_a))
{
setStopNote(music);
downRow(music);
@ -858,7 +858,7 @@ static void processTrackerKeyboard(Music* music)
for (s32 i = 0; i < COUNT_OF(Piano); i++)
{
if (isKeyBeenPressed(Piano[i]))
if (keyWasPressed(Piano[i]))
{
s32 note = i % NOTES;
@ -951,12 +951,12 @@ static void processPatternKeyboard(Music* music)
{
s32 channel = music->tracker.col / CHANNEL_COLS;
if(isKeyBeenPressed(tic_key_delete)) setChannelPatternValue(music, 0, channel);
else if(isKeyBeenPressed(tic_key_tab)) nextPattern(music);
else if(isKeyBeenPressed(tic_key_left)) patternColLeft(music);
else if(isKeyBeenPressed(tic_key_right)) patternColRight(music);
else if(isKeyBeenPressed(tic_key_down)
|| isKeyBeenPressed(tic_key_return))
if(keyWasPressed(tic_key_delete)) setChannelPatternValue(music, 0, channel);
else if(keyWasPressed(tic_key_tab)) nextPattern(music);
else if(keyWasPressed(tic_key_left)) patternColLeft(music);
else if(keyWasPressed(tic_key_right)) patternColRight(music);
else if(keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_return))
music->tracker.row = music->tracker.scroll;
else
{
@ -1015,11 +1015,11 @@ static void processKeyboard(Music* music)
if (ctrl)
{
if(isKeyBeenPressed(tic_key_a)) selectAll(music);
else if(isKeyBeenPressed(tic_key_z)) undo(music);
else if(isKeyBeenPressed(tic_key_y)) redo(music);
else if(isKeyBeenPressed(tic_key_up)) upFrame(music);
else if(isKeyBeenPressed(tic_key_down)) downFrame(music);
if(keyWasPressed(tic_key_a)) selectAll(music);
else if(keyWasPressed(tic_key_z)) undo(music);
else if(keyWasPressed(tic_key_y)) redo(music);
else if(keyWasPressed(tic_key_up)) upFrame(music);
else if(keyWasPressed(tic_key_down)) downFrame(music);
}
else
{

View File

@ -689,14 +689,14 @@ static void processEnvelopesKeyboard(Sfx* sfx)
if(ctrl)
{
if(isKeyBeenPressed(tic_key_z)) undo(sfx);
else if(isKeyBeenPressed(tic_key_y)) redo(sfx);
if(keyWasPressed(tic_key_z)) undo(sfx);
else if(keyWasPressed(tic_key_y)) redo(sfx);
}
if(isKeyBeenPressed(tic_key_tab)) sfx->tab = SFX_WAVEFORM_TAB;
else if(isKeyBeenPressed(tic_key_left)) sfx->index--;
else if(isKeyBeenPressed(tic_key_right)) sfx->index++;
else if(isKeyBeenPressed(tic_key_delete)) resetSfx(sfx);
if(keyWasPressed(tic_key_tab)) sfx->tab = SFX_WAVEFORM_TAB;
else if(keyWasPressed(tic_key_left)) sfx->index--;
else if(keyWasPressed(tic_key_right)) sfx->index++;
else if(keyWasPressed(tic_key_delete)) resetSfx(sfx);
}
static void processWaveformKeyboard(Sfx* sfx)
@ -715,14 +715,14 @@ static void processWaveformKeyboard(Sfx* sfx)
if(ctrl)
{
if(isKeyBeenPressed(tic_key_z)) undo(sfx);
else if(isKeyBeenPressed(tic_key_y)) redo(sfx);
if(keyWasPressed(tic_key_z)) undo(sfx);
else if(keyWasPressed(tic_key_y)) redo(sfx);
}
if(isKeyBeenPressed(tic_key_tab)) sfx->tab = SFX_ENVELOPES_TAB;
else if(isKeyBeenPressed(tic_key_left)) sfx->waveform.index--;
else if(isKeyBeenPressed(tic_key_right)) sfx->waveform.index++;
else if(isKeyBeenPressed(tic_key_delete)) resetWave(sfx);
if(keyWasPressed(tic_key_tab)) sfx->tab = SFX_ENVELOPES_TAB;
else if(keyWasPressed(tic_key_left)) sfx->waveform.index--;
else if(keyWasPressed(tic_key_right)) sfx->waveform.index++;
else if(keyWasPressed(tic_key_delete)) resetWave(sfx);
}
static void drawModeTabs(Sfx* sfx)

View File

@ -1443,45 +1443,45 @@ static void processKeyboard(Sprite* sprite)
if(ctrl)
{
if(isKeyBeenPressed(tic_key_z)) undo(sprite);
else if(isKeyBeenPressed(tic_key_y)) redo(sprite);
if(keyWasPressed(tic_key_z)) undo(sprite);
else if(keyWasPressed(tic_key_y)) redo(sprite);
}
else
{
if(hasCanvasSelection(sprite))
{
if(isKeyBeenPressed(tic_key_up)) upCanvas(sprite);
else if(isKeyBeenPressed(tic_key_down)) downCanvas(sprite);
else if(isKeyBeenPressed(tic_key_left)) leftCanvas(sprite);
else if(isKeyBeenPressed(tic_key_right)) rightCanvas(sprite);
else if(isKeyBeenPressed(tic_key_delete)) deleteCanvas(sprite);
if(keyWasPressed(tic_key_up)) upCanvas(sprite);
else if(keyWasPressed(tic_key_down)) downCanvas(sprite);
else if(keyWasPressed(tic_key_left)) leftCanvas(sprite);
else if(keyWasPressed(tic_key_right)) rightCanvas(sprite);
else if(keyWasPressed(tic_key_delete)) deleteCanvas(sprite);
}
else
{
if(isKeyBeenPressed(tic_key_up)) upSprite(sprite);
else if(isKeyBeenPressed(tic_key_down)) downSprite(sprite);
else if(isKeyBeenPressed(tic_key_left)) leftSprite(sprite);
else if(isKeyBeenPressed(tic_key_right)) rightSprite(sprite);
else if(isKeyBeenPressed(tic_key_delete)) deleteSprite(sprite);
else if(isKeyBeenPressed(tic_key_tab)) switchBanks(sprite);
if(keyWasPressed(tic_key_up)) upSprite(sprite);
else if(keyWasPressed(tic_key_down)) downSprite(sprite);
else if(keyWasPressed(tic_key_left)) leftSprite(sprite);
else if(keyWasPressed(tic_key_right)) rightSprite(sprite);
else if(keyWasPressed(tic_key_delete)) deleteSprite(sprite);
else if(keyWasPressed(tic_key_tab)) switchBanks(sprite);
if(!sprite->editPalette)
{
if(isKeyBeenPressed(tic_key_1)) sprite->mode = SPRITE_DRAW_MODE;
else if(isKeyBeenPressed(tic_key_2)) sprite->mode = SPRITE_PICK_MODE;
else if(isKeyBeenPressed(tic_key_3)) sprite->mode = SPRITE_SELECT_MODE;
else if(isKeyBeenPressed(tic_key_4)) sprite->mode = SPRITE_FILL_MODE;
if(keyWasPressed(tic_key_1)) sprite->mode = SPRITE_DRAW_MODE;
else if(keyWasPressed(tic_key_2)) sprite->mode = SPRITE_PICK_MODE;
else if(keyWasPressed(tic_key_3)) sprite->mode = SPRITE_SELECT_MODE;
else if(keyWasPressed(tic_key_4)) sprite->mode = SPRITE_FILL_MODE;
else if(isKeyBeenPressed(tic_key_5)) flipSpriteHorz(sprite);
else if(isKeyBeenPressed(tic_key_6)) flipSpriteVert(sprite);
else if(isKeyBeenPressed(tic_key_7)) rotateSprite(sprite);
else if(isKeyBeenPressed(tic_key_8)) deleteSprite(sprite);
else if(keyWasPressed(tic_key_5)) flipSpriteHorz(sprite);
else if(keyWasPressed(tic_key_6)) flipSpriteVert(sprite);
else if(keyWasPressed(tic_key_7)) rotateSprite(sprite);
else if(keyWasPressed(tic_key_8)) deleteSprite(sprite);
if(sprite->mode == SPRITE_DRAW_MODE)
{
if(isKeyBeenPressed(tic_key_leftbracket)) {if(sprite->brushSize > 1) sprite->brushSize--;}
else if(isKeyBeenPressed(tic_key_rightbracket)) {if(sprite->brushSize < 4) sprite->brushSize++;}
if(keyWasPressed(tic_key_leftbracket)) {if(sprite->brushSize > 1) sprite->brushSize--;}
else if(keyWasPressed(tic_key_rightbracket)) {if(sprite->brushSize < 4) sprite->brushSize++;}
}
}
}

View File

@ -273,13 +273,13 @@ char getKeyboardText()
return 0;
}
bool isKeyBeenPressed(tic_key key)
bool keyWasPressed(tic_key key)
{
tic_mem* tic = studioImpl.studio.tic;
return tic->api.keyp(tic, key, KEYBOARD_HOLD, KEYBOARD_PERIOD);
}
bool isAnyKeyBeenPressed()
bool anyKeyWasPressed()
{
tic_mem* tic = studioImpl.studio.tic;
@ -833,14 +833,14 @@ ClipboardEvent getClipboardEvent()
if(ctrl)
{
if(isKeyBeenPressed(tic_key_insert) || isKeyBeenPressed(tic_key_c)) return TIC_CLIPBOARD_COPY;
else if(isKeyBeenPressed(tic_key_x)) return TIC_CLIPBOARD_CUT;
else if(isKeyBeenPressed(tic_key_v)) return TIC_CLIPBOARD_PASTE;
if(keyWasPressed(tic_key_insert) || keyWasPressed(tic_key_c)) return TIC_CLIPBOARD_COPY;
else if(keyWasPressed(tic_key_x)) return TIC_CLIPBOARD_CUT;
else if(keyWasPressed(tic_key_v)) return TIC_CLIPBOARD_PASTE;
}
else if(shift)
{
if(isKeyBeenPressed(tic_key_delete)) return TIC_CLIPBOARD_CUT;
else if(isKeyBeenPressed(tic_key_insert)) return TIC_CLIPBOARD_PASTE;
if(keyWasPressed(tic_key_delete)) return TIC_CLIPBOARD_CUT;
else if(keyWasPressed(tic_key_insert)) return TIC_CLIPBOARD_PASTE;
}
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;
@ -1718,58 +1718,58 @@ static void processShortcuts()
if(isGameMenu())
{
if(isKeyBeenPressedOnce(tic_key_escape))
if(keyWasPressedOnce(tic_key_escape))
{
studioImpl.mode == TIC_MENU_MODE ? hideGameMenu() : showGameMenu();
// studioImpl.gamepad.backProcessed = true;
return;
}
else if(isKeyBeenPressedOnce(tic_key_f11)) goFullscreen();
else if(isKeyBeenPressedOnce(tic_key_return))
else if(keyWasPressedOnce(tic_key_f11)) goFullscreen();
else if(keyWasPressedOnce(tic_key_return))
{
if(alt) goFullscreen();
}
else if(isKeyBeenPressedOnce(tic_key_f7)) setCoverImage();
else if(isKeyBeenPressedOnce(tic_key_f8)) takeScreenshot();
else if(keyWasPressedOnce(tic_key_f7)) setCoverImage();
else if(keyWasPressedOnce(tic_key_f8)) takeScreenshot();
#if !defined(__EMSCRIPTEN__)
else if(isKeyBeenPressedOnce(tic_key_f9)) startVideoRecord();
else if(keyWasPressedOnce(tic_key_f9)) startVideoRecord();
#endif
}
if(alt)
{
if(isKeyBeenPressedOnce(tic_key_grave)) setStudioMode(TIC_CONSOLE_MODE);
else if(isKeyBeenPressedOnce(tic_key_1)) setStudioMode(TIC_CODE_MODE);
else if(isKeyBeenPressedOnce(tic_key_2)) setStudioMode(TIC_SPRITE_MODE);
else if(isKeyBeenPressedOnce(tic_key_3)) setStudioMode(TIC_MAP_MODE);
else if(isKeyBeenPressedOnce(tic_key_4)) setStudioMode(TIC_SFX_MODE);
else if(isKeyBeenPressedOnce(tic_key_5)) setStudioMode(TIC_MUSIC_MODE);
else if(isKeyBeenPressedOnce(tic_key_return)) goFullscreen();
if(keyWasPressedOnce(tic_key_grave)) setStudioMode(TIC_CONSOLE_MODE);
else if(keyWasPressedOnce(tic_key_1)) setStudioMode(TIC_CODE_MODE);
else if(keyWasPressedOnce(tic_key_2)) setStudioMode(TIC_SPRITE_MODE);
else if(keyWasPressedOnce(tic_key_3)) setStudioMode(TIC_MAP_MODE);
else if(keyWasPressedOnce(tic_key_4)) setStudioMode(TIC_SFX_MODE);
else if(keyWasPressedOnce(tic_key_5)) setStudioMode(TIC_MUSIC_MODE);
else if(keyWasPressedOnce(tic_key_return)) goFullscreen();
}
else if(ctrl)
{
if(isKeyBeenPressedOnce(tic_key_pageup)) changeStudioMode(-1);
else if(isKeyBeenPressedOnce(tic_key_pagedown)) changeStudioMode(1);
else if(isKeyBeenPressedOnce(tic_key_q)) exitStudio();
else if(isKeyBeenPressedOnce(tic_key_r)) runProject();
else if(isKeyBeenPressedOnce(tic_key_return)) runProject();
else if(isKeyBeenPressedOnce(tic_key_s)) saveProject();
if(keyWasPressedOnce(tic_key_pageup)) changeStudioMode(-1);
else if(keyWasPressedOnce(tic_key_pagedown)) changeStudioMode(1);
else if(keyWasPressedOnce(tic_key_q)) exitStudio();
else if(keyWasPressedOnce(tic_key_r)) runProject();
else if(keyWasPressedOnce(tic_key_return)) runProject();
else if(keyWasPressedOnce(tic_key_s)) saveProject();
}
else
{
if(isKeyBeenPressedOnce(tic_key_f1)) setStudioMode(TIC_CODE_MODE);
else if(isKeyBeenPressedOnce(tic_key_f2)) setStudioMode(TIC_SPRITE_MODE);
else if(isKeyBeenPressedOnce(tic_key_f3)) setStudioMode(TIC_MAP_MODE);
else if(isKeyBeenPressedOnce(tic_key_f4)) setStudioMode(TIC_SFX_MODE);
else if(isKeyBeenPressedOnce(tic_key_f5)) setStudioMode(TIC_MUSIC_MODE);
else if(isKeyBeenPressedOnce(tic_key_f7)) setCoverImage();
else if(isKeyBeenPressedOnce(tic_key_f8)) takeScreenshot();
if(keyWasPressedOnce(tic_key_f1)) setStudioMode(TIC_CODE_MODE);
else if(keyWasPressedOnce(tic_key_f2)) setStudioMode(TIC_SPRITE_MODE);
else if(keyWasPressedOnce(tic_key_f3)) setStudioMode(TIC_MAP_MODE);
else if(keyWasPressedOnce(tic_key_f4)) setStudioMode(TIC_SFX_MODE);
else if(keyWasPressedOnce(tic_key_f5)) setStudioMode(TIC_MUSIC_MODE);
else if(keyWasPressedOnce(tic_key_f7)) setCoverImage();
else if(keyWasPressedOnce(tic_key_f8)) takeScreenshot();
#if !defined(__EMSCRIPTEN__)
else if(isKeyBeenPressedOnce(tic_key_f9)) startVideoRecord();
else if(keyWasPressedOnce(tic_key_f9)) startVideoRecord();
#endif
else if(isKeyBeenPressedOnce(tic_key_f11)) goFullscreen();
else if(isKeyBeenPressedOnce(tic_key_escape))
else if(keyWasPressedOnce(tic_key_f11)) goFullscreen();
else if(keyWasPressedOnce(tic_key_escape))
{
Code* code = studioImpl.editor[studioImpl.bank.index.code].code;

View File

@ -240,8 +240,8 @@ TIC80_API void studioTick(void* pixels);
TIC80_API void studioClose();
char getKeyboardText();
bool isKeyBeenPressed(tic_key key);
bool isAnyKeyBeenPressed();
bool keyWasPressed(tic_key key);
bool anyKeyWasPressed();
void setClipboardText(const char* text);
bool hasClipboardText();

View File

@ -63,7 +63,7 @@ static void drawGrid(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);