Mercurial > molko
changeset 292:08ab73b32832
misc: add extern "C" {} blocks for C++ friends
line wrap: on
line diff
--- a/examples/example-battle/registry.c Fri Jan 08 13:15:24 2021 +0100 +++ b/examples/example-battle/registry.c Fri Mar 05 10:08:09 2021 +0100 @@ -51,7 +51,7 @@ unsigned int cellw; unsigned int cellh; } textures[] = { - REGISTRY_TEXTURE(REGISTRY_TEXTURE_CURSOR, "sprites/cursor.png", 24, 24), + REGISTRY_TEXTURE(REGISTRY_TEXTURE_CURSOR, "sprites/ui-cursor.png", 24, 24), REGISTRY_TEXTURE(REGISTRY_TEXTURE_EXPLOSION, "sprites/explosion.png", 256, 256), REGISTRY_TEXTURE(REGISTRY_TEXTURE_JOHN_SWORD, "sprites/john-sword.png", 256, 256), REGISTRY_TEXTURE(REGISTRY_TEXTURE_JOHN_WALK, "sprites/john-walk.png", 256, 256),
--- a/examples/example-battle/spell-fire.c Fri Jan 08 13:15:24 2021 +0100 +++ b/examples/example-battle/spell-fire.c Fri Mar 05 10:08:09 2021 +0100 @@ -33,6 +33,7 @@ struct data { struct battle *battle; + struct character *target; struct animation animation; struct action action; unsigned int selection; @@ -69,6 +70,7 @@ /* TODO: compute damage. */ const unsigned int damage = 100; + if ((unsigned int)ch->hp < damage) ch->hp = 0; else @@ -84,15 +86,23 @@ } static void -fire_action(struct battle *bt, struct character *owner, unsigned int selection) +fire_select(const struct battle *bt, struct selection *slt) +{ + slt->index_side = 0; + + selection_first(slt, bt); +} + +static void +fire_action(struct battle *bt, struct character *owner, const struct selection *slt) { struct data *data; (void)owner; data = alloc_new0(sizeof (*data)); + data->selection = slt->index_character; data->battle = bt; - data->selection = selection; data->action.data = data; data->action.update = update; data->action.draw = draw; @@ -112,6 +122,8 @@ .description = "A delicate fire.", .mp = 5, .type = SPELL_TYPE_FIRE, - .selection = SELECTION_ENEMY_ONE, + .select = fire_select, + .select_kind = SELECTION_KIND_ONE, + .select_side = SELECTION_SIDE_ENEMY, .action = fire_action };
--- a/libmlk-adventure/adventure/action/chest.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/action/chest.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,7 @@ #include <core/action.h> #include <core/animation.h> +#include <core/core.h> struct map; struct save; @@ -52,10 +53,14 @@ void (*exec)(struct chest *); }; +CORE_BEGIN_DECLS + void chest_init(struct chest *c); struct action * chest_action(struct chest *c); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_ACTION_CHEST_H */
--- a/libmlk-adventure/adventure/action/spawner.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/action/spawner.h Fri Mar 05 10:08:09 2021 +0100 @@ -20,6 +20,7 @@ #define MOLKO_ADVENTURE_ACTION_SPAWNER_H #include <core/action.h> +#include <core/core.h> struct map; @@ -33,10 +34,14 @@ int last_y; }; +CORE_BEGIN_DECLS + void spawner_init(struct spawner *); struct action * spawner_action(struct spawner *); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_ACTION_SPAWNER_H */
--- a/libmlk-adventure/adventure/action/teleport.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/action/teleport.h Fri Mar 05 10:08:09 2021 +0100 @@ -20,6 +20,7 @@ #define MOLKO_ADVENTURE_ACTIONS_TELEPORT_H #include <core/action.h> +#include <core/core.h> #include <core/texture.h> struct map; @@ -39,7 +40,11 @@ unsigned int alpha; }; +CORE_BEGIN_DECLS + struct action * teleport_action(struct teleport *); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_ACTIONS_TELEPORT_H */
--- a/libmlk-adventure/adventure/assets.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/assets.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,6 +19,7 @@ #ifndef MOLKO_ADVENTURE_ASSETS_H #define MOLKO_ADVENTURE_ASSETS_H +#include <core/core.h> #include <core/sound.h> #include <core/sprite.h> @@ -50,6 +51,8 @@ ASSETS_SOUND_NUM }; +CORE_BEGIN_DECLS + extern struct sprite assets_sprites[ASSETS_SPRITE_NUM]; extern struct sound assets_sounds[ASSETS_SOUND_NUM]; @@ -59,4 +62,6 @@ void assets_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_ASSETS_H */
--- a/libmlk-adventure/adventure/dialog/save.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/dialog/save.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include <core/core.h> + #include <rpg/save.h> #define DIALOG_SAVE_MAX (6) @@ -35,6 +37,8 @@ size_t selected; }; +CORE_BEGIN_DECLS + void dialog_save_init(struct dialog_save *); @@ -50,4 +54,6 @@ void dialog_save_finish(struct dialog_save *); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_SAVE_H */
--- a/libmlk-adventure/adventure/mapscene/mapscene.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/mapscene/mapscene.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,12 +19,18 @@ #ifndef MOLKO_ADVENTURE_MAPSCENE_MAPSCENE_H #define MOLKO_ADVENTURE_MAPSCENE_MAPSCENE_H +#include <core/core.h> + struct map; +CORE_BEGIN_DECLS + void mapscene_load_action(struct map *, int, int, int, int, const char *); void mapscene_load(struct map *); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_MAPSCENE_MAPSCENE_H */
--- a/libmlk-adventure/adventure/molko.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/molko.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,6 +19,7 @@ #ifndef MOLKO_ADVENTURE_MOLKO_H #define MOLKO_ADVENTURE_MOLKO_H +#include <core/core.h> #include <core/game.h> #include <core/texture.h> #include <core/sprite.h> @@ -47,6 +48,8 @@ struct sprite map_player_sprite; }; +CORE_BEGIN_DECLS + extern struct molko molko; void @@ -67,4 +70,6 @@ void molko_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_MOLKO_H */
--- a/libmlk-adventure/adventure/state/battle.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/state/battle.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,10 +19,16 @@ #ifndef MOLKO_ADVENTURE_STATE_BATTLE_H #define MOLKO_ADVENTURE_STATE_BATTLE_H +#include <core/core.h> + struct battle; struct state; +CORE_BEGIN_DECLS + struct state * state_battle_new(struct battle *); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_STATE_BATTLE_H */
--- a/libmlk-adventure/adventure/state/continue.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/state/continue.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,9 +19,15 @@ #ifndef MOLKO_ADVENTURE_STATE_CONTINUE_H #define MOLKO_ADVENTURE_STATE_CONTINUE_H +#include <core/core.h> + struct state; +CORE_BEGIN_DECLS + struct state * state_continue_new(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_STATE_CONTINUE_H */
--- a/libmlk-adventure/adventure/state/mainmenu.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/state/mainmenu.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,9 +19,15 @@ #ifndef MOLKO_ADVENTURE_STATE_MAINMENU_H #define MOLKO_ADVENTURE_STATE_MAINMENU_H +#include <core/core.h> + struct state; +CORE_BEGIN_DECLS + struct state * state_mainmenu_new(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_STATE_MAINMENU_H */
--- a/libmlk-adventure/adventure/state/map.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/state/map.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,10 +19,16 @@ #ifndef MOLKO_ADVENTURE_STATE_MAP_H #define MOLKO_ADVENTURE_STATE_MAP_H +#include <core/core.h> + struct state; +CORE_BEGIN_DECLS + struct state * state_map_new(const char *, int, int); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_STATE_MAP_H */
--- a/libmlk-adventure/adventure/state/panic.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/state/panic.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,9 +19,15 @@ #ifndef MOLKO_ADVENTURE_STATE_PANIC_H #define MOLKO_ADVENTURE_STATE_PANIC_H +#include <core/core.h> + struct state; +CORE_BEGIN_DECLS + struct state * state_panic_new(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_STATE_PANIC_H */
--- a/libmlk-adventure/adventure/state/splashscreen.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/state/splashscreen.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,9 +19,15 @@ #ifndef MOLKO_ADVENTURE_STATE_SPLASHSCREEN_H #define MOLKO_ADVENTURE_STATE_SPLASHSCREEN_H +#include <core/core.h> + struct state; +CORE_BEGIN_DECLS + struct state * state_splashscreen_new(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_STATE_SPLASHSCREEN_H */
--- a/libmlk-adventure/adventure/trace_hud.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-adventure/adventure/trace_hud.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,6 +19,8 @@ #ifndef MOLKO_ADVENTURE_TRACE_HUD_H #define MOLKO_ADVENTURE_TRACE_HUD_H +#include <core/core.h> + #define TRACE_HUD_TIMEOUT_DEFAULT (3000) struct action; @@ -29,6 +31,8 @@ unsigned int timeout; }; +CORE_BEGIN_DECLS + extern struct trace_hud trace_hud; void @@ -46,4 +50,6 @@ struct action * trace_hud_action(void); +CORE_END_DECLS + #endif /* !MOLKO_ADVENTURE_TRACE_HUD_H */
--- a/libmlk-core/core/action.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/action.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include "core.h" + #define ACTION_STACK_MAX (128) union event; @@ -38,6 +40,8 @@ struct action *actions[ACTION_STACK_MAX]; }; +CORE_BEGIN_DECLS + void action_handle(struct action *act, const union event *ev); @@ -74,4 +78,6 @@ void action_stack_finish(struct action_stack *st); +CORE_END_DECLS + #endif /* !MOLKO_CORE_ACTION_H */
--- a/libmlk-core/core/alloc.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/alloc.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,7 @@ #include <stdbool.h> #include <stddef.h> +#include "core.h" #include "util.h" /* Must be power of 2. */ @@ -43,6 +44,8 @@ void (*finalizer)(void *data); }; +CORE_BEGIN_DECLS + /* allocator functions. */ void alloc_set(const struct alloc_funcs *funcs); @@ -87,4 +90,6 @@ void alloc_pool_finish(struct alloc_pool *pool); +CORE_END_DECLS + #endif /* !MOLKO_CORE_ALLOC_H */
--- a/libmlk-core/core/animation.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/animation.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include "core.h" + struct drawable; struct sprite; @@ -32,6 +34,8 @@ unsigned int elapsed; }; +CORE_BEGIN_DECLS + void animation_init(struct animation *an, const struct sprite *sprite, unsigned int delay); @@ -50,4 +54,6 @@ void animation_drawable(struct animation *an, struct drawable *dw, int x, int y); +CORE_END_DECLS + #endif /* !MOLKO_CORE_ANIMATION_H */
--- a/libmlk-core/core/clock.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/clock.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,14 +19,20 @@ #ifndef MOLKO_CORE_CLOCK_H #define MOLKO_CORE_CLOCK_H +#include "core.h" + struct clock { unsigned int ticks; }; +CORE_BEGIN_DECLS + void clock_start(struct clock *clock); unsigned int clock_elapsed(const struct clock *clock); +CORE_END_DECLS + #endif /* !MOLKO_CORE_CLOCK_H */
--- a/libmlk-core/core/core.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/core.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,10 +21,22 @@ #include <stdbool.h> +#if defined(__cplusplus) +# define CORE_BEGIN_DECLS extern "C" { +# define CORE_END_DECLS } +#else +# define CORE_BEGIN_DECLS +# define CORE_END_DECLS +#endif + +CORE_BEGIN_DECLS + bool core_init(const char *organization, const char *name); void core_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_CORE_CORE_H */
--- a/libmlk-core/core/drawable.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/drawable.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include "core.h" + #define DRAWABLE_STACK_MAX (128) struct drawable { @@ -37,6 +39,8 @@ struct drawable *objects[DRAWABLE_STACK_MAX]; }; +CORE_BEGIN_DECLS + bool drawable_update(struct drawable *dw, unsigned int ticks); @@ -67,4 +71,6 @@ void drawable_stack_finish(struct drawable_stack *st); +CORE_END_DECLS + #endif /* !MOLKO_CORE_DRAWABLE_H */
--- a/libmlk-core/core/error.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/error.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,10 @@ #include <stdarg.h> #include <stdbool.h> +#include "core.h" + +CORE_BEGIN_DECLS + const char * error(void); @@ -31,4 +35,6 @@ bool errorva(const char *fmt, va_list ap); +CORE_END_DECLS + #endif /* !MOLKO_CORE_ERROR_H */
--- a/libmlk-core/core/event.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/event.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,7 @@ #include <stdbool.h> +#include "core.h" #include "key.h" #include "mouse.h" @@ -60,7 +61,11 @@ struct event_click click; }; +CORE_BEGIN_DECLS + bool event_poll(union event *ev); +CORE_END_DECLS + #endif /* !MOLKO_CORE_EVENT_H */
--- a/libmlk-core/core/font.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/font.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,8 @@ #include <stdbool.h> #include <stddef.h> +#include "core.h" + struct texture; enum font_style { @@ -34,6 +36,8 @@ void *handle; }; +CORE_BEGIN_DECLS + bool font_open(struct font *font, const char *path, unsigned int size); @@ -55,4 +59,6 @@ void font_finish(struct font *font); +CORE_END_DECLS + #endif /* !MOLKO_CORE_FONT_H */
--- a/libmlk-core/core/game.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/game.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,7 @@ #include <stdbool.h> +#include "core.h" #include "inhibit.h" struct state; @@ -38,6 +39,8 @@ extern struct game game; +CORE_BEGIN_DECLS + void game_switch(struct state *state, bool quick); @@ -59,4 +62,6 @@ void game_quit(void); +CORE_END_DECLS + #endif /* !MOLKO_CORE_GAME_H */
--- a/libmlk-core/core/image.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/image.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,12 +22,18 @@ #include <stdbool.h> #include <stddef.h> +#include "core.h" + struct texture; +CORE_BEGIN_DECLS + bool image_open(struct texture *tex, const char *path); bool image_openmem(struct texture *tex, const void *buffer, size_t size); +CORE_END_DECLS + #endif /* !MOLKO_CORE_IMAGE_H */
--- a/libmlk-core/core/maths.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/maths.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,10 +21,16 @@ #include <stdbool.h> +#include "core.h" + +CORE_BEGIN_DECLS + bool maths_is_boxed(int x, int y, unsigned int w, unsigned int h, int px, int py); float maths_scale(float v, float omin, float omax, float nmin, float nmax); +CORE_END_DECLS + #endif /* !MOLKO_CORE_MATHS_H */
--- a/libmlk-core/core/music.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/music.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,8 @@ #include <stdbool.h> #include <stddef.h> +#include "core.h" + enum music_flags { MUSIC_NONE = 0, MUSIC_LOOP = (1 << 0) @@ -31,6 +33,8 @@ void *handle; }; +CORE_BEGIN_DECLS + bool music_open(struct music *mus, const char *path); @@ -58,4 +62,6 @@ void music_finish(struct music *mus); +CORE_END_DECLS + #endif /* !MOLKO_CORE_MUSIC_H */
--- a/libmlk-core/core/painter.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/painter.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,8 +21,12 @@ #include <stdbool.h> +#include "core.h" + struct texture; +CORE_BEGIN_DECLS + struct texture * painter_get_target(void); @@ -53,6 +57,8 @@ void painter_present(void); +CORE_END_DECLS + #define PAINTER_BEGIN(tex) \ do { \ struct texture *__current_texture__; \
--- a/libmlk-core/core/panic.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/panic.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,8 +22,12 @@ #include <stdarg.h> #include <stdnoreturn.h> +#include "core.h" + extern void (*panic_handler)(void); +CORE_BEGIN_DECLS + noreturn void panicf(const char *fmt, ...); @@ -33,4 +37,6 @@ noreturn void panic(void); +CORE_END_DECLS + #endif /* !MOLKO_CORE_PANIC_H */
--- a/libmlk-core/core/script.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/script.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,8 @@ #include <stdbool.h> #include <stddef.h> +#include "core.h" + #define SCRIPT_ACTION_MAX (128) struct action; @@ -34,6 +36,8 @@ size_t cur; }; +CORE_BEGIN_DECLS + void script_init(struct script *s); @@ -58,4 +62,6 @@ void script_action(struct script *s, struct action *dst); +CORE_END_DECLS + #endif /* !MOLKO_CORE_SCRIPT_H */
--- a/libmlk-core/core/sound.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/sound.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,7 @@ #include <stdbool.h> #include <stddef.h> +#include "core.h" #define SOUND_CHANNELS_MAX (256) @@ -30,6 +31,8 @@ int channel; }; +CORE_BEGIN_DECLS + bool sound_open(struct sound *snd, const char *path); @@ -54,4 +57,6 @@ void sound_finish(struct sound *snd); +CORE_END_DECLS + #endif /* !MOLKO_CORE_SOUND_H */
--- a/libmlk-core/core/sprite.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/sprite.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include "core.h" + struct texture; struct sprite { @@ -31,6 +33,8 @@ unsigned int ncols; }; +CORE_BEGIN_DECLS + void sprite_init(struct sprite *sprite, struct texture *tex, @@ -52,4 +56,6 @@ unsigned int w, unsigned int h); +CORE_END_DECLS + #endif /* !MOLKO_CORE_SPRITE_H */
--- a/libmlk-core/core/state.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/state.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,6 +19,8 @@ #ifndef MOLKO_CORE_STATE_H #define MOLKO_CORE_STATE_H +#include "core.h" + union event; struct state { @@ -31,6 +33,8 @@ void (*finish)(struct state *state); }; +CORE_BEGIN_DECLS + void state_start(struct state *state); @@ -49,4 +53,6 @@ void state_finish(struct state *state); +CORE_END_DECLS + #endif /* !MOLKO_CORE_STATE_H */
--- a/libmlk-core/core/sys.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/sys.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,8 @@ #include <stdarg.h> #include <stdbool.h> +#include "core.h" + enum sys_dir { SYS_DIR_BIN, SYS_DIR_DATA, @@ -29,6 +31,8 @@ SYS_DIR_SAVE, }; +CORE_BEGIN_DECLS + bool sys_init(const char *organization, const char *name); @@ -41,4 +45,6 @@ void sys_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_CORE_SYS_H */
--- a/libmlk-core/core/texture.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/texture.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include "core.h" + struct texture { unsigned int w; unsigned int h; @@ -35,6 +37,8 @@ TEXTURE_BLEND_LAST }; +CORE_BEGIN_DECLS + bool texture_new(struct texture *tex, unsigned int w, unsigned int h); @@ -68,4 +72,6 @@ void texture_finish(struct texture *tex); +CORE_END_DECLS + #endif /* !MOLKO_CORE_TEXTURE_H */
--- a/libmlk-core/core/trace.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/trace.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,14 +21,20 @@ #include <stdarg.h> +#include "core.h" + #define TRACE_LINE_MAX (1024) extern void (*trace_handler)(const char *); +CORE_BEGIN_DECLS + void tracef(const char *fmt, ...); void traceva(const char *fmt, va_list ap); +CORE_END_DECLS + #endif /* !MOLKO_CORE_TRACE_H */
--- a/libmlk-core/core/translate.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/translate.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,10 +21,16 @@ #include <stdbool.h> +#include "core.h" + +CORE_BEGIN_DECLS + bool translate_init(const char *name); void translate_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_CORE_TRANSLATE_H */
--- a/libmlk-core/core/util.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/util.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,8 +19,12 @@ #ifndef MOLKO_CORE_UTIL_H #define MOLKO_CORE_UTIL_H +#include "core.h" + #define UTIL_SIZE(x) sizeof ((x)) / sizeof ((x)[0]) +CORE_BEGIN_DECLS + void util_delay(unsigned int ms); @@ -30,4 +34,6 @@ unsigned int util_nrand(unsigned int lower, unsigned int upper); +CORE_END_DECLS + #endif /* !MOLKO_CORE_UTIL_H */
--- a/libmlk-core/core/window.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-core/core/window.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include "core.h" + struct window { unsigned int w; unsigned int h; @@ -41,6 +43,8 @@ extern struct window window; +CORE_BEGIN_DECLS + bool window_open(const char *title, unsigned int width, unsigned int height); @@ -50,4 +54,6 @@ void window_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_CORE_WINDOW_H */
--- a/libmlk-rpg/rpg/battle-bar.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/battle-bar.h Fri Mar 05 10:08:09 2021 +0100 @@ -45,6 +45,8 @@ #include <stdbool.h> +#include <core/core.h> + #include <ui/frame.h> #include <ui/gridmenu.h> @@ -85,6 +87,8 @@ struct gridmenu sub_grid; }; +CORE_BEGIN_DECLS + void battle_bar_positionate(struct battle_bar *bar, const struct battle *bt); @@ -111,4 +115,6 @@ void battle_bar_finish(struct battle_bar *bar); +CORE_END_DECLS + #endif /* !MOLKO_RPG_BATTLE_BAR_H */
--- a/libmlk-rpg/rpg/battle-entity-state.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/battle-entity-state.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include <core/core.h> + struct battle_entity; struct sprite; @@ -31,6 +33,8 @@ void (*finish)(struct battle_entity_state *st, struct battle_entity *et); }; +CORE_BEGIN_DECLS + bool battle_entity_state_update(struct battle_entity_state *st, struct battle_entity *et, unsigned int ticks); @@ -53,4 +57,6 @@ void battle_entity_state_attacking(struct battle_entity *et, struct sprite *which); +CORE_END_DECLS + #endif /* !MOLKO_RPG_BATTLE_ENTITY_STATE_H */
--- a/libmlk-rpg/rpg/battle-entity.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/battle-entity.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include <core/core.h> + #include <ui/label.h> struct battle; @@ -38,6 +40,8 @@ struct battle_entity_state *state; /*!< (+&) Update/draw state. */ }; +CORE_BEGIN_DECLS + void battle_entity_init(struct battle_entity *et); @@ -59,4 +63,6 @@ void battle_entity_finish(struct battle_entity *et); +CORE_END_DECLS + #endif /* !MOLKO_RPG_BATTLE_ENTITY_H */
--- a/libmlk-rpg/rpg/battle-indicator.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/battle-indicator.h Fri Mar 05 10:08:09 2021 +0100 @@ -29,6 +29,7 @@ #include <stdbool.h> +#include <core/core.h> #include <core/texture.h> /** @@ -60,6 +61,8 @@ struct texture tex[2]; /*!< (*) Rendered texture. */ }; +CORE_BEGIN_DECLS + /** * Start the battle indicator. You must call this function only once. * @@ -119,4 +122,6 @@ void battle_indicator_finish(struct battle_indicator *bti); +CORE_END_DECLS + #endif /* !MOLKO_RPG_BATTLE_INDICATOR_H */
--- a/libmlk-rpg/rpg/battle-state.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/battle-state.h Fri Mar 05 10:08:09 2021 +0100 @@ -33,6 +33,8 @@ #include <stdbool.h> +#include <core/core.h> + struct battle; struct character; struct inventory_slot; @@ -48,6 +50,8 @@ void (*finish)(struct battle_state *st, struct battle *bt); }; +CORE_BEGIN_DECLS + void battle_state_handle(struct battle_state *st, struct battle *bt, const union event *ev); @@ -97,4 +101,6 @@ void battle_state_victory(struct battle *bt); +CORE_END_DECLS + #endif /* !MOLKO_RPG_BATTLE_STATE_H */
--- a/libmlk-rpg/rpg/battle.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/battle.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,7 @@ #include <stdbool.h> #include <core/action.h> +#include <core/core.h> #include <core/drawable.h> #include <ui/frame.h> @@ -78,6 +79,8 @@ struct battle_bar bar; }; +CORE_BEGIN_DECLS + void battle_start(struct battle *); @@ -117,4 +120,6 @@ void battle_finish(struct battle *); +CORE_END_DECLS + #endif /* MOLKO_RPG_BATTLE_H */
--- a/libmlk-rpg/rpg/character.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/character.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include <core/core.h> + #define CHARACTER_SPELL_MAX (64) struct battle; @@ -84,6 +86,8 @@ void (*exec)(struct character *owner, struct battle *bt); }; +CORE_BEGIN_DECLS + bool character_ok(const struct character *ch); @@ -102,4 +106,6 @@ bool character_load(struct character *, struct save *); +CORE_END_DECLS + #endif /* !MOLKO_RPG_CHARACTER_H */
--- a/libmlk-rpg/rpg/equipment.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/equipment.h Fri Mar 05 10:08:09 2021 +0100 @@ -26,6 +26,8 @@ #include <stdbool.h> +#include <core/core.h> + struct character; struct texture; @@ -74,6 +76,8 @@ void (*equip)(const struct equipment *eq, struct character *ch); }; +CORE_BEGIN_DECLS + /** * Tells if this equipment object is valid. * @@ -94,4 +98,6 @@ void equipment_equip(const struct equipment *eq, struct character *ch); +CORE_END_DECLS + #endif /* !MOLKO_RPG_EQUIPMENT_H */
--- a/libmlk-rpg/rpg/inventory.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/inventory.h Fri Mar 05 10:08:09 2021 +0100 @@ -21,6 +21,8 @@ #include <stdbool.h> +#include <core/core.h> + #define INVENTORY_ITEM_MAX (512) struct item; @@ -34,10 +36,14 @@ struct inventory_slot items[INVENTORY_ITEM_MAX]; }; +CORE_BEGIN_DECLS + bool inventory_add(struct inventory *iv, const struct item *item, unsigned int amount); void inventory_consume(struct inventory *iv, const struct item *item, unsigned int amount); +CORE_END_DECLS + #endif /* !MOLKO_RPG_INVENTORY_H */
--- a/libmlk-rpg/rpg/item.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/item.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,6 +19,8 @@ #ifndef MOLKO_RPG_ITEM_H #define MOLKO_RPG_ITEM_H +#include <core/core.h> + struct battle; struct character; struct texture; @@ -36,6 +38,8 @@ struct character *tgt); }; +CORE_BEGIN_DECLS + void item_exec_menu(const struct item *item, struct character *ch); @@ -45,4 +49,6 @@ struct character *src, struct character *tgt); +CORE_END_DECLS + #endif /* !MOLKO_RPG_ITEM_H */
--- a/libmlk-rpg/rpg/map-file.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/map-file.h Fri Mar 05 10:08:09 2021 +0100 @@ -40,6 +40,7 @@ #include <stdbool.h> #include <core/alloc.h> +#include <core/core.h> #include <core/sprite.h> #include <core/texture.h> @@ -76,6 +77,8 @@ struct alloc_pool blocks; /*!< \private */ }; +CORE_BEGIN_DECLS + /** * Try to open a map from a file path. * @@ -100,4 +103,6 @@ void map_file_finish(struct map_file *file); +CORE_END_DECLS + #endif /* !MOLKO_RPG_MAP_FILE_H */
--- a/libmlk-rpg/rpg/map.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/map.h Fri Mar 05 10:08:09 2021 +0100 @@ -27,6 +27,7 @@ #include <stddef.h> #include <core/action.h> +#include <core/core.h> #include "walksprite.h" @@ -124,6 +125,8 @@ struct map_layer layers[MAP_LAYER_TYPE_NUM]; }; +CORE_BEGIN_DECLS + /** * Initialize the map. * @@ -175,4 +178,6 @@ void map_finish(struct map *map); +CORE_END_DECLS + #endif /* !MOLKO_RPG_MAP_H */
--- a/libmlk-rpg/rpg/message.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/message.h Fri Mar 05 10:08:09 2021 +0100 @@ -76,6 +76,7 @@ #include <stdbool.h> +#include <core/core.h> #include <core/texture.h> struct action; @@ -139,6 +140,8 @@ double scale; /*!< (-) Current scale [0-1]. */ }; +CORE_BEGIN_DECLS + /** * Start opening the message. This function will reset the message state and * elapsed time. @@ -222,4 +225,6 @@ void message_action(struct message *msg, struct action *act); +CORE_END_DECLS + #endif /* !MOLKO_RPG_MESSAGE_H */
--- a/libmlk-rpg/rpg/rpg.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/rpg.h Fri Mar 05 10:08:09 2021 +0100 @@ -26,6 +26,10 @@ #include <stdbool.h> +#include <core/core.h> + +CORE_BEGIN_DECLS + /** * Initialize the rpg library. * @@ -40,4 +44,6 @@ void rpg_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_RPG_H */
--- a/libmlk-rpg/rpg/save.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/save.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,8 @@ #include <stdbool.h> #include <time.h> +#include <core/core.h> + #define SAVE_PROPERTY_KEY_MAX (64) #define SAVE_PROPERTY_VALUE_MAX (1024) @@ -46,6 +48,8 @@ void *handle; }; +CORE_BEGIN_DECLS + bool save_open(struct save *db, unsigned int idx, enum save_mode mode); @@ -80,4 +84,6 @@ void save_stmt_finish(struct save_stmt *stmt); +CORE_END_DECLS + #endif /* !MOLKO_RPG_SAVE_H */
--- a/libmlk-rpg/rpg/selection.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/selection.h Fri Mar 05 10:08:09 2021 +0100 @@ -19,6 +19,8 @@ #ifndef MOLKO_RPG_SELECTION_H #define MOLKO_RPG_SELECTION_H +#include <core/core.h> + struct battle; enum selection_kind { @@ -45,10 +47,14 @@ unsigned int index_side; }; +CORE_BEGIN_DECLS + void selection_first(struct selection *, const struct battle *); void selection_random(struct selection *, const struct battle *); +CORE_END_DECLS + #endif /* !MOLKO_RPG_SELECTION_H */
--- a/libmlk-rpg/rpg/spell.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/spell.h Fri Mar 05 10:08:09 2021 +0100 @@ -24,6 +24,8 @@ * \brief Magic spells. */ +#include <core/core.h> + #include "selection.h" struct character; @@ -54,6 +56,8 @@ void (*use)(struct character *, const struct selection *); }; +CORE_BEGIN_DECLS + void spell_select(const struct spell *s, const struct battle *bt, struct selection *slt); @@ -63,4 +67,6 @@ void spell_use(struct spell *s, struct character *owner, const struct selection *slt); +CORE_END_DECLS + #endif /* !MOLKO_RPG_SPELL_H */
--- a/libmlk-rpg/rpg/tileset-file.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/tileset-file.h Fri Mar 05 10:08:09 2021 +0100 @@ -28,6 +28,7 @@ #include <stddef.h> #include <core/alloc.h> +#include <core/core.h> #include <core/sprite.h> #include <core/texture.h> @@ -51,6 +52,8 @@ struct sprite sprite; /*!< (*) Sprite. */ }; +CORE_BEGIN_DECLS + /** * Try to load a tileset from a file. * @@ -78,4 +81,6 @@ void tileset_file_finish(struct tileset_file *tf); +CORE_END_DECLS + #endif /* !MOLKO_RPG_TILESET_FILE_H */
--- a/libmlk-rpg/rpg/tileset.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/tileset.h Fri Mar 05 10:08:09 2021 +0100 @@ -22,6 +22,8 @@ #include <stdbool.h> #include <stddef.h> +#include <core/core.h> + struct sprite; /** @@ -59,6 +61,8 @@ struct sprite *sprite; /*!< (+&) Sprite to generate the terrain. */ }; +CORE_BEGIN_DECLS + /** * Tells if the tileset is correctly initialized. * @@ -111,4 +115,6 @@ void tileset_draw(const struct tileset *ts, unsigned int r, unsigned int c, int x, int y); +CORE_END_DECLS + #endif /* !MOLKO_RPG_TILESET_H */
--- a/libmlk-rpg/rpg/walksprite.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-rpg/rpg/walksprite.h Fri Mar 05 10:08:09 2021 +0100 @@ -25,6 +25,8 @@ * \ingroup drawing */ +#include <core/core.h> + struct sprite; /** @@ -64,6 +66,8 @@ unsigned int elapsed; /*!< (-) Elapsed time since last frame */ }; +CORE_BEGIN_DECLS + /** * Initialize the walking sprite. * @@ -109,4 +113,6 @@ void walksprite_draw(const struct walksprite *ws, unsigned int orientation, int x, int y); +CORE_END_DECLS + #endif /* !MOLKO_RPG_WALKSPRITE_H */
--- a/libmlk-ui/ui/align.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/align.h Fri Mar 05 10:08:09 2021 +0100 @@ -24,6 +24,8 @@ * \brief User interface alignment. */ +#include <core/core.h> + /** * \brief Label alignment in bounding box. * @@ -54,6 +56,8 @@ ALIGN_LEFT /*!< Left (aligned vertically). */ }; +CORE_BEGIN_DECLS + /** * Align the given object relative to its parent region. * @@ -99,4 +103,6 @@ unsigned int pw, unsigned int ph); +CORE_END_DECLS + #endif /* !MOLKO_UI_ALIGN_H */
--- a/libmlk-ui/ui/button.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/button.h Fri Mar 05 10:08:09 2021 +0100 @@ -25,6 +25,8 @@ * \ingroup ui */ +#include <core/core.h> + union event; struct action; @@ -52,6 +54,8 @@ const struct theme *theme; /*!< (+&?) Theme to use. */ }; +CORE_BEGIN_DECLS + /** * Handle the event. * @@ -117,4 +121,6 @@ void button_action(struct button *button, struct action *act); +CORE_END_DECLS + #endif /* !MOLKO_UI_BUTTON_H */
--- a/libmlk-ui/ui/checkbox.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/checkbox.h Fri Mar 05 10:08:09 2021 +0100 @@ -27,6 +27,8 @@ #include <stdbool.h> +#include <core/core.h> + union event; struct action; @@ -44,6 +46,8 @@ const struct theme *theme; /*!< (+&?) Theme to use. */ }; +CORE_BEGIN_DECLS + /** * Default drawing function. * @@ -97,4 +101,6 @@ void checkbox_action(struct checkbox *cb, struct action *act); +CORE_END_DECLS + #endif /* !MOLKO_UI_CHECKBOX_H */
--- a/libmlk-ui/ui/debug.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/debug.h Fri Mar 05 10:08:09 2021 +0100 @@ -40,6 +40,7 @@ #include <stdbool.h> #include <stdarg.h> +#include <core/core.h> #include <core/font.h> /** @@ -69,6 +70,8 @@ unsigned int count; /*!< (-) Number of messages already printed. */ }; +CORE_BEGIN_DECLS + /** * Global debugging options. */ @@ -98,4 +101,6 @@ void vdebugf(struct debug_report *report, const char *fmt, va_list ap); +CORE_END_DECLS + #endif /* !MOLKO_UI_DEBUG_H */
--- a/libmlk-ui/ui/frame.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/frame.h Fri Mar 05 10:08:09 2021 +0100 @@ -25,6 +25,8 @@ * \ingroup ui */ +#include <core/core.h> + struct action; struct theme; @@ -48,6 +50,8 @@ const struct theme *theme; /*!< (+&?) Theme to use. */ }; +CORE_BEGIN_DECLS + /** * Default drawing function. * @@ -87,4 +91,6 @@ void frame_action(struct frame *frame, struct action *act); +CORE_END_DECLS + #endif /* !MOLKO_UI_FRAME_H */
--- a/libmlk-ui/ui/gridmenu.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/gridmenu.h Fri Mar 05 10:08:09 2021 +0100 @@ -26,6 +26,7 @@ #include <stddef.h> +#include <core/core.h> #include <core/texture.h> #include "label.h" @@ -117,6 +118,8 @@ struct gridmenu_texture tex; }; +CORE_BEGIN_DECLS + /** * Reset the menu->state flag. * @@ -169,4 +172,6 @@ void gridmenu_finish(struct gridmenu *menu); +CORE_END_DECLS + #endif /* !MOLKO_UI_GRIDMENU_H */
--- a/libmlk-ui/ui/label.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/label.h Fri Mar 05 10:08:09 2021 +0100 @@ -27,6 +27,8 @@ #include <stdbool.h> +#include <core/core.h> + struct action; struct theme; @@ -49,6 +51,8 @@ const struct theme *theme; /*!< (+&?) Theme to use. */ }; +CORE_BEGIN_DECLS + /** * Default drawing function. * @@ -109,4 +113,6 @@ void label_action(struct label *label, struct action *act); +CORE_END_DECLS + #endif /* !MOLKO_UI_LABEL_H */
--- a/libmlk-ui/ui/theme.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/theme.h Fri Mar 05 10:08:09 2021 +0100 @@ -27,6 +27,8 @@ #include <stdbool.h> +#include <core/core.h> + struct button; struct checkbox; struct font; @@ -118,6 +120,8 @@ void (*draw_checkbox)(const struct theme *t, const struct checkbox *); }; +CORE_BEGIN_DECLS + /** * Initialize the theming system. * @@ -229,4 +233,6 @@ void theme_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_UI_THEME_H */
--- a/libmlk-ui/ui/ui.h Fri Jan 08 13:15:24 2021 +0100 +++ b/libmlk-ui/ui/ui.h Fri Mar 05 10:08:09 2021 +0100 @@ -26,6 +26,10 @@ #include <stdbool.h> +#include <core/core.h> + +CORE_BEGIN_DECLS + /** * Initialize the ui library. * @@ -40,4 +44,6 @@ void ui_finish(void); +CORE_END_DECLS + #endif /* !MOLKO_UI_UI_H */