no message
This commit is contained in:
parent
b98a93c07b
commit
08f29fde5d
29
src/code.c
29
src/code.c
|
@ -884,6 +884,8 @@ static void processKeyboard(Code* code)
|
|||
{
|
||||
tic_mem* tic = code->tic;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
switch(getClipboardEvent(0))
|
||||
{
|
||||
case TIC_CLIPBOARD_CUT: cutToClipboard(code); break;
|
||||
|
@ -949,31 +951,7 @@ static void processKeyboard(Code* code)
|
|||
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
|
||||
}
|
||||
|
||||
if(tic->ram.input.keyboard.data)
|
||||
updateEditor(code);
|
||||
}
|
||||
|
||||
static void processGestures(Code* code)
|
||||
{
|
||||
tic_point point = {0, 0};
|
||||
|
||||
if(getGesturePos(&point))
|
||||
{
|
||||
if(code->scroll.gesture)
|
||||
{
|
||||
code->scroll.x = (code->scroll.start.x - point.x) / STUDIO_TEXT_WIDTH;
|
||||
code->scroll.y = (code->scroll.start.y - point.y) / STUDIO_TEXT_HEIGHT;
|
||||
|
||||
normalizeScroll(code);
|
||||
}
|
||||
else
|
||||
{
|
||||
code->scroll.start.x = point.x + code->scroll.x * STUDIO_TEXT_WIDTH;
|
||||
code->scroll.start.y = point.y + code->scroll.y * STUDIO_TEXT_HEIGHT;
|
||||
code->scroll.gesture = true;
|
||||
}
|
||||
}
|
||||
else code->scroll.gesture = false;
|
||||
updateEditor(code);
|
||||
}
|
||||
|
||||
static void processMouse(Code* code)
|
||||
|
@ -1070,7 +1048,6 @@ static void textEditTick(Code* code)
|
|||
}
|
||||
}
|
||||
|
||||
processGestures(code);
|
||||
processMouse(code);
|
||||
|
||||
code->tic->api.clear(code->tic, getConfig()->theme.code.bg);
|
||||
|
|
|
@ -2515,23 +2515,6 @@ static void setScroll(Console* console, s32 val)
|
|||
}
|
||||
}
|
||||
|
||||
static void processGesture(Console* console)
|
||||
{
|
||||
tic_point point = {0, 0};
|
||||
|
||||
if(getGesturePos(&point))
|
||||
{
|
||||
if(console->scroll.active)
|
||||
setScroll(console, (console->scroll.start - point.y) / STUDIO_TEXT_HEIGHT);
|
||||
else
|
||||
{
|
||||
console->scroll.start = point.y + console->scroll.pos * STUDIO_TEXT_HEIGHT;
|
||||
console->scroll.active = true;
|
||||
}
|
||||
}
|
||||
else console->scroll.active = false;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s32 major;
|
||||
|
@ -2625,6 +2608,7 @@ static void tick(Console* console)
|
|||
}
|
||||
}
|
||||
|
||||
if(tic->ram.input.keyboard.data != 0)
|
||||
{
|
||||
if(keyWasPressed(tic_key_up)) onHistoryUp(console);
|
||||
else if(keyWasPressed(tic_key_down)) onHistoryDown(console);
|
||||
|
@ -2652,28 +2636,26 @@ static void tick(Console* console)
|
|||
scrollConsole(console);
|
||||
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
||||
}
|
||||
}
|
||||
|
||||
char sym = getKeyboardText();
|
||||
char sym = getKeyboardText();
|
||||
|
||||
if(sym)
|
||||
{
|
||||
size_t size = strlen(console->inputBuffer);
|
||||
|
||||
if(size < sizeof(console->inputBuffer))
|
||||
if(sym)
|
||||
{
|
||||
char* pos = console->inputBuffer + console->inputPosition;
|
||||
memmove(pos + 1, pos, strlen(pos));
|
||||
size_t size = strlen(console->inputBuffer);
|
||||
|
||||
*(console->inputBuffer + console->inputPosition) = sym;
|
||||
console->inputPosition++;
|
||||
if(size < sizeof(console->inputBuffer))
|
||||
{
|
||||
char* pos = console->inputBuffer + console->inputPosition;
|
||||
memmove(pos + 1, pos, strlen(pos));
|
||||
|
||||
*(console->inputBuffer + console->inputPosition) = sym;
|
||||
console->inputPosition++;
|
||||
}
|
||||
|
||||
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
||||
}
|
||||
|
||||
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
||||
}
|
||||
|
||||
processGesture(console);
|
||||
|
||||
if(console->tickCounter == 0)
|
||||
{
|
||||
if(!console->embed.yes)
|
||||
|
|
|
@ -93,6 +93,10 @@ static void onNo(Dialog* dlg)
|
|||
|
||||
static void processKeyboard(Dialog* dlg)
|
||||
{
|
||||
tic_mem* tic = dlg->tic;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
if(keyWasPressed(tic_key_left))
|
||||
{
|
||||
dlg->focus = (dlg->focus-1) % 2;
|
||||
|
|
27
src/map.c
27
src/map.c
|
@ -1008,6 +1008,8 @@ static void processKeyboard(Map* map)
|
|||
tic_mem* tic = map->tic;
|
||||
map->sheet.show = false;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
bool shift = tic->api.key(tic, tic_key_shift);
|
||||
bool ctrl = tic->api.key(tic, tic_key_ctrl);
|
||||
|
||||
|
@ -1055,36 +1057,11 @@ static void processKeyboard(Map* map)
|
|||
}
|
||||
}
|
||||
|
||||
static void processGesture(Map* map)
|
||||
{
|
||||
tic_point point = {0, 0};
|
||||
|
||||
if(getGesturePos(&point))
|
||||
{
|
||||
if(map->scroll.gesture)
|
||||
{
|
||||
map->scroll.x = map->scroll.start.x - point.x;
|
||||
map->scroll.y = map->scroll.start.y - point.y;
|
||||
|
||||
normalizeMap(&map->scroll.x, &map->scroll.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
map->scroll.start.x = point.x + map->scroll.x;
|
||||
map->scroll.start.y = point.y + map->scroll.y;
|
||||
map->scroll.gesture = true;
|
||||
}
|
||||
}
|
||||
else map->scroll.gesture = false;
|
||||
}
|
||||
|
||||
static void tick(Map* map)
|
||||
{
|
||||
map->tickCounter++;
|
||||
|
||||
processKeyboard(map);
|
||||
processGesture(map);
|
||||
|
||||
map->tic->api.clear(map->tic, TIC_COLOR_BG);
|
||||
|
||||
drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE);
|
||||
|
|
|
@ -436,6 +436,8 @@ static void processKeyboard(Menu* menu)
|
|||
{
|
||||
tic_mem* tic = menu->tic;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
if(menu->gamepad.selected < 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -1003,6 +1003,8 @@ static void processKeyboard(Music* music)
|
|||
{
|
||||
tic_mem* tic = music->tic;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
switch(getClipboardEvent())
|
||||
{
|
||||
case TIC_CLIPBOARD_CUT: copyToClipboard(music, true); break;
|
||||
|
|
|
@ -631,6 +631,8 @@ static void processKeyboard(Sfx* sfx)
|
|||
{
|
||||
tic_mem* tic = sfx->tic;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
bool ctrl = tic->api.key(tic, tic_key_ctrl);
|
||||
|
||||
s32 keyboardButton = -1;
|
||||
|
|
|
@ -1431,6 +1431,8 @@ static void processKeyboard(Sprite* sprite)
|
|||
{
|
||||
tic_mem* tic = sprite->tic;
|
||||
|
||||
if(tic->ram.input.keyboard.data == 0) return;
|
||||
|
||||
switch(getClipboardEvent())
|
||||
{
|
||||
case TIC_CLIPBOARD_CUT: cutToClipboard(sprite); break;
|
||||
|
|
26
src/studio.c
26
src/studio.c
|
@ -107,12 +107,6 @@ static struct
|
|||
MouseState state[3];
|
||||
} mouse;
|
||||
|
||||
struct
|
||||
{
|
||||
tic_point pos;
|
||||
bool active;
|
||||
} gesture;
|
||||
|
||||
tic_key keycodes[KEYMAP_COUNT];
|
||||
|
||||
struct
|
||||
|
@ -198,12 +192,6 @@ static struct
|
|||
.prevMode = TIC_CODE_MODE,
|
||||
.dialogMode = TIC_CONSOLE_MODE,
|
||||
|
||||
.gesture =
|
||||
{
|
||||
.pos = {0, 0},
|
||||
.active = false,
|
||||
},
|
||||
|
||||
.keycodes =
|
||||
{
|
||||
tic_key_up,
|
||||
|
@ -1053,18 +1041,6 @@ bool checkMouseDown(const tic_rect* rect, s32 button)
|
|||
return state->down && pointInRect(&state->start, rect);
|
||||
}
|
||||
|
||||
bool getGesturePos(tic_point* pos)
|
||||
{
|
||||
if(studioImpl.gesture.active)
|
||||
{
|
||||
*pos = studioImpl.gesture.pos;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void setCursor(tic_cursor id)
|
||||
{
|
||||
tic_mem* tic = studioImpl.studio.tic;
|
||||
|
@ -1565,8 +1541,6 @@ static void renderStudio()
|
|||
|
||||
showTooltip("");
|
||||
|
||||
studioImpl.gesture.active = false;
|
||||
|
||||
{
|
||||
const tic_sfx* sfx = NULL;
|
||||
const tic_music* music = NULL;
|
||||
|
|
|
@ -94,8 +94,6 @@ bool checkMousePos(const tic_rect* rect);
|
|||
bool checkMouseClick(const tic_rect* rect, s32 button);
|
||||
bool checkMouseDown(const tic_rect* rect, s32 button);
|
||||
|
||||
bool getGesturePos(tic_point* pos);
|
||||
|
||||
void drawToolbar(tic_mem* tic, u8 color, bool bg);
|
||||
void drawBitIcon(s32 x, s32 y, const u8* ptr, u8 color);
|
||||
|
||||
|
|
Loading…
Reference in New Issue