diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-05 15:09:19 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-05 15:39:22 (EDT) |
commit | be9f5321b74cc33cfd644eab1e52d002565618b2 (patch) | |
tree | a025f06cb5de386afdec4939e4ab721e9db7bd27 | |
parent | 967ca52d7a1ec98b6b233b63ceeadfe6c2db5e25 (diff) | |
download | mazefight-be9f5321b74cc33cfd644eab1e52d002565618b2.zip mazefight-be9f5321b74cc33cfd644eab1e52d002565618b2.tar.gz mazefight-be9f5321b74cc33cfd644eab1e52d002565618b2.tar.bz2 |
tk: Add blank widget
-rw-r--r-- | src/tk.h | 3 | ||||
-rw-r--r-- | src/tk/blank.c | 72 | ||||
-rw-r--r-- | src/tk/local.mk | 1 |
3 files changed, 76 insertions, 0 deletions
@@ -74,4 +74,7 @@ mftk_radio_new(int butn_width, int butn_padding, SDL_Color *butn_color, int (*action)(void *, int), void *user_data, SDL_Renderer *renderer, int state, int options, ...); +struct mftk_widget * +mftk_blank_new(void); + #endif /* MFTK_H_ */ diff --git a/src/tk/blank.c b/src/tk/blank.c new file mode 100644 index 0000000..154870c --- /dev/null +++ b/src/tk/blank.c @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2021 P. J. McDermott + * + * This file is part of Maze Fight + * + * Maze Fight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Maze Fight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Maze Fight. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <SDL.h> +#include "../tk.h" +#include "widget.h" + +struct mftk_blank { + struct mftk_widget parent; +}; + +static void +_mftk_blank_layout(struct mftk_widget *w __attribute__((__unused__))) +{ + /* No size */ +} + +static int +_mftk_blank_event(struct mftk_widget *w __attribute__((__unused__)), + SDL_Event *e __attribute__((__unused__)), + int x __attribute__((__unused__)), + int y __attribute__((__unused__))) +{ + /* No events */ + return 0; +} + +static int +_mftk_blank_render(struct mftk_widget *w __attribute__((__unused__)), + SDL_Renderer *renderer __attribute__((__unused__)), + int x __attribute__((__unused__)), + int y __attribute__((__unused__))) +{ + /* Nothing to render */ + return 0; +} + +static void +_mftk_blank_destroy(struct mftk_widget *w __attribute__((__unused__))) +{ + /* Nothing to destroy */ +} + +struct mftk_widget * +mftk_blank_new(void) +{ + struct mftk_widget *w; + struct mftk_blank *b __attribute__((__unused__)); + + mftk_widget_init(w, b, blank); + + w->w = 0; + w->h = 0; + + return w; +} diff --git a/src/tk/local.mk b/src/tk/local.mk index 9cea068..d1d4efe 100644 --- a/src/tk/local.mk +++ b/src/tk/local.mk @@ -1,4 +1,5 @@ mazefight_SOURCES += \ + %reldir%/blank.c \ %reldir%/box.c \ %reldir%/button.c \ %reldir%/check.c \ |