summaryrefslogtreecommitdiffstats
path: root/src/tk
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-08-07 13:50:13 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-08-07 13:50:13 (EDT)
commit7dd13e36121da49b80a02297922f02881c4200a6 (patch)
tree5e58e61108682d9671f07a5ff0d3df246be2bb5d /src/tk
parent9d9d9fb9eab0213cd305f53a887628a2aca2c365 (diff)
downloadmazefight-7dd13e36121da49b80a02297922f02881c4200a6.zip
mazefight-7dd13e36121da49b80a02297922f02881c4200a6.tar.gz
mazefight-7dd13e36121da49b80a02297922f02881c4200a6.tar.bz2
tk: Add window origin coordinates
Diffstat (limited to 'src/tk')
-rw-r--r--src/tk/window.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tk/window.c b/src/tk/window.c
index 5062f24..0c8302e 100644
--- a/src/tk/window.c
+++ b/src/tk/window.c
@@ -25,13 +25,15 @@
#include "widget.h"
struct mftk_window {
+ int x;
+ int y;
struct mftk_widget *root;
struct mftk_widget *first;
struct mftk_widget *focus;
};
struct mftk_window *
-mftk_window_new(struct mftk_widget *root)
+mftk_window_new(int x, int y, struct mftk_widget *root)
{
struct mftk_window *w;
@@ -43,6 +45,8 @@ mftk_window_new(struct mftk_widget *root)
return NULL;
}
+ w->x = x;
+ w->y = y;
w->root = root;
mftk_widget_layout(w->root);
@@ -99,7 +103,7 @@ mftk_window_event(struct mftk_window *w, SDL_Event *e)
case SDL_TEXTINPUT:
return mftk_widget_key_event(w->focus, e);
case SDL_MOUSEBUTTONUP:
- return mftk_widget_mouse_event(w->root, e, 0, 0);
+ return mftk_widget_mouse_event(w->root, e, w->x, w->y);
default:
break;
}
@@ -120,7 +124,7 @@ mftk_window_focus(struct mftk_window *win, struct mftk_widget *wid)
int
mftk_window_render(struct mftk_window *w, SDL_Renderer *renderer)
{
- return mftk_widget_render(w->root, renderer, 0, 0);
+ return mftk_widget_render(w->root, renderer, w->x, w->y);
}
void