VERSIÓ 1.4.3
- [NEW] key.text() - [NEW] key.utf8char() - [NEW] pal.trans() ara torna el color transparent - [NEW] pal.subpal(index) i pal.subpal(index,color) ara tornen el color al que estaba abans asignat el index
This commit is contained in:
38
mini.cpp
38
mini.cpp
@@ -109,6 +109,8 @@ char base64glyphs[193] = "/h/AqV/hhhh/GMYYMGz/t/eS33H477wsjjswY4IOPHEFFVVVAVAVAV
|
||||
//Uint8 keymapping[6] = { SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_Z, SDL_SCANCODE_X };
|
||||
const bool *keys;
|
||||
Uint8 key_just_pressed = 0;
|
||||
static char text_input_buffer[10];
|
||||
static bool has_text_input = false;
|
||||
|
||||
int mouse_x, mouse_y, mouse_wheel;
|
||||
Uint32 mouse_buttons;
|
||||
@@ -544,26 +546,17 @@ int main(int argc,char*argv[]){
|
||||
mouse_just_pressed = 0;
|
||||
mouse_wheel = 0;
|
||||
double_click = false;
|
||||
has_text_input = false;
|
||||
while(!should_exit) {
|
||||
if (update_mode==UPDATE_WAIT) SDL_WaitEvent(NULL);
|
||||
else if (update_mode==UPDATE_TIMEOUT) SDL_WaitEventTimeout(NULL, timeout);
|
||||
while(SDL_PollEvent(&mini_eve)) {
|
||||
if (mini_eve.type == SDL_EVENT_QUIT) { should_exit=true; should_quit=true; break; }
|
||||
if (mini_eve.type == SDL_EVENT_TEXT_INPUT) {
|
||||
SDL_strlcpy(text_input_buffer, mini_eve.text.text, sizeof(text_input_buffer));
|
||||
has_text_input = true;
|
||||
}
|
||||
if (mini_eve.type == SDL_EVENT_KEY_DOWN) {
|
||||
/*
|
||||
if (mini_eve.key.keysym.scancode == SDL_SCANCODE_F2) {
|
||||
screen_zoom+=2; if (screen_zoom>=10) screen_zoom=2;
|
||||
destroyDisplay();
|
||||
createDisplay();
|
||||
char strzoom[3];
|
||||
file_setconfigvalue("zoom", SDL_itoa(screen_zoom, strzoom, 10));
|
||||
} else if (mini_eve.key.keysym.scancode == SDL_SCANCODE_F3) {
|
||||
screen_fullscreen = !screen_fullscreen;
|
||||
destroyDisplay();
|
||||
createDisplay();
|
||||
file_setconfigvalue("fullscreen", screen_fullscreen?"true":"false");
|
||||
}
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
if (mini_eve.key.scancode == SDL_SCANCODE_F12) {
|
||||
if (lua_is_playing()) {
|
||||
@@ -626,6 +619,8 @@ int main(int argc,char*argv[]){
|
||||
if (beats>0)beats--;
|
||||
key_just_pressed = 0;
|
||||
mouse_just_pressed = 0;
|
||||
has_text_input = false;
|
||||
text_input_buffer[0] = '\0';
|
||||
double_click = false;
|
||||
mouse_wheel = 0;
|
||||
pad_just_pressed = SDL_GAMEPAD_BUTTON_INVALID;
|
||||
@@ -734,8 +729,10 @@ uint8_t gettrans() {
|
||||
return ds::trans;
|
||||
}
|
||||
|
||||
void subpal(uint8_t index, uint8_t color) {
|
||||
uint8_t subpal(uint8_t index, uint8_t color) {
|
||||
const uint8_t old = ds::draw_palette[SDL_clamp(index,0,255)];
|
||||
ds::draw_palette[SDL_clamp(index,0,255)] = SDL_clamp(color,0,255);
|
||||
return old;
|
||||
}
|
||||
|
||||
void reset_subpal() {
|
||||
@@ -1343,6 +1340,17 @@ bool anykey() {
|
||||
return something_pressed;
|
||||
}
|
||||
|
||||
void textenable(const bool enable) {
|
||||
if (enable)
|
||||
SDL_StartTextInput(mini_win);
|
||||
else
|
||||
SDL_StopTextInput(mini_win);
|
||||
}
|
||||
|
||||
const char* textinput() {
|
||||
return has_text_input ? text_input_buffer : nullptr;
|
||||
}
|
||||
|
||||
bool pad(int8_t i) {
|
||||
if (!gamepad) return false;
|
||||
return SDL_GetGamepadButton(gamepad, SDL_GamepadButton(i)) == 1;
|
||||
|
||||
Reference in New Issue
Block a user