Configure environment for Linux. Server runs ok, the game runs but with no window...master
@@ -9,6 +9,8 @@ if (WIN32) | |||||
# TODO set arch on target instead of generator | # TODO set arch on target instead of generator | ||||
set(IZ_PLATFORM WINDOWS) | set(IZ_PLATFORM WINDOWS) | ||||
set(IZ_CRYPTO_LIBRARIES libcrypto libssl) | set(IZ_CRYPTO_LIBRARIES libcrypto libssl) | ||||
set(IZ_GETOPT_DEPENDENCIES dependencies/getopt-for-windows/getopt.h | |||||
dependencies/getopt-for-windows/getopt.c) | |||||
add_definitions( | add_definitions( | ||||
-DIZ_WINDOWS | -DIZ_WINDOWS | ||||
) | ) | ||||
@@ -93,6 +95,16 @@ elseif(IZ_PLATFORM STREQUAL "MACOS") | |||||
/usr/local/include/openssl | /usr/local/include/openssl | ||||
) | ) | ||||
link_directories( | |||||
/usr/local/lib | |||||
) | |||||
elseif(IZ_PLATFORM STREQUAL "UNIX") | |||||
include_directories( | |||||
/usr/local/include | |||||
/usr/local/include/SDL2 | |||||
/usr/local/include/openssl | |||||
) | |||||
link_directories( | link_directories( | ||||
/usr/local/lib | /usr/local/lib | ||||
) | ) | ||||
@@ -106,8 +118,7 @@ add_executable( | |||||
${IZ_EXECUTABLE_TYPE} | ${IZ_EXECUTABLE_TYPE} | ||||
dependencies/minIni/dev/minIni.h | dependencies/minIni/dev/minIni.h | ||||
dependencies/minIni/dev/minIni.c | dependencies/minIni/dev/minIni.c | ||||
dependencies/getopt-for-windows/getopt.h | |||||
dependencies/getopt-for-windows/getopt.c | |||||
${IZ_GETOPT_DEPENDENCIES} | |||||
src/packages/game/output/video/IZ_video.h | src/packages/game/output/video/IZ_video.h | ||||
src/packages/game/output/video/IZ_video.c | src/packages/game/output/video/IZ_video.c | ||||
src/packages/common/IZ_common.h | src/packages/common/IZ_common.h | ||||
@@ -20,11 +20,25 @@ A run-and-gun shooter inspired by Metal Slug. | |||||
1. Clone this repo. | 1. Clone this repo. | ||||
2. Clone the repositories under `dependencies.txt`, including SDL2. | 2. Clone the repositories under `dependencies.txt`, including SDL2. | ||||
3. Build the SDL, SDL_image, and SDL_ttf dependencies using the [build instructions for macOS](https://wiki.libsdl.org/SDL2/Installation#macos). | |||||
> **Note:** You may need to download other tools to build the libraries. | |||||
> **Note:** Clone the submodules under SDL_ttf to download freetype and harfbuzz | |||||
4. Build the following dependencies first: | |||||
- `portmidi` | |||||
- `libwebsockets` (follow the [instructions on building LWS](https://libwebsockets.org/lws-api-doc-master/html/md_README_8build.html)) | |||||
5. Build via CMake. | |||||
3. Build the SDL, SDL_image, and SDL_ttf dependencies using the [build instructions for Linux/UNIX](https://wiki.libsdl.org/SDL2/Installation#linuxunix) | |||||
or [build instructions for macOS](https://wiki.libsdl.org/SDL2/Installation#macos). | |||||
> **Note:** You may need to download other tools to build the libraries: | |||||
> - autoconf | |||||
> - make | |||||
> **Note:** Clone the submodules under SDL_ttf to download freetype and harfbuzz: | |||||
> | |||||
> ```shell | |||||
> git submodule update --init --recursive | |||||
> ``` | |||||
4. For OpenSSL, simply run: | |||||
```shell | |||||
./Configure | |||||
make | |||||
make test | |||||
``` | |||||
5. Build the following dependencies first: | |||||
- `portmidi` (Linux needs [ALSA libraries](https://www.alsa-project.org/files/pub/lib/) to be compiled) | |||||
- ALSA Lib requires `libtool` to be compiled. | |||||
- `libwebsockets` (follow the [instructions on building LWS](https://libwebsockets.org/lws-api-doc-master/html/md_README_8build.html)) | |||||
6. Build via CMake. |
@@ -10,3 +10,4 @@ https://libwebsockets.org/repo/libwebsockets | |||||
https://github.com/openssl/openssl | https://github.com/openssl/openssl | ||||
https://www.sqlite.org/download.html (use SQLite amalgamated source code, unpack into `sqlite` directory) | https://www.sqlite.org/download.html (use SQLite amalgamated source code, unpack into `sqlite` directory) | ||||
https://code.modal.sh/TheoryOfNekomata/bdd-for-c-mocks | https://code.modal.sh/TheoryOfNekomata/bdd-for-c-mocks | ||||
git://git.alsa-project.org/alsa-lib.git (linux/unix) |
@@ -3,6 +3,7 @@ | |||||
#ifndef IZ_WINDOWS | #ifndef IZ_WINDOWS | ||||
typedef int errno_t; | typedef int errno_t; | ||||
typedef unsigned int rsize_t; | |||||
#else | #else | ||||
#include <io.h> | #include <io.h> | ||||
#include <SDL_syswm.h> | #include <SDL_syswm.h> | ||||
@@ -4,6 +4,10 @@ | |||||
#define IZ_DEBUG_CONNECT SDLK_PAGEUP | #define IZ_DEBUG_CONNECT SDLK_PAGEUP | ||||
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN | #define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN | ||||
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT | #define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT | ||||
#elif IZ_UNIX | |||||
#define IZ_DEBUG_CONNECT SDLK_PAGEUP | |||||
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN | |||||
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT | |||||
#elif IZ_MACOS | #elif IZ_MACOS | ||||
#define IZ_DEBUG_CONNECT SDLK_EQUALS | #define IZ_DEBUG_CONNECT SDLK_EQUALS | ||||
#define IZ_DEBUG_DISCONNECT SDLK_MINUS | #define IZ_DEBUG_DISCONNECT SDLK_MINUS | ||||
@@ -87,6 +87,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con | |||||
IZ_LogError("video", "Window could not be created! Reason: %s", SDL_GetError()); | IZ_LogError("video", "Window could not be created! Reason: %s", SDL_GetError()); | ||||
return -3; | return -3; | ||||
} | } | ||||
SDL_ShowWindow(window); | |||||
state->window = window; | state->window = window; | ||||
state->renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); | state->renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); | ||||
return 0; | return 0; | ||||
@@ -47,13 +47,8 @@ bool IZ_isdir(const char* path) { | |||||
struct stat s; | struct stat s; | ||||
int err = stat("/path/to/possible_dir", &s); | int err = stat("/path/to/possible_dir", &s); | ||||
if(-1 == err) { | if(-1 == err) { | ||||
if(ENOENT == errno) { | |||||
return false; | return false; | ||||
} | |||||
perror("stat"); | |||||
exit(1);\ | |||||
return; | |||||
} | } | ||||
return (S_ISDIR(s.st_mode)) | |||||
return (S_ISDIR(s.st_mode)); | |||||
#endif | #endif | ||||
} | } |
@@ -5,6 +5,9 @@ | |||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include "../compat/IZ_windows.h" | #include "../compat/IZ_windows.h" | ||||
#ifdef IZ_UNIX | |||||
#include <sys/stat.h> | |||||
#endif | |||||
int IZ_sprintf(char*, size_t, const char*, ...); | int IZ_sprintf(char*, size_t, const char*, ...); | ||||
@@ -21,6 +21,7 @@ | |||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include <stdlib.h> | |||||
#include "../timer/IZ_timer.h" | #include "../timer/IZ_timer.h" | ||||
#include "../io/IZ_io.h" | #include "../io/IZ_io.h" | ||||
#include "../stdinc/IZ_string.h" | #include "../stdinc/IZ_string.h" | ||||