Compare commits
6 Commits
2125b27a82
...
d8e52a680e
Author | SHA1 | Date |
---|---|---|
Xavier Del Campo Romero | d8e52a680e | |
Xavier Del Campo Romero | 158ad29d14 | |
Xavier Del Campo Romero | a27a35bd77 | |
Xavier Del Campo Romero | c2e2343054 | |
Xavier Del Campo Romero | 2d8a171ad5 | |
Xavier Del Campo Romero | da42dfab9f |
|
@ -17,12 +17,14 @@ elseif(CMAKE_TOOLCHAIN_FILE MATCHES "win9x")
|
||||||
set(WIN9X_BUILD 1)
|
set(WIN9X_BUILD 1)
|
||||||
set(SDL1_2_BUILD 1)
|
set(SDL1_2_BUILD 1)
|
||||||
set(exec_flags WIN32)
|
set(exec_flags WIN32)
|
||||||
|
elseif(CMAKE_TOOLCHAIN_FILE MATCHES "esp32")
|
||||||
|
set(ESP32_BUILD 1)
|
||||||
else()
|
else()
|
||||||
set(HOST_BUILD 1)
|
set(HOST_BUILD 1)
|
||||||
set(SDL1_2_BUILD 1)
|
set(SDL1_2_BUILD 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${exec_flags} "src/main.c")
|
add_executable(${PROJECT_NAME} ${exec_flags})
|
||||||
|
|
||||||
if(SDL1_2_BUILD)
|
if(SDL1_2_BUILD)
|
||||||
find_package(SDL 1.2 REQUIRED)
|
find_package(SDL 1.2 REQUIRED)
|
||||||
|
@ -46,6 +48,8 @@ elseif(WIN9X_BUILD)
|
||||||
include("cmake/win9x.cmake")
|
include("cmake/win9x.cmake")
|
||||||
elseif(HOST_BUILD)
|
elseif(HOST_BUILD)
|
||||||
include("cmake/host.cmake")
|
include("cmake/host.cmake")
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
include("cmake/esp32.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory("res")
|
add_subdirectory("res")
|
||||||
|
|
28
README.md
28
README.md
|
@ -112,7 +112,7 @@ building `enet`.
|
||||||
A stripped version of the executable, as well as game assets, will be
|
A stripped version of the executable, as well as game assets, will be
|
||||||
located in `build/cdimg`.
|
located in `build/cdimg`.
|
||||||
|
|
||||||
#### Dependencies
|
##### Dependencies
|
||||||
|
|
||||||
A cross-compiled `i386-mingw32` version of all required dependencies
|
A cross-compiled `i386-mingw32` version of all required dependencies
|
||||||
is needed before building `jancity`.
|
is needed before building `jancity`.
|
||||||
|
@ -126,6 +126,32 @@ of this writing, so it is provisionally provided on
|
||||||
Read [the documentation](doc/BUILD-win9x.md) for further reference on
|
Read [the documentation](doc/BUILD-win9x.md) for further reference on
|
||||||
how to build the dependencies from source.
|
how to build the dependencies from source.
|
||||||
|
|
||||||
|
#### Espressif ESP32
|
||||||
|
|
||||||
|
```sh
|
||||||
|
. $IDF_PATH/export.sh
|
||||||
|
ENETDIR=<enet-prefix> \
|
||||||
|
cmake -B build -DCMAKE_TOOLCHAIN_FILE=cmake/win9x-toolchain.cmake
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
Where:
|
||||||
|
|
||||||
|
- `ENETDIR` is the path to the cross-compiled version for `enet`.
|
||||||
|
|
||||||
|
##### Dependencies
|
||||||
|
|
||||||
|
[`esp-idf`](https://github.com/espressif/esp-idf) is required to build this
|
||||||
|
or any ESP32-related project. The `release/v5.1` branch is assumed here.
|
||||||
|
As pointed out by
|
||||||
|
[their documentation](https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32/api-guides/build-system.html?highlight=idf_path#initialization),
|
||||||
|
remember to assign the `IDF_PATH` environment variable to the directory
|
||||||
|
where `esp-idf` is located.
|
||||||
|
|
||||||
|
`esp-idf` requires to build `enet` using a custom CMake wrapper on top of it.
|
||||||
|
For this project, this has been provided by the
|
||||||
|
[`enet-esp32`](https://gitea.privatedns.org/xavi/enet-esp32) repository.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Unless stated otherwise, **jancity** follows the license described by the
|
Unless stated otherwise, **jancity** follows the license described by the
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
set(cdroot ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
if(NOT DEFINED ENV{IDF_PATH})
|
||||||
|
message(FATAL_ERROR "Please define environment variable IDF_PATH")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
|
||||||
|
idf_build_process(esp32
|
||||||
|
BUILD_DIR ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
PRIVATE
|
||||||
|
idf::freertos
|
||||||
|
idf::spi_flash
|
||||||
|
idf::newlib
|
||||||
|
)
|
||||||
|
|
||||||
|
idf_build_executable(${PROJECT_NAME})
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/fetch-libfixmath.cmake")
|
||||||
|
add_subdirectory(libfixmath)
|
|
@ -37,6 +37,15 @@ function(sprite)
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME})
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME})
|
||||||
add_dependencies(${PROJECT_NAME} ${SPRITE_NAME}_img)
|
add_dependencies(${PROJECT_NAME} ${SPRITE_NAME}_img)
|
||||||
add_dependencies(${SPRITE_NAME}_img tools)
|
add_dependencies(${SPRITE_NAME}_img tools)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME}
|
||||||
|
COMMAND cp ${SPRITE_NAME}_24.bmp ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
DEPENDS ${SPRITE_NAME}_24.bmp
|
||||||
|
VERBATIM)
|
||||||
|
add_custom_target(${SPRITE_NAME}_img
|
||||||
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME})
|
||||||
|
add_dependencies(${PROJECT_NAME} ${SPRITE_NAME}_img)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -76,6 +85,9 @@ function(sound)
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOUND_NAME})
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOUND_NAME})
|
||||||
add_dependencies(${PROJECT_NAME} ${SOUND_NAME}_snd)
|
add_dependencies(${PROJECT_NAME} ${SOUND_NAME}_snd)
|
||||||
add_dependencies(${SOUND_NAME}_snd tools)
|
add_dependencies(${SOUND_NAME}_snd tools)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
add_custom_target(${SOUND_NAME}_snd
|
||||||
|
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${SOUND_NAME}.wav)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
|
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
|
||||||
set(cflags ${cflags} -Wall -g3 -ffunction-sections -fdata-sections -pedantic)
|
set(cflags ${cflags} -Wall -g3 -ffunction-sections -fdata-sections)
|
||||||
|
|
||||||
set(components
|
set(components
|
||||||
building
|
building
|
||||||
|
@ -13,6 +13,7 @@ set(components
|
||||||
input
|
input
|
||||||
instance
|
instance
|
||||||
keyboard
|
keyboard
|
||||||
|
main
|
||||||
menu
|
menu
|
||||||
mouse
|
mouse
|
||||||
net
|
net
|
||||||
|
@ -34,13 +35,18 @@ set(interfaces
|
||||||
|
|
||||||
target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
|
target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
|
||||||
# Dependencies for main.c
|
# Dependencies for main.c
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE system menu)
|
target_link_libraries(${PROJECT_NAME} PRIVATE main system menu)
|
||||||
|
|
||||||
foreach(c ${components})
|
foreach(c ${components})
|
||||||
add_subdirectory("${c}")
|
add_subdirectory("${c}")
|
||||||
target_compile_options(${c} PUBLIC ${cflags})
|
target_compile_options(${c} PUBLIC ${cflags})
|
||||||
target_compile_features(${c} PUBLIC c_std_99)
|
|
||||||
set_target_properties(${c} PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)
|
if(${c} STREQUAL "net" AND NOT ESP32_BUILD)
|
||||||
|
# ESP32 builds pull non-portable header files (e.g.: xt_utils.h).
|
||||||
|
set_target_properties(${c} PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)
|
||||||
|
target_compile_options(${c} PUBLIC -pedantic)
|
||||||
|
target_compile_features(${c} PUBLIC c_std_99)
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(i ${interfaces})
|
foreach(i ${interfaces})
|
||||||
|
|
|
@ -4,6 +4,8 @@ if(PS1_BUILD)
|
||||||
set(inc ${inc} "ps1/inc")
|
set(inc ${inc} "ps1/inc")
|
||||||
elseif(SDL1_2_BUILD)
|
elseif(SDL1_2_BUILD)
|
||||||
set(inc ${inc} "sdl-1.2/inc")
|
set(inc ${inc} "sdl-1.2/inc")
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(container "src/container.c")
|
add_library(container "src/container.c")
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef CONTAINER_ESP32_H
|
||||||
|
#define CONTAINER_ESP32_H
|
||||||
|
|
||||||
|
#define container_load(path, list, n) container_load_ex(path, list, n)
|
||||||
|
|
||||||
|
#endif /* CONTAINER_ESP32_H */
|
|
@ -26,6 +26,15 @@ elseif(SDL1_2_BUILD)
|
||||||
"sdl-1.2/src/quad.c")
|
"sdl-1.2/src/quad.c")
|
||||||
set(deps ${deps} SDL::SDL)
|
set(deps ${deps} SDL::SDL)
|
||||||
set(privdeps ${privdeps} header SDL::SDL_gfx)
|
set(privdeps ${privdeps} header SDL::SDL_gfx)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
|
set(privinc ${privinc} "esp32/privinc")
|
||||||
|
set(src ${src}
|
||||||
|
"esp32/src/env.c"
|
||||||
|
"esp32/src/line.c"
|
||||||
|
"esp32/src/rect.c"
|
||||||
|
"esp32/src/sprite.c"
|
||||||
|
"esp32/src/quad.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(gfx ${src})
|
add_library(gfx ${src})
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
#ifndef GFX_ESP32_H
|
||||||
|
#define GFX_ESP32_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#undef quad
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct sprite
|
||||||
|
{
|
||||||
|
short x, y, w, h;
|
||||||
|
unsigned char u, v;
|
||||||
|
bool transparent;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct quad
|
||||||
|
{
|
||||||
|
unsigned char r, g, b;
|
||||||
|
short x0, x1, x2, x3;
|
||||||
|
short y0, y1, y2, y3;
|
||||||
|
unsigned char u0, u1, u2, u3;
|
||||||
|
unsigned char v0, v1, v2, v3;
|
||||||
|
short w, h;
|
||||||
|
bool transparent;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct rect
|
||||||
|
{
|
||||||
|
unsigned char r, g, b;
|
||||||
|
short x, y, w, h;
|
||||||
|
bool stp;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct stp_4line
|
||||||
|
{
|
||||||
|
short x, y;
|
||||||
|
unsigned char r, g, b;
|
||||||
|
|
||||||
|
struct stp_4line_vtx
|
||||||
|
{
|
||||||
|
unsigned char r, g, b;
|
||||||
|
short x, y;
|
||||||
|
} vertices[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define common_get_or_ret(t, x, ret) \
|
||||||
|
struct t x##__, *const x = &x##__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GFX_ESP32_H */
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef GFX_ESP32_PRIVATE_H
|
||||||
|
#define GFX_ESP32_PRIVATE_H
|
||||||
|
|
||||||
|
#include <gfx.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SCREEN_W = 320,
|
||||||
|
SCREEN_H = 240
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GFX_ESP32_PRIVATE_H */
|
|
@ -0,0 +1,61 @@
|
||||||
|
#include <gfx.h>
|
||||||
|
#include <gfx_private.h>
|
||||||
|
#include <esp32/gfx_private.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int screen_w = SCREEN_W, screen_h = SCREEN_H;
|
||||||
|
|
||||||
|
void gfx_deinit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int gfx_display_size(short *const w, short *const h)
|
||||||
|
{
|
||||||
|
*w = SCREEN_W;
|
||||||
|
*h = SCREEN_H;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gfx_init(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gfx_inside_drawenv(const short x, const short y, const short w,
|
||||||
|
const short h)
|
||||||
|
{
|
||||||
|
return (x + w >= 0)
|
||||||
|
&& x < screen_w
|
||||||
|
&& (y + h >= 0)
|
||||||
|
&& y < screen_h;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gfx_toggle_fullscreen(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gfx_set_fullscreen(const short w, const short h)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gfx_fullscreen_available(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gfx_fullscreen(void)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gfx_draw(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include <gfx.h>
|
||||||
|
#include <gfx/port.h>
|
||||||
|
#include <esp32/gfx_private.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
void stp_4line_init(struct stp_4line *const l)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void semitrans_stp_4line_init(struct stp_4line *r)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int stp_4line_sort(struct stp_4line *const r)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include <gfx.h>
|
||||||
|
#include <gfx/port.h>
|
||||||
|
#include <esp32/gfx_private.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#undef quad
|
||||||
|
|
||||||
|
int quad_from_sprite(const struct sprite *const s, struct quad *const q)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int quad_sort(struct quad *const q)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include <gfx.h>
|
||||||
|
#include <gfx/port.h>
|
||||||
|
#include <esp32/gfx_private.h>
|
||||||
|
|
||||||
|
int rect_sort(struct rect *const r)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rect_init(struct rect *const r)
|
||||||
|
{
|
||||||
|
*r = (const struct rect){0};
|
||||||
|
}
|
||||||
|
|
||||||
|
void semitrans_rect_init(struct rect *const r)
|
||||||
|
{
|
||||||
|
rect_init(r);
|
||||||
|
r->stp = true;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <gfx.h>
|
||||||
|
#include <gfx/port.h>
|
||||||
|
#include <esp32/gfx_private.h>
|
||||||
|
|
||||||
|
void sprite_free(struct sprite *const s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int sprite_clone(const struct sprite *const src, struct sprite *const dst)
|
||||||
|
{
|
||||||
|
*dst = *src;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sprite_from_fp(struct sprite *const s, FILE *const f)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sprite_sort(struct sprite *const s)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef GFX_H
|
#ifndef GFX_H
|
||||||
#define GFX_H
|
#define GFX_H
|
||||||
|
|
||||||
#include <gfx/port.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <gfx/port.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
|
@ -9,6 +9,9 @@ elseif(SDL1_2_BUILD)
|
||||||
set(src ${src} "sdl-1.2/src/keyboard.c")
|
set(src ${src} "sdl-1.2/src/keyboard.c")
|
||||||
set(inc ${inc} "sdl-1.2/inc")
|
set(inc ${inc} "sdl-1.2/inc")
|
||||||
set(privdeps ${privdeps} SDL::SDL)
|
set(privdeps ${privdeps} SDL::SDL)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(src ${src} "esp32/src/keyboard.c")
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(keyboard ${src})
|
add_library(keyboard ${src})
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef KEYBOARD_SDL_1_2_H
|
||||||
|
#define KEYBOARD_SDL_1_2_H
|
||||||
|
|
||||||
|
#include <keyboard.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct keyboard_port
|
||||||
|
{
|
||||||
|
int dummy;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* KEYBOARD_SDL_1_2_H */
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include <keyboard.h>
|
||||||
|
#include <keyboard/port.h>
|
||||||
|
#include <keyboard/key.h>
|
||||||
|
|
||||||
|
void keyboard_update(struct keyboard *const k)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool keyboard_available(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
add_library(main "src/main.c")
|
||||||
|
target_include_directories(main PUBLIC "inc")
|
||||||
|
target_link_libraries(main PRIVATE menu system)
|
||||||
|
|
||||||
|
if(ESP32_BUILD)
|
||||||
|
target_sources(${PROJECT_NAME} PRIVATE "esp32/src/main.c")
|
||||||
|
else()
|
||||||
|
target_sources(${PROJECT_NAME} PRIVATE "std/src/main.c")
|
||||||
|
endif()
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include <engine_main.h>
|
||||||
|
|
||||||
|
void app_main(void)
|
||||||
|
{
|
||||||
|
engine_main();
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef MAIN_PRIVATE_H
|
||||||
|
#define MAIN_PRIVATE_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int engine_main(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* MAIN_PRIVATE_H */
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <engine_main.h>
|
||||||
|
#include <menu.h>
|
||||||
|
#include <system.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int engine_main(void)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (system_init() || menu())
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
system_deinit();
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -7,6 +7,8 @@ if(PS1_BUILD)
|
||||||
elseif(SDL1_2_BUILD)
|
elseif(SDL1_2_BUILD)
|
||||||
set(src ${src} "sdl-1.2/src/mouse.c")
|
set(src ${src} "sdl-1.2/src/mouse.c")
|
||||||
set(privdeps ${privdeps} SDL::SDL)
|
set(privdeps ${privdeps} SDL::SDL)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(src ${src} "esp32/src/mouse.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(mouse ${src})
|
add_library(mouse ${src})
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include <mouse.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
void mouse_update(struct mouse *const m)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mouse_available(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ else()
|
||||||
|
|
||||||
if(WIN9X_BUILD OR ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
if(WIN9X_BUILD OR ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
set(src ${src} "win9x/src/serial.c")
|
set(src ${src} "win9x/src/serial.c")
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
|
||||||
|
set(priv_deps ${priv_deps} idf::lwip idf::esp_phy)
|
||||||
else()
|
else()
|
||||||
# Assume POSIX if the command below executes successfully
|
# Assume POSIX if the command below executes successfully
|
||||||
execute_process(COMMAND uname -m RESULT_VARIABLE result OUTPUT_QUIET)
|
execute_process(COMMAND uname -m RESULT_VARIABLE result OUTPUT_QUIET)
|
||||||
|
|
|
@ -10,6 +10,9 @@ elseif(SDL1_2_BUILD)
|
||||||
set(src ${src} "sdl-1.2/src/pad.c")
|
set(src ${src} "sdl-1.2/src/pad.c")
|
||||||
set(inc ${inc} "sdl-1.2/inc")
|
set(inc ${inc} "sdl-1.2/inc")
|
||||||
set(deps ${deps} SDL::SDL)
|
set(deps ${deps} SDL::SDL)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(src ${src} "esp32/src/pad.c")
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(pad ${src})
|
add_library(pad ${src})
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef PAD_ESP32_H
|
||||||
|
#define PAD_ESP32_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct pad_port
|
||||||
|
{
|
||||||
|
int dummy;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PAD_SDL_1_2_H */
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include <pad.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void pad_port_update(struct pad *const p)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void pad_init(const int id, struct pad *const p)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t pad_count(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *pad_name(const int id)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
enum {X_OFF = 8, Y_OFF = 8};
|
enum {X_OFF = 8, Y_OFF = 8};
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ static void on_add_walker(void *const arg)
|
||||||
it->show = false;
|
it->show = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_exit(void *const arg)
|
static void on_btn_exit(void *const arg)
|
||||||
{
|
{
|
||||||
struct human_player *const h = arg;
|
struct human_player *const h = arg;
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ static void update_items(struct human_player *const h)
|
||||||
b->u.type1.w = 80;
|
b->u.type1.w = 80;
|
||||||
b->common.hcentered = true;
|
b->common.hcentered = true;
|
||||||
b->u.type1.label.text = "Exit";
|
b->u.type1.label.text = "Exit";
|
||||||
b->on_pressed = on_exit;
|
b->on_pressed = on_btn_exit;
|
||||||
b->arg = h;
|
b->arg = h;
|
||||||
gui_add_child(&it->topcnt.common, &b->common);
|
gui_add_child(&it->topcnt.common, &b->common);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <unit.h>
|
#include <unit.h>
|
||||||
#include <terrain.h>
|
#include <terrain.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
void player_update(struct player *const p)
|
void player_update(struct player *const p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,8 @@ if(PS1_BUILD)
|
||||||
set(inc ${inc} "ps1/inc")
|
set(inc ${inc} "ps1/inc")
|
||||||
elseif(SDL1_2_BUILD)
|
elseif(SDL1_2_BUILD)
|
||||||
set(inc ${inc} "sdl-1.2/inc")
|
set(inc ${inc} "sdl-1.2/inc")
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(settings PUBLIC ${inc})
|
target_include_directories(settings PUBLIC ${inc})
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef SETTINGS_PORT_H
|
||||||
|
#define SETTINGS_PORT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define settings_load(...) settings_load_ex(__VA_ARGS__)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SETTINGS_PORT_H */
|
|
@ -11,6 +11,10 @@ elseif(SDL1_2_BUILD)
|
||||||
set(inc ${inc} "sdl-1.2/inc")
|
set(inc ${inc} "sdl-1.2/inc")
|
||||||
set(deps ${deps} SDL::SDL_mixer)
|
set(deps ${deps} SDL::SDL_mixer)
|
||||||
set(privdeps ${privdeps} SDL::SDL header)
|
set(privdeps ${privdeps} SDL::SDL header)
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(src
|
||||||
|
"esp32/src/sound.c")
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(sfx ${src})
|
add_library(sfx ${src})
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef SFX_ESP32_H
|
||||||
|
#define SFX_ESP32_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct sound
|
||||||
|
{
|
||||||
|
bool loop;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SFX_SDL1_2_H */
|
|
@ -0,0 +1,28 @@
|
||||||
|
#include <sfx.h>
|
||||||
|
#include <sfx/port.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void sfx_free(struct sound *const s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int sfx_play(const struct sound *const s)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sfx_sound_from_fp(struct sound *const s, FILE *const f, const size_t sz)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sfx_deinit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int sfx_init(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -17,6 +17,10 @@ elseif(SDL1_2_BUILD)
|
||||||
else()
|
else()
|
||||||
set(src ${src} "sdl-1.2/src/stubs.c")
|
set(src ${src} "sdl-1.2/src/stubs.c")
|
||||||
endif()
|
endif()
|
||||||
|
elseif(ESP32_BUILD)
|
||||||
|
set(src "esp32/src/system.c")
|
||||||
|
set(inc ${inc} "esp32/inc")
|
||||||
|
set(privinc ${privinc} "esp32/privinc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(system ${src})
|
add_library(system ${src})
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef INIT_ESP32_H
|
||||||
|
#define INIT_ESP32_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* INIT_SDL_H */
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef SYSTEM_PRIVATE_H
|
||||||
|
#define SYSTEM_PRIVATE_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int system_init_os(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SYSTEM_PRIVATE_H */
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include <system_private.h>
|
||||||
|
|
||||||
|
int system_init_os(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include <system.h>
|
||||||
|
#include <system_private.h>
|
||||||
|
#include <gfx.h>
|
||||||
|
#include <net.h>
|
||||||
|
#include <sfx.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
bool system_can_exit(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_loop(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_deinit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int system_init(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
#include <terrain.h>
|
#include <terrain.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -8,5 +8,8 @@ endif()
|
||||||
|
|
||||||
add_library(transport ${src})
|
add_library(transport ${src})
|
||||||
target_include_directories(transport PUBLIC "inc" PRIVATE "privinc")
|
target_include_directories(transport PUBLIC "inc" PRIVATE "privinc")
|
||||||
enable_testing()
|
|
||||||
add_subdirectory(test)
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue