no message

This commit is contained in:
Vadim Grigoruk
2018-08-25 01:13:36 +03:00
parent 77db73ef87
commit 2cd9f6f5f0
3 changed files with 25 additions and 0 deletions

View File

@@ -237,6 +237,10 @@ static struct
char getKeyboardText()
{
char text = getSystem()->getKeyboardText();
if(text) return text;
tic_mem* tic = impl.studio.tic;
static const char Symbols[] = " abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;'`,./ ";

View File

@@ -65,6 +65,7 @@ static struct
GPU_Image* down;
} texture;
char text;
} keyboard;
u32 touchCounter;
@@ -394,6 +395,15 @@ static void processMouse()
}
}
// TODO: ugly hack, but I didn't find a better solution
// will try to fix it later
static char getKeyboardText()
{
char text = platform.keyboard.text;
platform.keyboard.text = 0;
return text;
}
static void processKeyboard()
{
static const u8 KeyboardCodes[] =
@@ -785,6 +795,14 @@ static void pollEvent()
case SDL_WINDOWEVENT_FOCUS_GAINED: platform.studio->updateProject(); break;
}
break;
case SDL_TEXTINPUT:
{
const char* text = event.text.text;
if(strlen(text) == 1)
platform.keyboard.text = *text;
}
break;
case SDL_QUIT:
platform.studio->exit();
break;
@@ -1278,6 +1296,7 @@ static System systemInterface =
.preseed = preseed,
.poll = pollEvent,
.updateConfig = updateConfig,
.getKeyboardText = getKeyboardText,
};
static void gpuTick()

View File

@@ -29,6 +29,8 @@ typedef struct
void (*updateConfig)();
char (*getKeyboardText)();
} System;
typedef struct