1.6 KiB
1.6 KiB
Porting Dethrace to other systems
Operating Systems
Assuming an operating system called foo, follow the steps to add support for it.
- Add a new file
os/foo.h
and implement the required functions defined in os.h:
OS_InstallSignalHandler
OS_fopen
OS_ConsoleReadPassword
- Update
src/harness/CMakeLists.h
and add a new conditional section for "os/foo.h", based on existing conditions for Windows, MacOS etc.
For example:
...
elseif( _FOO_ )
target_sources(harness PRIVATE
os/foo.c
)
...
IO Platform (windowing / input / rendering)
A Platform
in dethrace implements windowing, rendering and input handling.
The default platform is SDL_OpenGL
, which uses SDL for windowing and input, and OpenGL for rendering. See platforms/sdl_opengl.c.
To add a new Platform
:
-
Create
platforms/my_platform.c
file and add aHarness_Platform_Init
function. Hook up all the function pointers using thesdl_opengl
implementation as a guide. -
Add a new conditional section in
src/harness/CMakeLists.txt
for your new platform
For example:
if (IO_PLATFORM STREQUAL "My_Platform")
target_sources(harness PRIVATE
io_platforms/my_platform.c
)
endif()
- Run cmake to update your build with the new platform
cd build
cmake -DIO_PLATFORM=My_Platform ..
- Build
cmake --build .