no message
This commit is contained in:
parent
77db73ef87
commit
2cd9f6f5f0
|
@ -237,6 +237,10 @@ static struct
|
||||||
|
|
||||||
char getKeyboardText()
|
char getKeyboardText()
|
||||||
{
|
{
|
||||||
|
char text = getSystem()->getKeyboardText();
|
||||||
|
|
||||||
|
if(text) return text;
|
||||||
|
|
||||||
tic_mem* tic = impl.studio.tic;
|
tic_mem* tic = impl.studio.tic;
|
||||||
|
|
||||||
static const char Symbols[] = " abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;'`,./ ";
|
static const char Symbols[] = " abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;'`,./ ";
|
||||||
|
|
19
src/system.c
19
src/system.c
|
@ -65,6 +65,7 @@ static struct
|
||||||
GPU_Image* down;
|
GPU_Image* down;
|
||||||
} texture;
|
} texture;
|
||||||
|
|
||||||
|
char text;
|
||||||
} keyboard;
|
} keyboard;
|
||||||
|
|
||||||
u32 touchCounter;
|
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 void processKeyboard()
|
||||||
{
|
{
|
||||||
static const u8 KeyboardCodes[] =
|
static const u8 KeyboardCodes[] =
|
||||||
|
@ -785,6 +795,14 @@ static void pollEvent()
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED: platform.studio->updateProject(); break;
|
case SDL_WINDOWEVENT_FOCUS_GAINED: platform.studio->updateProject(); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SDL_TEXTINPUT:
|
||||||
|
{
|
||||||
|
const char* text = event.text.text;
|
||||||
|
|
||||||
|
if(strlen(text) == 1)
|
||||||
|
platform.keyboard.text = *text;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
platform.studio->exit();
|
platform.studio->exit();
|
||||||
break;
|
break;
|
||||||
|
@ -1278,6 +1296,7 @@ static System systemInterface =
|
||||||
.preseed = preseed,
|
.preseed = preseed,
|
||||||
.poll = pollEvent,
|
.poll = pollEvent,
|
||||||
.updateConfig = updateConfig,
|
.updateConfig = updateConfig,
|
||||||
|
.getKeyboardText = getKeyboardText,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gpuTick()
|
static void gpuTick()
|
||||||
|
|
|
@ -29,6 +29,8 @@ typedef struct
|
||||||
|
|
||||||
void (*updateConfig)();
|
void (*updateConfig)();
|
||||||
|
|
||||||
|
char (*getKeyboardText)();
|
||||||
|
|
||||||
} System;
|
} System;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
Loading…
Reference in New Issue