diff --git a/extmod/modtrezorui/modtrezorui-unix.h b/extmod/modtrezorui/modtrezorui-unix.h index 3667054e..1b9b514e 100644 --- a/extmod/modtrezorui/modtrezorui-unix.h +++ b/extmod/modtrezorui/modtrezorui-unix.h @@ -91,6 +91,7 @@ static void display_init(void) SDL_DestroyWindow(win); SDL_Quit(); } + SDL_SetRenderDrawColor(RENDERER, 255, 0, 0, 255); SDL_RenderClear(RENDERER); SCREEN = SDL_CreateRGBSurface(0, RESX, RESY, 16, 0xF800, 0x07E0, 0x001F, 0x0000); TEXTURE = SDL_CreateTexture(RENDERER, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, RESX, RESY); diff --git a/src/apps/playground_stick/fingerprint.toig b/src/apps/playground_stick/fingerprint.toig new file mode 100644 index 00000000..4ab4a0b5 Binary files /dev/null and b/src/apps/playground_stick/fingerprint.toig differ diff --git a/src/apps/playground_stick/layout_homescreen.py b/src/apps/playground_stick/layout_homescreen.py index a39175a1..94390185 100644 --- a/src/apps/playground_stick/layout_homescreen.py +++ b/src/apps/playground_stick/layout_homescreen.py @@ -1,16 +1,20 @@ from trezor import ui from trezor import loop +f = open('apps/playground_stick/fingerprint.toig', 'rb') +c = ui.rgbcolor(0x20, 0x98, 0xD1) def layout_homescreen(): - # ui.display.bar(0, 0, 240, 240, ui.WHITE) - - f = open('apps/playground_stick/trezor.toig', 'r') + ui.display.bar(0, 0, 240, 48 * 4, ui.BLACK) + ui.display.bar(0, 48 * 4, 240, 48, c) + ui.text_center(120, 240 - 18, 'Hold to confirm', 2, ui.WHITE, c) + p = 0 def func(foreground): f.seek(0) - ui.display.icon(0, 0, f.read(), foreground, ui.BLACK) + ui.display.loader(p, c, 0, f.read(), foreground) + p = (p + 10) % 1000 animation = ui.animate_pulse(func, ui.WHITE, ui.GREY, speed=400000) diff --git a/src/apps/playground_stick/trezor.toig b/src/apps/playground_stick/trezor.toig deleted file mode 100644 index 8ab461e3..00000000 Binary files a/src/apps/playground_stick/trezor.toig and /dev/null differ diff --git a/src/trezor/ui.py b/src/trezor/ui.py index 2a2aeed9..8f5e7867 100644 --- a/src/trezor/ui.py +++ b/src/trezor/ui.py @@ -36,6 +36,16 @@ MONO = const(0) NORMAL = const(1) BOLD = const(2) +def text(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None: + display.text(x, y, text, font, fgcolor, bgcolor) + +def text_right(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None: + w = display.text_width(text, font) + display.text(x - w, y, text, font, fgcolor, bgcolor) + +def text_center(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None: + w = display.text_width(text, font) + display.text(x - w // 2, y, text, font, fgcolor, bgcolor) def lerpi(a: int, b: int, t: float) -> int: return int(a + t * (b - a)) diff --git a/vendor/trezor-crypto b/vendor/trezor-crypto index b8ec5567..242a5de2 160000 --- a/vendor/trezor-crypto +++ b/vendor/trezor-crypto @@ -1 +1 @@ -Subproject commit b8ec5567ba701c77379f2111774456eb18b98790 +Subproject commit 242a5de275d36e2df6792c921a9cd7d8c8e8933b