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/engine.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'include/engine.h') diff --git a/include/engine.h b/include/engine.h index bca16ed..4e0ee33 100644 --- a/include/engine.h +++ b/include/engine.h @@ -1,13 +1,2 @@ -#define RIGHT (1 << 0) -#define DOWN (1 << 1) -#define UP (1 << 2) -#define LEFT (1 << 3) -#define RIGHTHOLD (1 << 4) -#define LEFTHOLD (1 << 5) - -void tKeyCtrl(); -void tTick(); -void checkLevelUp(struct game *game); -int getMoveLatencyOfLevel(unsigned int level); -void valueAfterTextDisplay(int value, List *texts, char *type); -void gameover(struct game *game); +void transition_init(void); +void main_loop(void); -- cgit v1.2.3