summaryrefslogtreecommitdiff
path: root/src/main/game/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/game/game.c')
-rw-r--r--src/main/game/game.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/game/game.c b/src/main/game/game.c
index 117cf45..0aa4888 100644
--- a/src/main/game/game.c
+++ b/src/main/game/game.c
@@ -17,7 +17,33 @@
* along with Tris Game. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
#include "../engine/engine.h"
+#include "game.h"
+#include "../util.h"
+#include "../engine/ui/ui.h"
+
+TrisGame *
+game_init(int width, int height)
+{
+ TrisGame *game = malloc(sizeof(TrisGame));
+ if (game == NULL) {
+ log_error("Error allocating memory for the game");
+ exit(EXIT_FAILURE);
+ }
+ engine_init(width, height);
+ ui_set_title("Tris Game");
+
+ game_draw_field(0.5, 0, 0);
+
+ return game;
+}
+
+void
+game_start()
+{
+ engine_loop();
+}
void
game_draw_field(float box_size, float x, float y)