From 73ec96ee907f0a8ebdeec20f2058de705b00d65d Mon Sep 17 00:00:00 2001 From: Oxore Date: Mon, 9 Jul 2018 01:06:04 +0300 Subject: Finish painter, refactor game logic & keys handling Add dependencies in Makefile: now it tracks headers too! Introduce texts in painter. Delegate all the window painting to the painter. Refactor texts from yaml parsing. Remove overcomplicated keymaps and lists of keymaps of... Whatever! Just let em go! Simple idlist with foreach is more than enough. Make displayable values be separate text objects which consists only of a number value that rendered every tick and then displayed. Refactor game logic: make state machine look much obvious with transition functions. Refactor long if-else and switch-case statement chains: replace them with arrays of values (it actually takes more lines of code :P) Refactor keys handling: shorten and separate shape moving code to functions. --- include/painter.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/painter.h (limited to 'include/painter.h') diff --git a/include/painter.h b/include/painter.h new file mode 100644 index 0000000..7bcb47a --- /dev/null +++ b/include/painter.h @@ -0,0 +1,15 @@ +void painter_set_window(sfRenderWindow *window); + +void painter_load_font(char *filename); +void painter_destroy_font(); + +unsigned long painter_register_field(struct field *fld); +void painter_update_field(unsigned long id, struct field *fld); +unsigned long painter_register_text(struct text *txt); +void painter_update_text(unsigned long id, struct text *txt); + +void painter_draw(); + +void painter_destroy_drawable(unsigned long id); +void painter_destroy_drawables(); +void painter_destroy_all(); -- cgit v1.2.3