From f550a31fda2cb7d76e917ab69d075daa1557bf99 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Thu, 2 Jul 2020 23:25:35 +0200 Subject: string init/draw implemented; page to screen coordinates implemented --- code/fe310/eos/eve/screen/page.c | 12 ++++++++++-- code/fe310/eos/eve/screen/page.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'code/fe310/eos/eve/screen') diff --git a/code/fe310/eos/eve/screen/page.c b/code/fe310/eos/eve/screen/page.c index 25acc49..d96a2ba 100644 --- a/code/fe310/eos/eve/screen/page.c +++ b/code/fe310/eos/eve/screen/page.c @@ -25,11 +25,19 @@ void eve_page_init(EVEPage *page, eve_view_touch_t touch, eve_view_draw_t draw, } int16_t eve_page_x(EVEPage *page, int16_t x) { - x + page->win_x - page->window->g.x; + return x + page->win_x - page->window->g.x; } int16_t eve_page_y(EVEPage *page, int16_t y) { - y + page->win_y - page->window->g.y; + return y + page->win_y - page->window->g.y; +} + +int16_t eve_page_scrx(EVEPage *page, int16_t x) { + return x - page->win_x + page->window->g.x; +} + +int16_t eve_page_scry(EVEPage *page, int16_t y) { + return y - page->win_y + page->window->g.y; } void eve_page_set_focus(EVEPage *page, EVEWidget *widget, EVERect *f) { diff --git a/code/fe310/eos/eve/screen/page.h b/code/fe310/eos/eve/screen/page.h index eb8dabc..1db859e 100644 --- a/code/fe310/eos/eve/screen/page.h +++ b/code/fe310/eos/eve/screen/page.h @@ -23,6 +23,8 @@ typedef struct EVEPage { void eve_page_init(EVEPage *page, eve_view_touch_t touch, eve_view_draw_t draw, eve_page_open_t open, eve_page_close_t close, eve_page_evt_handler_t handle_evt, eve_page_g_updater_t update_g, EVEWindow *window); int16_t eve_page_x(EVEPage *page, int16_t x); int16_t eve_page_y(EVEPage *page, int16_t y); +int16_t eve_page_scrx(EVEPage *page, int16_t x); +int16_t eve_page_scry(EVEPage *page, int16_t y); void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget, EVERect *focus); struct EVEWidget *eve_page_get_focus(EVEPage *page); -- cgit v1.2.3