Editor: teclado na tela nos campos, "Meus Blocos" sempre e "define" ao abrir .sb
- graphics: text_input(on, x, y, w, h) opcional no backend e tb_graphics_text_input. O editor avisa o campo em foco (e o cursor) quando muda ou quando o campo e tocado de novo; o SDL liga/desliga a entrada de texto (teclado na tela no Android) e posiciona o IME. No desktop a entrada de texto segue sempre ligada. O editor de codigo so pede o teclado depois de um toque nele. - Categorias: MAX_CATS 24 -> 64 e a ultima vaga reservada para "Meus Blocos" (com 3D, Shader, PNG... as ultimas categorias sumiam). - Abrir um .sb com "define": os tipos User.* sao criados ao carregar a aba, nao so ao apertar a bandeira (as chamadas apareciam como "User.<nome>"). - Harness: cenarios 37 (teclado) e 38 (.sb com define). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c9ff13bb77
commit
cea7cb5ba4
6 files changed
+125
-5
No files matched your search
@@ -682,7 +682,10 @@ static bool be_init(void) {
|
||||
return false;
|
||||
}
|
||||
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
||||
SDL_StartTextInput();
|
||||
/* Com teclado na tela (celular) a entrada de texto so liga com um campo
|
||||
em foco (be_text_input); senao o teclado abriria ja na partida */
|
||||
if (SDL_HasScreenKeyboardSupport()) SDL_StopTextInput();
|
||||
else SDL_StartTextInput();
|
||||
ui_scale_begin();
|
||||
sensors_open();
|
||||
s_be_inited = true;
|
||||
@@ -925,6 +928,18 @@ static char* be_clipboard_get(void) {
|
||||
return r;
|
||||
}
|
||||
|
||||
static void be_text_input(bool on, float x, float y, float w, float h) {
|
||||
if (!be_init()) return;
|
||||
if (on) {
|
||||
const float S = s_ui_scale > 0.f ? s_ui_scale : 1.f;
|
||||
SDL_Rect r = { (int)(x * S), (int)(y * S), (int)(w * S + 0.5f), (int)(h * S + 0.5f) };
|
||||
SDL_SetTextInputRect(&r);
|
||||
SDL_StartTextInput(); /* reabre o teclado se foi fechado */
|
||||
} else if (SDL_HasScreenKeyboardSupport()) {
|
||||
SDL_StopTextInput(); /* desktop: o texto segue ligado (atalhos) */
|
||||
}
|
||||
}
|
||||
|
||||
/* Captura para conferir o visual sem olhar a tela de ninguem:
|
||||
TINYBLOCKS_SHOT=arquivo.bmp salva a 1a janela depois de
|
||||
TINYBLOCKS_SHOT_FRAMES quadros (padrao 30) e sai. Com TINYBLOCKS_SHOT_COUNT=n
|
||||
@@ -1004,6 +1019,7 @@ static const TinyBlocks_GraphicsBackend s_sdl2_backend = {
|
||||
.frame_wait = be_frame_wait,
|
||||
.clipboard_set = be_clipboard_set,
|
||||
.clipboard_get = be_clipboard_get,
|
||||
.text_input = be_text_input,
|
||||
};
|
||||
|
||||
const TinyBlocks_GraphicsBackend* tb_sdl2_graphics_backend(void) {
|
||||
|
||||
Reference in new issue
Block a user