Jelajahi Sumber

Moved game/screen file contents to game/game_common files

Aaro Saila 1 bulan lalu
induk
melakukan
2868f8176a

+ 0 - 1
meson.build

@@ -34,7 +34,6 @@ game = executable(
   'src/game/SinglePlayer.c',
   'src/game/game_common.c',
   'src/game/pong.c',
-  'src/game/screen.c',
   common_src,
   include_directories: [
     common_include

+ 1 - 1
src/game/MainMenu.c

@@ -6,7 +6,7 @@
 #include "cglm/vec3.h"
 
 #include "MainMenu.h"
-#include "screen.h"
+#include "game_common.h"
 
 MainMenu MainMenu_alloc(const unsigned int screen_w, const unsigned int screen_h) {
     MainMenu mm;

+ 1 - 1
src/game/MainMenu.h

@@ -2,7 +2,7 @@
 
 #include "scufeng/Shape.h"
 
-#include "screen.h"
+#include "game_common.h"
 
 typedef struct {
     SEMesh title_text;

+ 1 - 1
src/game/SinglePlayer.c

@@ -3,7 +3,7 @@
 #include "scufeng/Scene.h"
 
 #include "SinglePlayer.h"
-#include "screen.h"
+#include "game_common.h"
 
 SinglePlayer SinglePlayer_alloc(
     unsigned int screen_w,

+ 1 - 1
src/game/SinglePlayer.h

@@ -3,7 +3,7 @@
 #include "scufeng/Shape.h"
 
 #include "game.h"
-#include "screen.h"
+#include "game_common.h"
 
 typedef struct {
     unsigned int screen_w;

+ 2 - 0
src/game/game_common.c

@@ -4,6 +4,8 @@
 #include "game_common.h"
 #include "game.h"
 
+Screen current_screen = PONG_MAIN_MENU;
+
 static void pos_convert(
     vec3 render_pos,
     const vec3 state_pos,

+ 8 - 0
src/game/game_common.h

@@ -4,6 +4,14 @@
 
 #include "game.h"
 
+typedef enum {
+    PONG_MAIN_MENU,
+    PONG_SINGLEPLAYER,
+    PONG_MULTIPLAYER,
+} Screen;
+
+extern Screen current_screen;
+
 typedef struct {
     SEMesh paddle_l;
     SEMesh paddle_r;

+ 0 - 1
src/game/pong.c

@@ -1,7 +1,6 @@
 #include "scufeng/engine.h"
 #include "scufeng/text.h"
 
-#include "screen.h"
 #include "MainMenu.h"
 #include "SinglePlayer.h"
 #include "MultiPlayer.h"

+ 0 - 3
src/game/screen.c

@@ -1,3 +0,0 @@
-#include "screen.h"
-
-Screen current_screen = PONG_MAIN_MENU;

+ 0 - 9
src/game/screen.h

@@ -1,9 +0,0 @@
-#pragma once
-
-typedef enum {
-    PONG_MAIN_MENU,
-    PONG_SINGLEPLAYER,
-    PONG_MULTIPLAYER,
-} Screen;
-
-extern Screen current_screen;