Selaa lähdekoodia

Merge branch 'master' of code.modal.sh:modal-studios/izanagi-2022

master
TheoryOfNekomata 1 vuosi sitten
vanhempi
commit
719a5b04c7
12 muutettua tiedostoa jossa 60 lisäystä ja 28 poistoa
  1. +2
    -2
      00-build-cache-debug-x64
  2. +15
    -0
      01-build-executable
  3. +0
    -3
      01-build-game
  4. +0
    -3
      02-build-server
  5. +7
    -0
      03-run-tests
  6. +10
    -10
      CMakeLists.txt
  7. +15
    -3
      README.md
  8. +2
    -0
      TODO.md
  9. +6
    -5
      src/packages/log/IZ_log.c
  10. +1
    -0
      src/packages/log/IZ_log.h
  11. +1
    -1
      src/packages/stdinc/IZ_string.c
  12. +1
    -1
      subprojects/midi-utils

+ 2
- 2
00-build-cache-debug-x64 Näytä tiedosto

@@ -2,10 +2,10 @@

cmake \
-DCMAKE_SIZEOF_VOID_P=8 \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_MAKE_PROGRAM=ninja \
-DCMAKE_C_COMPILER=cc \
-DCMAKE_C_FLAGS=-m64 \
-G Ninja \
-S . \
-B ./build/Debug
-B ./build/$BUILD_TYPE

+ 15
- 0
01-build-executable Näytä tiedosto

@@ -0,0 +1,15 @@
#!/usr/bin/env sh

if [ "$BUILD_TYPE" = "" ]
then
echo "No build type specified. Try Debug or Release."
exit
fi

if [ "$EXECUTABLE" = "" ]
then
echo "No executable specified. Refer to CMakeLists.txt for available executables to build."
exit
fi

cmake --build "./build/$BUILD_TYPE" -t "$EXECUTABLE"

+ 0
- 3
01-build-game Näytä tiedosto

@@ -1,3 +0,0 @@
#!/usr/bin/env sh

cmake --build build/Debug -t game

+ 0
- 3
02-build-server Näytä tiedosto

@@ -1,3 +0,0 @@
#!/usr/bin/env sh

cmake --build build/Debug -t server

+ 7
- 0
03-run-tests Näytä tiedosto

@@ -0,0 +1,7 @@
#!/usr/bin/env sh

if [ "$BUILD_TYPE" = "" ]
then
return 1
fi
cmake --build "./build/$BUILD_TYPE" -t server

+ 10
- 10
CMakeLists.txt Näytä tiedosto

@@ -217,7 +217,7 @@ target_link_libraries(
)

