no message

This commit is contained in:
BADIM-PC\Vadim 2018-02-15 12:43:00 +03:00
parent b98a93c07b
commit 08f29fde5d
10 changed files with 31 additions and 111 deletions

View File

@ -884,6 +884,8 @@ static void processKeyboard(Code* code)
{ {
tic_mem* tic = code->tic; tic_mem* tic = code->tic;
if(tic->ram.input.keyboard.data == 0) return;
switch(getClipboardEvent(0)) switch(getClipboardEvent(0))
{ {
case TIC_CLIPBOARD_CUT: cutToClipboard(code); break; case TIC_CLIPBOARD_CUT: cutToClipboard(code); break;
@ -949,33 +951,9 @@ static void processKeyboard(Code* code)
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl); else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
} }
if(tic->ram.input.keyboard.data)
updateEditor(code); 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;
}
static void processMouse(Code* code) static void processMouse(Code* code)
{ {
tic_mem* tic = code->tic; tic_mem* tic = code->tic;
@ -1070,7 +1048,6 @@ static void textEditTick(Code* code)
} }
} }
processGestures(code);
processMouse(code); processMouse(code);
code->tic->api.clear(code->tic, getConfig()->theme.code.bg); code->tic->api.clear(code->tic, getConfig()->theme.code.bg);

View File

@ -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 typedef struct
{ {
s32 major; 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); if(keyWasPressed(tic_key_up)) onHistoryUp(console);
else if(keyWasPressed(tic_key_down)) onHistoryDown(console); else if(keyWasPressed(tic_key_down)) onHistoryDown(console);
@ -2652,7 +2636,6 @@ static void tick(Console* console)
scrollConsole(console); scrollConsole(console);
console->cursor.delay = CONSOLE_CURSOR_DELAY; console->cursor.delay = CONSOLE_CURSOR_DELAY;
} }
}
char sym = getKeyboardText(); char sym = getKeyboardText();
@ -2671,8 +2654,7 @@ static void tick(Console* console)
console->cursor.delay = CONSOLE_CURSOR_DELAY; console->cursor.delay = CONSOLE_CURSOR_DELAY;
} }
}
processGesture(console);
if(console->tickCounter == 0) if(console->tickCounter == 0)
{ {

View File

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

View File

@ -1008,6 +1008,8 @@ static void processKeyboard(Map* map)
tic_mem* tic = map->tic; tic_mem* tic = map->tic;
map->sheet.show = false; map->sheet.show = false;
if(tic->ram.input.keyboard.data == 0) return;
bool shift = tic->api.key(tic, tic_key_shift); bool shift = tic->api.key(tic, tic_key_shift);
bool ctrl = tic->api.key(tic, tic_key_ctrl); 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) static void tick(Map* map)
{ {
map->tickCounter++; map->tickCounter++;
processKeyboard(map); processKeyboard(map);
processGesture(map);
map->tic->api.clear(map->tic, TIC_COLOR_BG); map->tic->api.clear(map->tic, TIC_COLOR_BG);
drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE); drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE);

View File

@ -436,6 +436,8 @@ static void processKeyboard(Menu* menu)
{ {
tic_mem* tic = menu->tic; tic_mem* tic = menu->tic;
if(tic->ram.input.keyboard.data == 0) return;
if(menu->gamepad.selected < 0) if(menu->gamepad.selected < 0)
return; return;

View File

@ -1003,6 +1003,8 @@ static void processKeyboard(Music* music)
{ {
tic_mem* tic = music->tic; tic_mem* tic = music->tic;
if(tic->ram.input.keyboard.data == 0) return;
switch(getClipboardEvent()) switch(getClipboardEvent())
{ {
case TIC_CLIPBOARD_CUT: copyToClipboard(music, true); break; case TIC_CLIPBOARD_CUT: copyToClipboard(music, true); break;

View File

@ -631,6 +631,8 @@ static void processKeyboard(Sfx* sfx)
{ {
tic_mem* tic = sfx->tic; tic_mem* tic = sfx->tic;
if(tic->ram.input.keyboard.data == 0) return;
bool ctrl = tic->api.key(tic, tic_key_ctrl); bool ctrl = tic->api.key(tic, tic_key_ctrl);
s32 keyboardButton = -1; s32 keyboardButton = -1;

View File

@ -1431,6 +1431,8 @@ static void processKeyboard(Sprite* sprite)
{ {
tic_mem* tic = sprite->tic; tic_mem* tic = sprite->tic;
if(tic->ram.input.keyboard.data == 0) return;
switch(getClipboardEvent()) switch(getClipboardEvent())
{ {
case TIC_CLIPBOARD_CUT: cutToClipboard(sprite); break; case TIC_CLIPBOARD_CUT: cutToClipboard(sprite); break;

View File

@ -107,12 +107,6 @@ static struct
MouseState state[3]; MouseState state[3];
} mouse; } mouse;
struct
{
tic_point pos;
bool active;
} gesture;
tic_key keycodes[KEYMAP_COUNT]; tic_key keycodes[KEYMAP_COUNT];
struct struct
@ -198,12 +192,6 @@ static struct
.prevMode = TIC_CODE_MODE, .prevMode = TIC_CODE_MODE,
.dialogMode = TIC_CONSOLE_MODE, .dialogMode = TIC_CONSOLE_MODE,
.gesture =
{
.pos = {0, 0},
.active = false,
},
.keycodes = .keycodes =
{ {
tic_key_up, tic_key_up,
@ -1053,18 +1041,6 @@ bool checkMouseDown(const tic_rect* rect, s32 button)
return state->down && pointInRect(&state->start, rect); 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) void setCursor(tic_cursor id)
{ {
tic_mem* tic = studioImpl.studio.tic; tic_mem* tic = studioImpl.studio.tic;
@ -1565,8 +1541,6 @@ static void renderStudio()
showTooltip(""); showTooltip("");
studioImpl.gesture.active = false;
{ {
const tic_sfx* sfx = NULL; const tic_sfx* sfx = NULL;
const tic_music* music = NULL; const tic_music* music = NULL;

View File

@ -94,8 +94,6 @@ bool checkMousePos(const tic_rect* rect);
bool checkMouseClick(const tic_rect* rect, s32 button); bool checkMouseClick(const tic_rect* rect, s32 button);
bool checkMouseDown(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 drawToolbar(tic_mem* tic, u8 color, bool bg);
void drawBitIcon(s32 x, s32 y, const u8* ptr, u8 color); void drawBitIcon(s32 x, s32 y, const u8* ptr, u8 color);