# HG changeset patch # User David Demelier # Date 1602849271 -7200 # Node ID c3a40062acc260dbacbe2239001fcf035a3c925f # Parent 13b7a1a4a72c7def771147c26178d9e63885ea1a misc: create more generic startup function, closes #2500 diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-action.c --- a/examples/example-action.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-action.c Fri Oct 16 13:54:31 2020 +0200 @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -33,8 +34,10 @@ #include #include +#include #include +#include #include #include @@ -315,9 +318,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Action", W, H) || - !theme_init()) + if (!core_init() || !ui_init() || !rpg_init()) + panic(); + if (!window_open("Example - Action", W, H)) panic(); guide_init(); @@ -365,9 +368,10 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + rpg_finish(); + ui_finish(); + core_finish(); } int diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-debug.c --- a/examples/example-debug.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-debug.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include +#include #define W 1280 #define H 720 @@ -34,9 +36,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Debug", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) + panic(); + if (!window_open("Example - Debug", W, H)) panic(); debug_options.enable = true; @@ -84,9 +86,9 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + ui_finish(); + core_finish(); } int diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-drawable.c --- a/examples/example-drawable.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-drawable.c Fri Oct 16 13:54:31 2020 +0200 @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include #include +#include #include @@ -66,9 +68,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Drawable", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) + panic(); + if (!window_open("Example - Drawable", W, H)) panic(); /* 0: Explosion animation. */ @@ -153,7 +155,9 @@ static void quit(void) { - + window_finish(); + ui_finish(); + core_finish(); } int diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-font.c --- a/examples/example-font.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-font.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include +#include #define W (1280) #define H (720) @@ -46,9 +48,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Font", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) + panic(); + if (!window_open("Example - Font", W, H)) panic(); } @@ -118,9 +120,9 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + ui_finish(); + core_finish(); } int diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-inventory.c --- a/examples/example-inventory.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-inventory.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -27,10 +28,12 @@ #include #include +#include #include #include #include +#include /* https://shikashiassets.itch.io/shikashis-fantasy-icons-pack */ #include @@ -78,9 +81,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Inventory", W, H) || - !theme_init()) + if (!core_init() || !ui_init() || !rpg_init()) + panic(); + if (!window_open("Example - Inventory", W, H)) panic(); for (size_t i = 0; i < NELEM(items); ++i) { @@ -94,9 +97,10 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + rpg_finish(); + ui_finish(); + core_finish(); } static void diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-label.c --- a/examples/example-label.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-label.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #define W (1280) #define H (720) @@ -95,9 +97,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Label", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) + panic(); + if (!window_open("Example - Label", W, H)) panic(); for (size_t i = 0; i < NELEM(table); ++i) { @@ -111,9 +113,9 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + ui_finish(); + core_finish(); } static void diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-message.c --- a/examples/example-message.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-message.c Fri Oct 16 13:54:31 2020 +0200 @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -28,8 +29,10 @@ #include #include +#include #include +#include #define W (1280) #define H (720) @@ -42,18 +45,19 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Message", W, H) || - !theme_init()) + if (!core_init() || !ui_init() || !rpg_init()) + panic(); + if (!window_open("Example - Message", W, H)) panic(); } static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + rpg_finish(); + ui_finish(); + core_finish(); } static void diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-sound.c --- a/examples/example-sound.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-sound.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include +#include /* https://freesound.org/people/VABsounds/sounds/423658 */ #include @@ -45,11 +47,10 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Sound", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) panic(); - + if (!window_open("Example - Sound", W, H)) + panic(); if (!sound_openmem(&sound, sounds_vabsounds_romance, sizeof (sounds_vabsounds_romance))) panic(); } @@ -57,9 +58,9 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + ui_finish(); + core_finish(); } static void diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-trace.c --- a/examples/example-trace.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-trace.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include +#include #include @@ -35,9 +37,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - Trace", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) + panic(); + if (!window_open("Example - Trace", W, H)) panic(); trace_handler = trace_hud_handler; @@ -92,9 +94,9 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + ui_finish(); + core_finish(); } int diff -r 13b7a1a4a72c -r c3a40062acc2 examples/example-ui.c --- a/examples/example-ui.c Fri Oct 16 13:15:04 2020 +0200 +++ b/examples/example-ui.c Fri Oct 16 13:54:31 2020 +0200 @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #define W (1280) #define H (720) @@ -126,9 +128,9 @@ static void init(void) { - if (!sys_init() || - !window_init("Example - UI", W, H) || - !theme_init()) + if (!core_init() || !ui_init()) + panic(); + if (!window_open("Example - UI", W, H)) panic(); } @@ -283,9 +285,9 @@ static void quit(void) { - theme_finish(); window_finish(); - sys_finish(); + ui_finish(); + core_finish(); } int diff -r 13b7a1a4a72c -r c3a40062acc2 libadventure/adventure/panic_state.h --- a/libadventure/adventure/panic_state.h Fri Oct 16 13:15:04 2020 +0200 +++ b/libadventure/adventure/panic_state.h Fri Oct 16 13:54:31 2020 +0200 @@ -36,8 +36,9 @@ * memory allocation errors. * * \note You must still initialize the system before. - * \see \ref sys_init - * \see \ref window_init + * \see \ref core_init + * \see \ref ui_init + * \see \ref window_open */ void panic_state_init(void); diff -r 13b7a1a4a72c -r c3a40062acc2 libcore/CMakeLists.txt --- a/libcore/CMakeLists.txt Fri Oct 16 13:15:04 2020 +0200 +++ b/libcore/CMakeLists.txt Fri Oct 16 13:54:31 2020 +0200 @@ -27,6 +27,8 @@ ${libcore_SOURCE_DIR}/core/clock.c ${libcore_SOURCE_DIR}/core/clock.h ${libcore_SOURCE_DIR}/core/color.h + ${libcore_SOURCE_DIR}/core/core.c + ${libcore_SOURCE_DIR}/core/core.h ${libcore_SOURCE_DIR}/core/drawable.c ${libcore_SOURCE_DIR}/core/drawable.h ${libcore_SOURCE_DIR}/core/error.c diff -r 13b7a1a4a72c -r c3a40062acc2 libcore/core/core.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcore/core/core.c Fri Oct 16 13:54:31 2020 +0200 @@ -0,0 +1,32 @@ +/* + * core.c -- libcore convenient header + * + * Copyright (c) 2020 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "core.h" +#include "sys.h" + +bool +core_init(void) +{ + return sys_init(); +} + +void +core_finish(void) +{ + sys_finish(); +} diff -r 13b7a1a4a72c -r c3a40062acc2 libcore/core/core.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcore/core/core.h Fri Oct 16 13:54:31 2020 +0200 @@ -0,0 +1,43 @@ +/* + * core.h -- libcore convenient header + * + * Copyright (c) 2020 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef MOLKO_CORE_H +#define MOLKO_CORE_H + +/** + * \file core.h + * \brief libcore convenient header. + */ + +#include + +/** + * Initialize the core library. + * + * \return False on errors. + */ +bool +core_init(void); + +/** + * Close the core library. + */ +void +core_finish(void); + +#endif /* !MOLKO_CORE_H */ diff -r 13b7a1a4a72c -r c3a40062acc2 libcore/core/sys.h --- a/libcore/core/sys.h Fri Oct 16 13:15:04 2020 +0200 +++ b/libcore/core/sys.h Fri Oct 16 13:54:31 2020 +0200 @@ -28,8 +28,15 @@ #include #include +#include "plat.h" + /** - * Initialize the system, should be called in the beginning of the main. + * Initialize the system. + * + * This function is automatically called from \ref core_init and thus not + * necessary from user. + * + * \return False on error. */ bool sys_init(void); @@ -50,7 +57,7 @@ * \note This function returns pointer to static string. */ const char * -sys_datapath(const char *fmt, ...); +sys_datapath(const char *fmt, ...) PLAT_PRINTF(1, 2); /** * Similar to \a sys_datapath. @@ -61,7 +68,7 @@ * \note This function returns pointer to static string. */ const char * -sys_datapathv(const char *fmt, va_list ap); +sys_datapathv(const char *fmt, va_list ap) PLAT_PRINTF(1, 0); /** * Compute the path to the save file for the given game state. @@ -76,6 +83,9 @@ /** * Close the system. + * + * This function is automatically called from \ref core_finish and thus not + * necessary from user. */ void sys_finish(void); diff -r 13b7a1a4a72c -r c3a40062acc2 libcore/core/window.c --- a/libcore/core/window.c Fri Oct 16 13:15:04 2020 +0200 +++ b/libcore/core/window.c Fri Oct 16 13:54:31 2020 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include @@ -34,7 +35,7 @@ }; bool -window_init(const char *title, unsigned int w, unsigned int h) +window_open(const char *title, unsigned int w, unsigned int h) { assert(title); @@ -57,4 +58,6 @@ SDL_DestroyRenderer(handle.renderer); if (handle.win) SDL_DestroyWindow(handle.win); + + memset(&handle, 0, sizeof (handle)); } diff -r 13b7a1a4a72c -r c3a40062acc2 libcore/core/window.h --- a/libcore/core/window.h Fri Oct 16 13:15:04 2020 +0200 +++ b/libcore/core/window.h Fri Oct 16 13:54:31 2020 +0200 @@ -51,7 +51,7 @@ * \return true on success */ bool -window_init(const char *title, unsigned int width, unsigned int height); +window_open(const char *title, unsigned int width, unsigned int height); /** * Close the window and destroy associated resources. diff -r 13b7a1a4a72c -r c3a40062acc2 librpg/CMakeLists.txt --- a/librpg/CMakeLists.txt Fri Oct 16 13:15:04 2020 +0200 +++ b/librpg/CMakeLists.txt Fri Oct 16 13:54:31 2020 +0200 @@ -31,6 +31,8 @@ ${librpg_SOURCE_DIR}/rpg/map_state.h ${librpg_SOURCE_DIR}/rpg/message.c ${librpg_SOURCE_DIR}/rpg/message.h + ${librpg_SOURCE_DIR}/rpg/rpg.c + ${librpg_SOURCE_DIR}/rpg/rpg.h ${librpg_SOURCE_DIR}/rpg/walksprite.c ${librpg_SOURCE_DIR}/rpg/walksprite.h ) diff -r 13b7a1a4a72c -r c3a40062acc2 librpg/rpg/rpg.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/librpg/rpg/rpg.c Fri Oct 16 13:54:31 2020 +0200 @@ -0,0 +1,34 @@ +/* + * rpg.c -- librpg convenient header + * + * Copyright (c) 2020 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "rpg.h" + +bool +rpg_init(void) +{ + /* Currently empty, placeholder for future. */ + return true; +} + +/** + * Close the rpg library. + */ +void +rpg_finish(void) +{ +} diff -r 13b7a1a4a72c -r c3a40062acc2 librpg/rpg/rpg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/librpg/rpg/rpg.h Fri Oct 16 13:54:31 2020 +0200 @@ -0,0 +1,43 @@ +/* + * rpg.h -- librpg convenient header + * + * Copyright (c) 2020 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef MOLKO_RPG_H +#define MOLKO_RPG_H + +/** + * \file rpg.h + * \brief librpg convenient header + */ + +#include + +/** + * Initialize the rpg library. + * + * \return False on errors. + */ +bool +rpg_init(void); + +/** + * Close the rpg library. + */ +void +rpg_finish(void); + +#endif /* !MOLKO_RPG_H */ diff -r 13b7a1a4a72c -r c3a40062acc2 libui/CMakeLists.txt --- a/libui/CMakeLists.txt Fri Oct 16 13:15:04 2020 +0200 +++ b/libui/CMakeLists.txt Fri Oct 16 13:54:31 2020 +0200 @@ -40,6 +40,8 @@ ${libui_SOURCE_DIR}/ui/label.h ${libui_SOURCE_DIR}/ui/theme.c ${libui_SOURCE_DIR}/ui/theme.h + ${libui_SOURCE_DIR}/ui/ui.c + ${libui_SOURCE_DIR}/ui/ui.h ) molko_define_library( diff -r 13b7a1a4a72c -r c3a40062acc2 libui/ui/theme.h --- a/libui/ui/theme.h Fri Oct 16 13:15:04 2020 +0200 +++ b/libui/ui/theme.h Fri Oct 16 13:54:31 2020 +0200 @@ -107,8 +107,10 @@ /** * Initialize the theming system. * - * \return false on errors - * \warning This function must be called before any other theme functions. + * This function is automatically called from \ref ui_init and thus not + * necessary from user. + * + * \return False on error. */ bool theme_init(void); @@ -178,7 +180,8 @@ theme_draw_checkbox(struct theme *t, const struct checkbox *cb); /** - * Close associated resources. + * This function is automatically called from \ref ui_finish and thus not + * necessary from user. */ void theme_finish(void); diff -r 13b7a1a4a72c -r c3a40062acc2 libui/ui/ui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libui/ui/ui.c Fri Oct 16 13:54:31 2020 +0200 @@ -0,0 +1,32 @@ +/* + * ui.c -- libui convenient header + * + * Copyright (c) 2020 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ui.h" +#include "theme.h" + +bool +ui_init(void) +{ + return theme_init(); +} + +void +ui_finish(void) +{ + theme_finish(); +} diff -r 13b7a1a4a72c -r c3a40062acc2 libui/ui/ui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libui/ui/ui.h Fri Oct 16 13:54:31 2020 +0200 @@ -0,0 +1,43 @@ +/* + * ui.h -- libui convenient header + * + * Copyright (c) 2020 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef MOLKO_UI_H +#define MOLKO_UI_H + +/** + * \file ui.h + * \brief libui convenient header. + */ + +#include + +/** + * Initialize the ui library. + * + * \return False on errors. + */ +bool +ui_init(void); + +/** + * Close the ui library. + */ +void +ui_finish(void); + +#endif /* !MOLKO_UI_H */ diff -r 13b7a1a4a72c -r c3a40062acc2 molko/main.c --- a/molko/main.c Fri Oct 16 13:15:04 2020 +0200 +++ b/molko/main.c Fri Oct 16 13:54:31 2020 +0200 @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -28,6 +29,9 @@ #include #include +#include + +#include #include #include @@ -46,9 +50,9 @@ static void init(void) { - if (!sys_init()) + if (!core_init() || !ui_init() || !rpg_init()) panic(); - if (!window_init("Molko's Adventure", WINDOW_WIDTH, WINDOW_HEIGHT)) + if (!window_open("Molko's Adventure", WINDOW_WIDTH, WINDOW_HEIGHT)) panic(); /* @@ -99,7 +103,9 @@ close(void) { window_finish(); - sys_finish(); + rpg_finish(); + ui_finish(); + core_finish(); } int