summaryrefslogtreecommitdiff
path: root/code/fe310/eos/eve/screen/tile.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-03-07 05:15:17 +0100
committerUros Majstorovic <majstor@majstor.org>2020-03-07 05:15:17 +0100
commit8592a98072740de43a5b469f60854d805641c999 (patch)
tree6a98fc6e90089a2c7257374832299f875bfbefd2 /code/fe310/eos/eve/screen/tile.c
parenta0688d29102539f8bc0f5b412683bf3d899d85c0 (diff)
eve screen/tile/canvas/page/form fw added; page widget added
Diffstat (limited to 'code/fe310/eos/eve/screen/tile.c')
-rw-r--r--code/fe310/eos/eve/screen/tile.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/code/fe310/eos/eve/screen/tile.c b/code/fe310/eos/eve/screen/tile.c
new file mode 100644
index 0000000..3715f6d
--- /dev/null
+++ b/code/fe310/eos/eve/screen/tile.c
@@ -0,0 +1,32 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "eve.h"
+#include "eve_kbd.h"
+
+#include "screen.h"
+#include "tile.h"
+
+#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
+
+void eve_tile_init(EVETile *tile, EVEScreen *screen, uint16_t x, uint16_t y, uint16_t w, uint16_t h, EVECanvas *canvas) {
+ tile->screen = screen;
+ tile->x = x;
+ tile->y = y;
+ tile->w = w;
+ tile->h = h;
+ tile->canvas = canvas;
+}
+
+void eve_tile_get_pos(EVETile *tile, uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h) {
+ if (x) *x = tile->x;
+ if (y) *y = tile->y;
+ if (w) *w = tile->w;
+ if (h) *h = MIN(tile->x + tile->h, tile->screen->h - (tile->screen->kbd && tile->screen->kbd_active ? tile->screen->kbd->h : 0));
+}
+
+void eve_canvas_init(EVECanvas *canvas, eve_canvas_touch_t touch, eve_canvas_draw_t draw) {
+ canvas->touch = touch;
+ canvas->draw = draw;
+}
+