diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-23 16:52:32 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-23 16:52:32 +0100 |
| commit | c5826edc22894af945509905eeb7a155b8ce2d87 (patch) | |
| tree | f6ec56f7a7d15e8a4a7df9daababf6c0e1a88607 /src | |
| parent | ea8901deb1704ec62a13aa491ee965d31ea1ff1b (diff) | |
added global data store and update function
Diffstat (limited to 'src')
| -rw-r--r-- | src/global.c | 36 | ||||
| -rw-r--r-- | src/global.h | 25 |
2 files changed, 61 insertions, 0 deletions
diff --git a/src/global.c b/src/global.c new file mode 100644 index 0000000..d9dc3bf --- /dev/null +++ b/src/global.c @@ -0,0 +1,36 @@ +#include <stdlib.h> +#include <string.h> +#include "global.h" + +static data_store* data = NULL; + +// returns global data_store +data_store* datamodel() +{ + if(data == NULL) + { + data = malloc(sizeof(data_store)); + memset(data, 0, sizeof(data_store)); + } + + return data; +} + +// indicate which part of model has been changed, +// so UI can be redrawn +void updated_model(update_type_t action) +{ + switch(action) + { + case update_type_players: + // ui_redraw_player_list() + break; + case update_type_stacks: + // ui_redraw_stacks() + break; + case update_type_hand: + // ui_redraw_hand() + break; + } +} + diff --git a/src/global.h b/src/global.h new file mode 100644 index 0000000..c8ad6d3 --- /dev/null +++ b/src/global.h @@ -0,0 +1,25 @@ +#ifndef OXEN_GLOBAL_H +#define OXEN_GLOBAL_H + +#include "player.h" +#include "table_stacks.h" +#include "hand.h" + +typedef struct +{ + player_list players; + table_stacks_t table_stacks; + hand_t hand; +} data_store; + +typedef enum +{ + update_type_players = 0x0, + update_type_stacks = 0x1, + update_type_hand = 0x2 +} update_type_t; + +void updated_model(update_type_t type); +data_store* datamodel(); + +#endif // OXEN_GLOBAL_H |
