2.1 KiB
2.1 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.hand implement the required functions defined in os.h:
OS_GetTimeOS_SleepOS_BasenameOS_GetFirstFileInDirectoryOS_GetNextFileInDirectoryOS_IsDebuggerPresentOS_InstallSignalHandler
- Update
src/harness/CMakeLists.hand 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)
An IOPlatform in dethrace implements windowing and input handling, and points to a renderer.
The default IO platform is SDL_OpenGL, which uses SDL for windowing and input, and OpenGL for rendering. See io_platforms/sdl_gl.c.
To add a new IOPlatform:
- Create
io_platforms/my_platform.cfile and implement the required functions defined in io_platforms/io_platform.h:
Window_CreateWindow_PollEventsWindow_SwapInput_GetKeyMapInput_IsKeyDown
Window_Create returns a tRenderer*, which must implement the interface defined in renderers/renderer.h. See renderers/gl for an example.
- Add a new conditional section in
src/harness/CMakeLists.txtfor 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 .