From 9aab993fe4307d6690fc799fc3120f22afd52aa5 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Tue, 13 Feb 2018 18:45:54 +0300 Subject: [PATCH] no message --- src/code.c | 12 ++--------- src/main.c | 59 +++++++++++++++------------------------------------- src/studio.h | 4 ++-- 3 files changed, 21 insertions(+), 54 deletions(-) diff --git a/src/code.c b/src/code.c index 4e1c0e6..c62f273 100644 --- a/src/code.c +++ b/src/code.c @@ -905,14 +905,6 @@ static void processKeyboard(Code* code) else if(keyWasPressed(tic_key_right)) rightWord(code); else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl); } - // else if(keymod & KMOD_GUI) - // { - // switch(keycode) - // { - // case SDLK_LEFT: goHome(code); break; - // case SDLK_RIGHT: goEnd(code); break; - // } - // } if(keyWasPressed(tic_key_a)) selectAll(code); else if(keyWasPressed(tic_key_z)) undo(code); @@ -936,13 +928,13 @@ static void processKeyboard(Code* 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_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); + else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl); } updateEditor(code); diff --git a/src/main.c b/src/main.c index 8e6fc73..e020efe 100644 --- a/src/main.c +++ b/src/main.c @@ -28,7 +28,6 @@ static struct struct { - // tic80_gamepads keyboard; tic80_gamepads touch; tic80_gamepads joystick; @@ -37,7 +36,6 @@ static struct bool show; s32 counter; s32 alpha; - bool backProcessed; struct { @@ -483,26 +481,24 @@ static void processJoysticks() gamepad->x = SDL_JoystickGetButton(joystick, 2); gamepad->y = SDL_JoystickGetButton(joystick, 3); - // for(s32 i = 5; i < numButtons; i++) - // { - // s32 back = SDL_JoystickGetButton(joystick, i); + for(s32 i = 5; i < numButtons; i++) + { + s32 back = SDL_JoystickGetButton(joystick, i); - // if(back) - // { - // if(!platform.gamepad.backProcessed) - // { - // if(isGameMenu()) - // { - // platform.mode == TIC_MENU_MODE ? hideGameMenu() : showGameMenu(); - // platform.gamepad.backProcessed = true; - // } - // } + if(back) + { + tic_mem* tic = platform.studio->tic; - // return; - // } - // } - - // platform.gamepad.backProcessed = false; + for(s32 i = 0; i < TIC80_KEY_BUFFER; i++) + { + if(!tic->ram.input.keyboard.keys[i]) + { + tic->ram.input.keyboard.keys[i] = tic_key_escape; + break; + } + } + } + } } } @@ -514,8 +510,6 @@ static void processJoysticks() static void processGamepad() { - // processKeyboardGamepad(); - #if !defined(__EMSCRIPTEN__) && !defined(__MACOSX__) processTouchGamepad(); #endif @@ -524,7 +518,6 @@ static void processGamepad() { platform.studio->tic->ram.input.gamepads.data = 0; - // platform.studio->tic->ram.input.gamepads.data |= platform.gamepad.keyboard.data; platform.studio->tic->ram.input.gamepads.data |= platform.gamepad.touch.data; platform.studio->tic->ram.input.gamepads.data |= platform.gamepad.joystick.data; } @@ -544,9 +537,6 @@ static void pollEvent() { switch(event.type) { -// case SDL_KEYDOWN: -// if(processShortcuts(&event.key)) return NULL; -// break; case SDL_MOUSEWHEEL: { input->mouse.scrollx = event.wheel.x; @@ -599,8 +589,8 @@ static void pollEvent() // if(!platform.gesture.active) processMouse(); - processGamepad(); processKeyboard(); + processGamepad(); } static void blitTexture() @@ -828,26 +818,12 @@ static void tick() // return; // } - // SDL_SystemCursor cursor = platform.mouse.system; - // platform.mouse.system = SDL_SYSTEM_CURSOR_ARROW; - SDL_RenderClear(platform.renderer); - blitTexture(); - renderCursor(); - - // if(platform.mode == TIC_RUN_MODE && platform.studio->tic->input.gamepad) renderGamepad(); - // if(platform.mode == TIC_MENU_MODE || platform.mode == TIC_SURF_MODE) - // renderGamepad(); - - // if(platform.mouse.system != cursor) - // SDL_SetCursor(SDL_CreateSystemCursor(platform.mouse.system)); - - SDL_RenderPresent(platform.renderer); blitSound(); @@ -856,7 +832,6 @@ static void tick() // should work async with callback static const char* getAppFolder() { - static char appFolder[FILENAME_MAX]; #if defined(__EMSCRIPTEN__) diff --git a/src/studio.h b/src/studio.h index 918f7ec..d7d3aec 100644 --- a/src/studio.h +++ b/src/studio.h @@ -155,7 +155,7 @@ void studioConfigChanged(); void setStudioMode(EditorMode mode); void resumeRunMode(); EditorMode getStudioMode(); -void exitStudio(); +TIC80_API void exitStudio(); u32 unzip(u8** dest, const u8* source, size_t size); void str2buf(const char* str, s32 size, void* buf, bool flip); @@ -269,4 +269,4 @@ typedef struct NetVersion netVersionRequest(Net* net); void netDirRequest(Net* net, const char* path, ListCallback callback, void* data); void showMessageBox(const char* title, const char* message); -void updateStudioProject(); \ No newline at end of file +TIC80_API void updateStudioProject(); \ No newline at end of file