From 2ede2f4928270b6af1412f0e7bbef5cb0e59f744 Mon Sep 17 00:00:00 2001 From: Marrub Date: Fri, 21 Oct 2016 15:07:17 -0400 Subject: [PATCH] Window: Switch x/y and w/h in Lth_WindowNew main: Add new test code --- lithos_c/inc/Lth_window.h | 3 ++- lithos_c/src/main.c | 15 +++++++++++---- lithos_c/src/window.c | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lithos_c/inc/Lth_window.h b/lithos_c/inc/Lth_window.h index b4d546d..ec4ff70 100644 --- a/lithos_c/inc/Lth_window.h +++ b/lithos_c/inc/Lth_window.h @@ -35,7 +35,8 @@ typedef struct Lth_Window // Extern Functions ----------------------------------------------------------| -Lth_Window *Lth_WindowNew(char const *title, int w, int h, int x, int y); +[[__optional_args(2)]] +Lth_Window *Lth_WindowNew(char const *title, int x, int y, int w, int h); void Lth_WindowSetTitle(Lth_Window *ctrl, char const *title); #endif//lithos3__Lth_window_h diff --git a/lithos_c/src/main.c b/lithos_c/src/main.c index 2f64388..c1e42b5 100644 --- a/lithos_c/src/main.c +++ b/lithos_c/src/main.c @@ -22,12 +22,19 @@ static void main() { Lth_Context *ctx = Lth_ContextNew(320, 200, 0x5000, 0x1000); - Lth_Window *window[2] = { - Lth_WindowNew("test window", 50, 100, 30, 30), - Lth_WindowNew("test window 2", 100, 100, -1, -1) + + Lth_ContextManifestLoad_extern(ctx, "lithos_fs/Base.lthm"); + + ctx->mapspace.x = ctx->mapspace.y = 32; + + Lth_Window *window[] = { + Lth_WindowNew("test window", -1, -1, 50, 100), + Lth_WindowNew("test window 2", -1, -1, 100, 100), + Lth_WindowNew("test window 3", -1, -1, 100, 30), + Lth_WindowNew("test window 4", -1, -1, 100, 100), }; - for(int i = 0; i < 2; i++) + for(int i = 0; i < sizeof(window) / sizeof(*window); i++) Lth_ContextMap(ctx, window[i]); ACS_Delay(1); diff --git a/lithos_c/src/window.c b/lithos_c/src/window.c index d17d91d..485a44e 100644 --- a/lithos_c/src/window.c +++ b/lithos_c/src/window.c @@ -58,7 +58,7 @@ static void Lth_WindowDestroy(Lth_Window *ctrl) // // Lth_WindowNew // -Lth_Window *Lth_WindowNew(char const *title, int w, int h, int x, int y) +Lth_Window *Lth_WindowNew(char const *title, int x, int y, int w, int h) { Lth_Window *ctrl = calloc(1, sizeof(Lth_Window)); Lth_assert(ctrl != NULL);