diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-07-03 00:49:03 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-03-30 08:20:20 +0200 |
| commit | 6b9f686913efc3725b2690033cd4f398e07076ba (patch) | |
| tree | e9aa91a6b9f617d78123ebe7ad272fc42a60d306 /src/system/sdl-1.2 | |
| parent | c9e6ae44a9aeb89b3f48f3443d6baa80103f7445 (diff) | |
| download | jancity-6b9f686913efc3725b2690033cd4f398e07076ba.tar.gz | |
Add project source code
Diffstat (limited to 'src/system/sdl-1.2')
| -rw-r--r-- | src/system/sdl-1.2/inc/system/port.h | 13 | ||||
| -rw-r--r-- | src/system/sdl-1.2/src/system.c | 36 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/system/sdl-1.2/inc/system/port.h b/src/system/sdl-1.2/inc/system/port.h new file mode 100644 index 0000000..3838026 --- /dev/null +++ b/src/system/sdl-1.2/inc/system/port.h @@ -0,0 +1,13 @@ +#ifndef INIT_SDL_1_2_H +#define INIT_SDL_1_2_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* INIT_SDL_H */ diff --git a/src/system/sdl-1.2/src/system.c b/src/system/sdl-1.2/src/system.c new file mode 100644 index 0000000..a738a75 --- /dev/null +++ b/src/system/sdl-1.2/src/system.c @@ -0,0 +1,36 @@ +#include <gfx.h> +#include <sfx.h> +#include <system.h> +#include <SDL/SDL.h> +#include <stdio.h> +#include <stdlib.h> + +void system_loop(void) +{ + SDL_PumpEvents(); +} + +void system_deinit(void) +{ + gfx_deinit(); + sfx_deinit(); + SDL_Quit(); +} + +int system_init(void) +{ + if (SDL_Init(0)) + { + fprintf(stderr, "SDL_Init: %s\n", SDL_GetError()); + goto failure; + } + else if (gfx_init() || sfx_init()) + goto failure; + + SDL_WM_SetCaption("rts", NULL); + return 0; + +failure: + system_deinit(); + return -1; +} |
