From be9f5321b74cc33cfd644eab1e52d002565618b2 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 05 Aug 2021 15:09:19 -0400 Subject: tk: Add blank widget --- diff --git a/src/tk.h b/src/tk.h index fa782b2..8c72d20 100644 --- a/src/tk.h +++ b/src/tk.h @@ -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 . + */ + +#include +#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 \ -- cgit v0.9.1