1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-09 15:00:58 +00:00

feat(core): allow for changing the emulator gamma correction value by keyboard arrows

[no changelog]
This commit is contained in:
grdddj 2023-03-20 19:23:12 +01:00 committed by Jiří Musil
parent a1974f6953
commit 70120b72cc
2 changed files with 11 additions and 1 deletions

View File

@ -18,6 +18,7 @@
*/
#include <SDL.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@ -31,6 +32,7 @@
#include "memzero.h"
extern void main_clean_exit();
extern float DISPLAY_GAMMA;
void __attribute__((noreturn)) __shutdown(void) {
printf("SHUTDOWN\n");
@ -146,6 +148,14 @@ static int SDLCALL emulator_event_filter(void *userdata, SDL_Event *event) {
case SDLK_p:
display_save("emu");
return 0;
case SDLK_LEFT:
DISPLAY_GAMMA = fmaxf(0.0f, DISPLAY_GAMMA - 0.05f);
printf("DISPLAY_GAMMA: %0.2f\n", DISPLAY_GAMMA);
return 0;
case SDLK_RIGHT:
DISPLAY_GAMMA = fminf(8.0f, DISPLAY_GAMMA + 0.05f);
printf("DISPLAY_GAMMA: %0.2f\n", DISPLAY_GAMMA);
return 0;
}
break;
}

View File

@ -70,7 +70,7 @@ static SDL_Surface *PREV_SAVED;
static int DISPLAY_BACKLIGHT = -1;
static int DISPLAY_ORIENTATION = -1;
static float DISPLAY_GAMMA = 0.55f;
float DISPLAY_GAMMA = 0.55f;
int sdl_display_res_x = DISPLAY_RESX, sdl_display_res_y = DISPLAY_RESY;
int sdl_touch_offset_x, sdl_touch_offset_y;