diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-03-24 23:13:42 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-03-24 23:13:42 +0100 |
commit | 95f69d4f83ad8f7fbb56349f29e902928510362b (patch) | |
tree | 51f4848b0518d138368af30f8e7abeebb89ebd5f /fw/fe310/eos/eve/screen/screen.c | |
parent | 8c61343677d2ed8f929372863016524707b8ab93 (diff) |
window hierarchy
Diffstat (limited to 'fw/fe310/eos/eve/screen/screen.c')
-rw-r--r-- | fw/fe310/eos/eve/screen/screen.c | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/fw/fe310/eos/eve/screen/screen.c b/fw/fe310/eos/eve/screen/screen.c deleted file mode 100644 index 25a1a76..0000000 --- a/fw/fe310/eos/eve/screen/screen.c +++ /dev/null @@ -1,109 +0,0 @@ -#include <stdlib.h> -#include <string.h> - -#include "eve.h" -#include "eve_kbd.h" - -#include "screen.h" -#include "window.h" -#include "view.h" - -int eve_screen_init(EVEScreen *screen, uint16_t w, uint16_t h) { - memset(screen, 0, sizeof(EVEScreen)); - screen->w = w; - screen->h = h; - screen->mem_next = EVE_RAM_G; - eve_touch_set_handler(eve_screen_handle_touch, screen); -} - -void eve_screen_set_kbd(EVEScreen *screen, EVEKbd *kbd) { - screen->kbd = kbd; -} - -EVEKbd *eve_screen_get_kbd(EVEScreen *screen) { - return screen->kbd; -} - -void eve_screen_show_kbd(EVEScreen *screen) { - EVEWindow *win = screen->win_tail; - EVEKbd *kbd = eve_screen_get_kbd(screen); - - if (win && kbd) win->g.y = screen->h - kbd->g.h; -} - -void eve_screen_hide_kbd(EVEScreen *screen) { - EVEWindow *win = screen->win_tail; - EVEKbd *kbd = eve_screen_get_kbd(screen); - - if (win && kbd) { - win->g.y = screen->h; - eve_kbd_close(kbd); - } -} - -void eve_screen_draw(EVEScreen *screen) { - EVEWindow *win; - uint8_t tagN = 0x80; - - eve_cmd_burst_start(); - eve_cmd_dl(CMD_DLSTART); - - win = screen->win_head; - while (win) { - if (eve_window_visible(win)) { - int16_t x = win->g.x; - int16_t y = win->g.y; - uint16_t w = win->g.w; - uint16_t h = win->g.h; - - if (x < 0) { - w += x; - x = 0; - } - if (y < 0) { - h += y; - y = 0; - } - if (x + w > screen->w) w = screen->w - x; - if (y + h > screen->h) h = screen->h - y; - win->tag = tagN; - - if (tagN != EVE_TAG_NOTAG) { - eve_cmd_dl(CLEAR_TAG(tagN)); - tagN++; - } - eve_cmd_dl(CLEAR_COLOR_RGBC(win->color_bg)); - eve_cmd_dl(SCISSOR_XY(x, y)); - eve_cmd_dl(SCISSOR_SIZE(w, h)); - eve_cmd_dl(CLEAR(1,1,1)); - eve_cmd_dl(COLOR_RGBC(win->color_fg)); - tagN = win->view->draw(win->view, tagN); - } - win = win->next; - } - - eve_cmd_dl(DISPLAY()); - eve_cmd_dl(CMD_SWAP); - eve_cmd_burst_end(); - eve_cmd_exec(1); -} - -void eve_screen_handle_touch(EVETouch *touch, uint16_t evt, uint8_t tag0, void *s) { - EVEScreen *screen = s; - EVEWindow *win; - int h = 0; - - win = screen->win_tail; - while (win) { - if (eve_window_visible(win)) { - h = win->view->touch(win->view, touch, evt, tag0); - if (h) break; - } - win = win->prev; - } - - if (h) { - eve_touch_clear_opt(); - eve_screen_draw(screen); - } -} |