Browse Source

Refactor code

Rename files in order to prepare for extraction for publishing
subsystems independently.
feature/data-structs
TheoryOfNekomata 1 year ago
parent
commit
143206529b
17 changed files with 57 additions and 49 deletions
  1. +5
    -5
      CMakeLists.txt
  2. +4
    -3
      src/packages/game/IZ_app.h
  3. +12
    -0
      src/packages/game/IZ_app_config.c
  4. +8
    -0
      src/packages/game/IZ_app_config.h
  5. +1
    -1
      src/packages/game/IZ_app_input.c
  6. +8
    -0
      src/packages/game/IZ_app_input.h
  7. +1
    -1
      src/packages/game/IZ_app_net.c
  8. +4
    -4
      src/packages/game/IZ_app_net.h
  9. +1
    -1
      src/packages/game/IZ_app_video.c
  10. +9
    -0
      src/packages/game/IZ_app_video.h
  11. +0
    -11
      src/packages/game/config/IZ_config.c
  12. +2
    -3
      src/packages/game/config/IZ_config.h
  13. +0
    -8
      src/packages/game/input/IZ_app.h
  14. +1
    -1
      src/packages/game/net/IZ_net.h
  15. +0
    -9
      src/packages/game/output/video/IZ_app.h
  16. +1
    -1
      src/packages/game/output/video/IZ_video.h
  17. +0
    -1
      src/packages/server/net/IZ_net.h

+ 5
- 5
CMakeLists.txt View File

@@ -60,8 +60,8 @@ add_executable(
src/packages/game/input/IZ_joystick.h
src/packages/game/input/IZ_keyboard.c
src/packages/game/input/IZ_keyboard.h
src/packages/game/IZ_config.c
src/packages/game/IZ_config.h
src/packages/game/config/IZ_config.c
src/packages/game/config/IZ_config.h
src/packages/game/geometry/IZ_point2d.c
src/packages/game/geometry/IZ_point2d.h
src/packages/game/geometry/IZ_vector2d.c
@@ -90,7 +90,7 @@ add_executable(
src/packages/game/util/IZ_midi.h
src/packages/game/net/core/IZ_websocket.h
src/packages/game/net/core/IZ_websocket.c
src/packages/game/net/IZ_net.c src/packages/game/net/IZ_net.h src/packages/game/net/IZ_app.c src/packages/game/net/IZ_app.h src/packages/game/output/video/IZ_app.c src/packages/game/output/video/IZ_app.h src/packages/game/IZ_subsystem.h src/packages/game/input/IZ_app.c src/packages/game/input/IZ_app.h)
src/packages/game/net/IZ_net.c src/packages/game/net/IZ_net.h src/packages/game/IZ_app_net.c src/packages/game/IZ_app_net.h src/packages/game/IZ_app_video.c src/packages/game/IZ_app_video.h src/packages/game/IZ_subsystem.h src/packages/game/IZ_app_input.c src/packages/game/IZ_app_input.h src/packages/game/IZ_app_config.c src/packages/game/IZ_app_config.h)

