no message
This commit is contained in:
parent
29ab09efd0
commit
1241b43ea7
|
@ -2615,7 +2615,7 @@ static void tick(Console* console)
|
||||||
|
|
||||||
tic_mem* tic = console->tic;
|
tic_mem* tic = console->tic;
|
||||||
|
|
||||||
char sym = tic->api.keytext(tic);
|
char sym = getKeyboardText();
|
||||||
|
|
||||||
if(sym)
|
if(sym)
|
||||||
{
|
{
|
||||||
|
|
21
src/studio.c
21
src/studio.c
|
@ -321,6 +321,27 @@ static struct
|
||||||
.argv = NULL,
|
.argv = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
char getKeyboardText()
|
||||||
|
{
|
||||||
|
tic_mem* tic = studioImpl.studio.tic;
|
||||||
|
|
||||||
|
static const char Symbols[] = "abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;'`,./ ";
|
||||||
|
static const char Shift[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ)!@#$%^&*(_+{}|:\"~<>? ";
|
||||||
|
|
||||||
|
enum{Count = sizeof Symbols, Hold = 20, Period = 3};
|
||||||
|
|
||||||
|
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
|
||||||
|
{
|
||||||
|
tic_key key = tic->ram.input.keyboard.keys[i];
|
||||||
|
|
||||||
|
if(key > 0 && key < Count && tic->api.keyp(tic, key, Hold, Period))
|
||||||
|
return tic->api.key(tic, tic_key_shift) ? Shift[key-1] : Symbols[key-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
tic_tiles* getBankTiles()
|
tic_tiles* getBankTiles()
|
||||||
{
|
{
|
||||||
return &studioImpl.studio.tic->cart.banks[studioImpl.bank.index.sprites].tiles;
|
return &studioImpl.studio.tic->cart.banks[studioImpl.bank.index.sprites].tiles;
|
||||||
|
|
|
@ -207,3 +207,5 @@ typedef struct
|
||||||
Studio* studioInit(s32 argc, char **argv, s32 samplerate);
|
Studio* studioInit(s32 argc, char **argv, s32 samplerate);
|
||||||
void studioTick(void* pixels);
|
void studioTick(void* pixels);
|
||||||
void studioClose();
|
void studioClose();
|
||||||
|
|
||||||
|
char getKeyboardText();
|
||||||
|
|
18
src/tic.c
18
src/tic.c
|
@ -1714,23 +1714,6 @@ static bool api_keyp(tic_mem* tic, tic_key key, s32 hold, s32 period)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char api_keytext(tic_mem* tic)
|
|
||||||
{
|
|
||||||
static const char Symbols[] = "abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;'`,./ ";
|
|
||||||
static const char Shift[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ)!@#$%^&*(_+{}|:\"~<>? ";
|
|
||||||
|
|
||||||
enum{Count = sizeof Symbols, Hold = 20, Period = 3};
|
|
||||||
|
|
||||||
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
|
|
||||||
{
|
|
||||||
tic_key key = tic->ram.input.keyboard.keys[i];
|
|
||||||
|
|
||||||
if(key > 0 && key < Count && tic->api.keyp(tic, key, Hold, Period))
|
|
||||||
return tic->api.key(tic, tic_key_shift) ? Shift[key-1] : Symbols[key-1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
static void api_load(tic_cartridge* cart, const u8* buffer, s32 size, bool palette)
|
static void api_load(tic_cartridge* cart, const u8* buffer, s32 size, bool palette)
|
||||||
{
|
{
|
||||||
const u8* end = buffer + size;
|
const u8* end = buffer + size;
|
||||||
|
@ -1960,7 +1943,6 @@ static void initApi(tic_api* api)
|
||||||
INIT_API(btnp);
|
INIT_API(btnp);
|
||||||
INIT_API(key);
|
INIT_API(key);
|
||||||
INIT_API(keyp);
|
INIT_API(keyp);
|
||||||
INIT_API(keytext);
|
|
||||||
INIT_API(load);
|
INIT_API(load);
|
||||||
INIT_API(save);
|
INIT_API(save);
|
||||||
INIT_API(tick_start);
|
INIT_API(tick_start);
|
||||||
|
|
|
@ -156,7 +156,6 @@ typedef struct
|
||||||
u32 (*btnp) (tic_mem* memory, s32 id, s32 hold, s32 period);
|
u32 (*btnp) (tic_mem* memory, s32 id, s32 hold, s32 period);
|
||||||
bool (*key) (tic_mem* memory, tic_key key);
|
bool (*key) (tic_mem* memory, tic_key key);
|
||||||
bool (*keyp) (tic_mem* memory, tic_key key, s32 hold, s32 period);
|
bool (*keyp) (tic_mem* memory, tic_key key, s32 hold, s32 period);
|
||||||
char (*keytext) (tic_mem* memory);
|
|
||||||
|
|
||||||
void (*load) (tic_cartridge* rom, const u8* buffer, s32 size, bool palette);
|
void (*load) (tic_cartridge* rom, const u8* buffer, s32 size, bool palette);
|
||||||
s32 (*save) (const tic_cartridge* rom, u8* buffer);
|
s32 (*save) (const tic_cartridge* rom, u8* buffer);
|
||||||
|
|
Loading…
Reference in New Issue