summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h2
-rw-r--r--include/draw.h18
-rw-r--r--include/engine.h15
-rw-r--r--include/field.h8
-rw-r--r--include/idlist.h5
-rw-r--r--include/painter.h15
-rw-r--r--include/tet_conf.h49
-rw-r--r--include/text.h50
-rw-r--r--include/vector.h7
9 files changed, 73 insertions, 96 deletions
diff --git a/include/common.h b/include/common.h
index 098ea9e..ca2e499 100644
--- a/include/common.h
+++ b/include/common.h
@@ -9,5 +9,5 @@ struct game {
sfClock *mTick;
sfClock *repPushDown; // repeat latency when hold Down arrow
sfClock *repKeyLeft; // repeat latency when hold Left arrow
- sfClock *repKeyRight; // repeat latency when hold Left arrow
+ sfClock *repKeyRight; // repeat latency when hold Right arrow
};
diff --git a/include/draw.h b/include/draw.h
deleted file mode 100644
index 17bf176..0000000
--- a/include/draw.h
+++ /dev/null
@@ -1,18 +0,0 @@
-struct window {
- sfVideoMode mode;
- sfRenderWindow *window;
- sfEvent event;
-};
-
-void painter_init_window();
-void painter_destroy_window();
-
-unsigned long painter_register_field();
-void painter_update_field(unsigned long id, struct field *fld);
-void painter_destroy_field(unsigned long id);
-void painter_destroy_fields();
-
-void painter_draw();
-
-void painter_destroy_drawables();
-void painter_destroy_all();
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);
diff --git a/include/field.h b/include/field.h
index 93f80f0..30ed56b 100644
--- a/include/field.h
+++ b/include/field.h
@@ -6,14 +6,6 @@ struct cell {
unsigned int color;
};
-struct vector2i {
- int x, y;
-};
-
-struct vector2ui {
- unsigned int x, y;
-};
-
/*
* field + shape coord system
* y
diff --git a/include/idlist.h b/include/idlist.h
index d1badc7..3318be4 100644
--- a/include/idlist.h
+++ b/include/idlist.h
@@ -8,5 +8,6 @@ struct idlist {
struct idlist *list_new();
struct idlist *list_append(struct idlist *list);
struct idlist *list_get(const struct idlist *list, unsigned long id);
-void list_rm_node(struct idlist *node);
-void list_foreach(struct idlist *list, void (*job)(void *));
+void list_rm_node(struct idlist *node);
+void list_foreach(struct idlist *list, void (*job)(void *));
+void list_destroy(struct idlist *list);
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();
diff --git a/include/tet_conf.h b/include/tet_conf.h
index 14a8c2a..c5a6153 100644
--- a/include/tet_conf.h
+++ b/include/tet_conf.h
@@ -16,23 +16,38 @@
// first repeat move when long push
#define moveRepeatLatency2 30000 // microseconds, for Left, Right and Down
// arrows, the rest repeat move when long push
-#define basicLatency 500000
-#define L00LATENCY 800000
-#define L01LATENCY 716667
-#define L02LATENCY 633334
-#define L03LATENCY 550000
-#define L04LATENCY 466667
-#define L05LATENCY 383334
-#define L06LATENCY 300000
-#define L07LATENCY 216667
-#define L08LATENCY 133334
-#define L09LATENCY 100000
-#define L10LATENCY 83334
-#define L13LATENCY 66667
-#define L16LATENCY 50000
-#define L19LATENCY 33334
-#define L29LATENCY 16667
-#define PUT_LATENCY 300000
+#define basicLatency 500000
+#define L00LATENCY 800000
+#define L01LATENCY 716667
+#define L02LATENCY 633334
+#define L03LATENCY 550000
+#define L04LATENCY 466667
+#define L05LATENCY 383334
+#define L06LATENCY 300000
+#define L07LATENCY 216667
+#define L08LATENCY 133334
+#define L09LATENCY 100000
+#define L10LATENCY 83334
+#define L11LATENCY L10LATENCY
+#define L12LATENCY L10LATENCY
+#define L13LATENCY 66667
+#define L14LATENCY L13LATENCY
+#define L15LATENCY L13LATENCY
+#define L16LATENCY 50000
+#define L17LATENCY L16LATENCY
+#define L18LATENCY L16LATENCY
+#define L19LATENCY 33334
+#define L20LATENCY L19LATENCY
+#define L21LATENCY L19LATENCY
+#define L22LATENCY L19LATENCY
+#define L23LATENCY L19LATENCY
+#define L24LATENCY L19LATENCY
+#define L25LATENCY L19LATENCY
+#define L26LATENCY L19LATENCY
+#define L27LATENCY L19LATENCY
+#define L28LATENCY L19LATENCY
+#define L29LATENCY 16667
+#define PUT_LATENCY 300000
#define RM_1LINES_SCORE 40
#define RM_2LINES_SCORE 100
#define RM_3LINES_SCORE 300
diff --git a/include/text.h b/include/text.h
index 73285bf..c1de778 100644
--- a/include/text.h
+++ b/include/text.h
@@ -1,39 +1,15 @@
-typedef struct List {
- void *obj;
- void *next;
- void *prev;
-} List;
-
-typedef struct Pair {
- void *k;
- void *v;
-} Pair;
-
-typedef struct KeyMap {
- Pair *pair;
- void *next;
- void *prev;
-} KeyMap;
-
-typedef struct Text {
- char *font;
- char *type;
- char *scene;
- char *text;
- void *sfText;
+#define TXT_ATTR_INVISIBLE (1 << 0)
+
+typedef struct text {
+ char *type;
+ char *scene;
+ char *font;
+ char *text;
+ unsigned int size;
+ struct vector2ui pos;
+ unsigned int attr;
+ unsigned long id;
} Text;
-FILE *openFile(char *filename);
-void checkArgs(int argc, char **argv);
-KeyMap *KeyMap_getLast(KeyMap **keyMap);
-KeyMap *KeyMap_new(KeyMap **keyMap);
-KeyMap *KeyMap_get(KeyMap **keyMap, const void *key);
-KeyMap *KeyMap_put(KeyMap **keyMap, const void *key, const void *value);
-List *List_getLast(List **list);
-List *List_new(List **list);
-List *ListOfKeyMapOfString_getFromYaml(char *filename);
-void KeyMapOfString_free(KeyMap *keyMap);
-void ListOfKeyMapOfString_free(List **list);
-List *ListOfText_getFromListOfKeyMapOfString(List *list);
-void Text_free(Text *obj);
-void ListOfText_free(List **list);
+struct idlist *load_texts(char *filename);
+void text_destroy(void *text);
diff --git a/include/vector.h b/include/vector.h
new file mode 100644
index 0000000..fb00384
--- /dev/null
+++ b/include/vector.h
@@ -0,0 +1,7 @@
+struct vector2i {
+ int x, y;
+};
+
+struct vector2ui {
+ unsigned int x, y;
+};