target_link_libraries(
game
@@ -130,7 +130,7 @@ add_executable(
__mocks__/SDL_stdinc.mock.h
__mocks__/portmidi.mock.h

src/packages/game/IZ_config.h
src/packages/game/config/IZ_config.h

src/packages/game/input/IZ_keyboard.h
src/packages/game/input/IZ_keyboard.c
@@ -157,7 +157,7 @@ add_executable(
__mocks__/SDL_stdinc.mock.h
__mocks__/SDL_render.mock.h

src/packages/game/IZ_config.h
src/packages/game/config/IZ_config.h

src/packages/game/output/video/IZ_video.h
src/packages/game/output/video/IZ_video.c


+ 4
- 3
src/packages/game/IZ_app.h View File

@@ -3,10 +3,11 @@

#include <SDL.h>
#include <libwebsockets.h>
#include "IZ_app_config.h"
#include "memory/IZ_pool.h"
#include "input/IZ_app.h"
#include "net/IZ_app.h"
#include "output/video/IZ_app.h"
#include "IZ_app_input.h"
#include "IZ_app_net.h"
#include "IZ_app_video.h"

typedef enum {
IZ_APP_RUN_RESULT_OK,


+ 12
- 0
src/packages/game/IZ_app_config.c View File

@@ -0,0 +1,12 @@
#include "IZ_app_config.h"

void IZ_ConfigGetDefaultPath(const char* config_path, size_t string_size) {
#ifdef IZ_DEBUG
const char* config_path_dir = SDL_GetBasePath();
#else
const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME);
#endif

memcpy_s(config_path, string_size, config_path_dir, 128);
strcat_s(config_path, string_size, "config-game.ini");
}

+ 8
- 0
src/packages/game/IZ_app_config.h View File

@@ -0,0 +1,8 @@
#ifndef IZ_APP_CONFIG_H
#define IZ_APP_CONFIG_H

#include "SDL_filesystem.h"
#include "IZ_subsystem.h"
#include "config/IZ_config.h"

#endif

src/packages/game/input/IZ_app.c → src/packages/game/IZ_app_input.c View File

@@ -1,4 +1,4 @@
#include "IZ_app.h"
#include "IZ_app_input.h"

IZ_ProcedureResult IZ_AppHandleSDLEvents(struct IZ_App* app) {
SDL_Event e;

+ 8
- 0
src/packages/game/IZ_app_input.h View File

@@ -0,0 +1,8 @@
#ifndef IZ_APP_INPUT_H
#define IZ_APP_INPUT_H

#include "IZ_subsystem.h"

IZ_ProcedureResult IZ_AppHandleInputEvents(struct IZ_App*);

#endif

src/packages/game/net/IZ_app.c → src/packages/game/IZ_app_net.c View File

@@ -1,4 +1,4 @@
#include "IZ_app.h"
#include "IZ_app_net.h"

void IZ_AppHandleNetworkingInboundBinaryEvents(struct IZ_App* app, void* binary_raw, size_t len) {
u8* binary = binary_raw;

src/packages/game/net/IZ_app.h → src/packages/game/IZ_app_net.h View File

@@ -1,8 +1,8 @@
#ifndef IZ_NET_APP_H
#define IZ_NET_APP_H
#ifndef IZ_APP_NET_H
#define IZ_APP_NET_H

#include "IZ_net.h"
#include "../IZ_subsystem.h"
#include "net/IZ_net.h"
#include "IZ_subsystem.h"

typedef enum {
IZ_MESSAGE_KIND_ACTION_SYNC = 0,

src/packages/game/output/video/IZ_app.c → src/packages/game/IZ_app_video.c View File

@@ -1,4 +1,4 @@
#include "IZ_app.h"
#include "IZ_app_video.h"

void IZ_VideoUpdateForDebugTicks(IZ_VideoState* video_state, uint64_t ticks) {
SDL_SetRenderDrawColor(video_state->renderer, 0x00, 0xff, 0xff, 0xff);

+ 9
- 0
src/packages/game/IZ_app_video.h View File

@@ -0,0 +1,9 @@
#ifndef IZ_APP_VIDEO_H
#define IZ_APP_VIDEO_H

#include "output/video/IZ_video.h"
#include "IZ_subsystem.h"

void IZ_VideoUpdate(IZ_VideoState*);

#endif

src/packages/game/IZ_config.c → src/packages/game/config/IZ_config.c View File

@@ -1,16 +1,5 @@
#include "IZ_config.h"

void IZ_ConfigGetDefaultPath(const char* config_path, size_t string_size) {
#ifdef IZ_DEBUG
const char* config_path_dir = SDL_GetBasePath();
#else
const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME);
#endif

memcpy_s(config_path, string_size, config_path_dir, 128);
strcat_s(config_path, string_size, "config-game.ini");
}

const char* IZ_ConfigGetCommandlineOption(u8 argc, const char* argv[], const char* val) {
size_t n = strlen(val);
int c = argc;

src/packages/game/IZ_config.h → src/packages/game/config/IZ_config.h View File

@@ -1,11 +1,10 @@
#ifndef IZ_CONFIG_H
#define IZ_CONFIG_H

#include <SDL_filesystem.h>
#include <string.h>
#include <minIni.h>
#include <stdlib.h>
#include "IZ_common.h"
#include <minIni.h>
#include "../IZ_common.h"

typedef enum {
IZ_CONFIG_TYPE_VOID,

+ 0
- 8
src/packages/game/input/IZ_app.h View File

@@ -1,8 +0,0 @@
#ifndef IZ_INPUT_APP_H
#define IZ_INPUT_APP_H

#include "../IZ_subsystem.h"

IZ_ProcedureResult IZ_AppHandleInputEvents(struct IZ_App*);

#endif

+ 1
- 1
src/packages/game/net/IZ_net.h View File

@@ -4,7 +4,7 @@
#include <minIni.h>
#include <SDL_thread.h>
#include "../IZ_common.h"
#include "../IZ_config.h"
#include "../config/IZ_config.h"
#include "../input/IZ_action.h"
#include "core/IZ_websocket.h"
#include "svc/IZ_wsclient.h"


+ 0
- 9
src/packages/game/output/video/IZ_app.h View File

@@ -1,9 +0,0 @@
#ifndef IZ_VIDEO_APP_H
#define IZ_VIDEO_APP_H

#include "IZ_video.h"
#include "../../IZ_subsystem.h"

void IZ_VideoUpdate(IZ_VideoState*);

#endif

+ 1
- 1
src/packages/game/output/video/IZ_video.h View File

@@ -8,7 +8,7 @@
#include "../../input/IZ_input.h"
#include "../../net/IZ_net.h"
#include "../../IZ_common.h"
#include "../../IZ_config.h"
#include "../../config/IZ_config.h"

#define MAX_ACTIVE_SPRITES 32



+ 0
- 1
src/packages/server/net/IZ_net.h View File

@@ -8,7 +8,6 @@

#define IZ_DEFAULT_MOTD ""


typedef struct {
u16 port;
char name[64];


Loading…
Cancel
Save