add_executable(
game-test-geometry
test-game-geometry
subprojects/bdd-for-c/bdd-for-c.h
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

@@ -229,7 +229,7 @@ add_executable(
)

add_executable(
game-test-input
test-game-input
subprojects/bdd-for-c/bdd-for-c.h
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

@@ -265,13 +265,13 @@ add_executable(
)

target_link_libraries(
game-test-input
test-game-input
SDL2main
SDL2
)

add_executable(
game-test-output
test-game-output
subprojects/bdd-for-c/bdd-for-c.h
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

@@ -286,7 +286,7 @@ add_executable(
)

add_executable(
game-test-memory
test-game-memory
subprojects/bdd-for-c/bdd-for-c.h
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

@@ -310,13 +310,13 @@ add_executable(
)

target_link_libraries(
game-test-memory
test-game-memory
SDL2main
SDL2
)

add_executable(
game-test-data
test-game-data
subprojects/bdd-for-c/bdd-for-c.h
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

@@ -329,7 +329,7 @@ add_executable(
)

target_link_libraries(
game-test-data
test-game-data
SDL2main
SDL2
)
@@ -443,10 +443,10 @@ if (IZ_PLATFORM STREQUAL "WINDOWS")
"${CMAKE_HOME_DIRECTORY}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libcrypto-1_1-${IZ_SDL_ARCH}.dll"
$<TARGET_FILE_DIR:server>)

add_custom_command(TARGET game-test-input POST_BUILD
add_custom_command(TARGET test-game-input POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_HOME_DIRECTORY}/subprojects/SDL/VisualC/${IZ_SDL_ARCH}/${CMAKE_BUILD_TYPE}/SDL2.dll"
$<TARGET_FILE_DIR:game-test-input>)
$<TARGET_FILE_DIR:test-game-input>)
endif ()

add_custom_command(TARGET game POST_BUILD


+ 15
- 3
README.md Näytä tiedosto

@@ -31,7 +31,7 @@ The following are required for building on all platforms:

5. Generate the CMake cache.

```shell
```batch
cmake^
-DCMAKE_SIZEOF_VOID_P=8^
"-DCMAKE_MT=%CMAKE_MT%"^
@@ -48,6 +48,12 @@ The following are required for building on all platforms:

6. Build the specific executables you want to build, which are defined in `CMakeLists.txt`.

```batch
cmake^
--build "./build/%BUILD_TYPE%"^
-t "%EXECUTABLE%"
```

### macOS/*NIX

1. Ensure additional tools are present in the system:
@@ -64,15 +70,21 @@ The following are required for building on all platforms:
```shell
cmake \
-DCMAKE_SIZEOF_VOID_P=8 \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
"-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \
-DCMAKE_MAKE_PROGRAM=ninja \
-DCMAKE_C_COMPILER=cc \
-DCMAKE_C_FLAGS=-m64 \
-G Ninja \
-S . \
-B ./build/$BUILD_TYPE
-B "./build/$BUILD_TYPE"
```

> **Important:** Create the directories under `/build` per each `BUILD_TYPE` you are generating.
5. Build the specific executables you want to build, which are defined in `CMakeLists.txt`.

```shell
cmake \
--build "./build/$BUILD_TYPE" \
-t "$EXECUTABLE"
```

+ 2
- 0
TODO.md Näytä tiedosto

@@ -2,6 +2,8 @@
- [X] Unify memset/memcpy/free/malloc functions (remove SDL/lws dependency)
- [ ] Revisit unit tests
- [ ] Implement character sprites + animations
- [ ] Finalize initial character sprite for rendering
- [ ] Acquire Affinity Designer (so we can move on from Corel)
- [ ] Implement memory pool
- [ ] Fix gamepad mapping
- [ ] Provide default mapping


+ 6
- 5
src/packages/log/IZ_log.c Näytä tiedosto

@@ -48,16 +48,17 @@ void IZ_LogInitialize(const char* context, bool force_output) {
stderr_dest = stderr;
#else
const char* log_dir = "logs";
if (!IZ_isdir(log_dir)) {
IZ_mkdir(log_dir);
char base_log_dir[128];
sprintf(base_log_dir, "%s/%s", SDL_GetBasePath(), log_dir);
if (!IZ_isdir(base_log_dir)) {
IZ_mkdir(base_log_dir);
}
char stdout_filename[128] = "";
char stderr_filename[128] = "";
char* now = IZ_TimerNowPathSafe();

// fixme
sprintf(stdout_filename, "%s/%s-out-%s.log", log_dir, context, now);
sprintf(stderr_filename, "%s/%s-err-%s.log", log_dir, context, now);
sprintf(stdout_filename, "%s/%s-out-%s.log", base_log_dir, context, now);
sprintf(stderr_filename, "%s/%s-err-%s.log", base_log_dir, context, now);
IZ_fopen(&stdout_dest, stdout_filename, "a");
IZ_fopen(&stderr_dest, stderr_filename, "a");
#endif


+ 1
- 0
src/packages/log/IZ_log.h Näytä tiedosto

@@ -16,6 +16,7 @@
#define IZ_LOG_LEVEL_FLAG_WARN
#define IZ_LOG_LEVEL_FLAG_ERROR

#include <SDL_filesystem.h>
#if defined IZ_WINDOWS
#include <io.h>
#include <SDL_syswm.h>


+ 1
- 1
src/packages/stdinc/IZ_string.c Näytä tiedosto

@@ -26,7 +26,7 @@ errno_t IZ_strlwr(char* dest, const char* str, rsize_t str_size) {
}
return _strlwr_s(dest, str_size);
#else
memcpy(dest, str, str_size -1);
memcpy(dest, str, str_size - 1);
for (unsigned int i = 0; i < str_size; i += 1) {
if ('A' <= dest[i] && dest[i] <= 'Z') {
dest[i] += 0x20;


+ 1
- 1
subprojects/midi-utils

@@ -1 +1 @@
Subproject commit dc3396c806d500802cb8a8dad15d3e46a9621954
Subproject commit 04b34ae8ffd6527c0d9f87a09e96e09d0fc59f7f

Ladataan…
Peruuta
Tallenna