Mercurial > molko
changeset 472:bc5483849614
core: texture -> mlk_texture
line wrap: on
line diff
--- a/examples/example-animation/example-animation.c Mon Feb 27 11:18:52 2023 +0100 +++ b/examples/example-animation/example-animation.c Mon Feb 27 11:24:38 2023 +0100 @@ -46,7 +46,7 @@ }; static struct mlk_state *states[1]; -static struct texture numbers; +static struct mlk_texture numbers; static struct mlk_animation animation; static struct mlk_sprite sprite; static int completed = 1;
--- a/examples/example-drawable/example-drawable.c Mon Feb 27 11:18:52 2023 +0100 +++ b/examples/example-drawable/example-drawable.c Mon Feb 27 11:24:38 2023 +0100 @@ -63,7 +63,7 @@ */ /* 0: Explosion animation. */ -static struct texture explosion_tex; +static struct mlk_texture explosion_tex; static struct mlk_sprite explosion_sprite; struct explosion {
--- a/examples/example-font/example-font.c Mon Feb 27 11:18:52 2023 +0100 +++ b/examples/example-font/example-font.c Mon Feb 27 11:24:38 2023 +0100 @@ -100,7 +100,7 @@ (void)st; struct mlk_font *font = theme_default()->fonts[THEME_FONT_INTERFACE]; - struct texture tex; + struct mlk_texture tex; mlk_painter_set_color(0xffffffff); mlk_painter_clear(); @@ -108,9 +108,9 @@ if (mlk_font_render(font, &tex, "Example of text. Use <Left>/<Right> to change color and <Space> to toggle antialiasing.", colors[ci]) < 0) mlk_panic(); - texture_draw(&tex, 10, 10); + mlk_texture_draw(&tex, 10, 10); mlk_painter_present(); - texture_finish(&tex); + mlk_texture_finish(&tex); } static void
--- a/examples/example-notify/example-notify.c Mon Feb 27 11:18:52 2023 +0100 +++ b/examples/example-notify/example-notify.c Mon Feb 27 11:24:38 2023 +0100 @@ -45,7 +45,7 @@ .y = 10, .flags = LABEL_FLAGS_SHADOW }; -static struct texture icon; +static struct mlk_texture icon; static struct mlk_state *states[1]; static void
--- a/examples/example-sprite/example-sprite.c Mon Feb 27 11:18:52 2023 +0100 +++ b/examples/example-sprite/example-sprite.c Mon Feb 27 11:24:38 2023 +0100 @@ -44,7 +44,7 @@ #define HEADER "Keys: <Left>/<Right> and <Up/Down> to select a column/row. Current: %u, %u (total %u/%u)" static char msg[512]; -static struct texture texture; +static struct mlk_texture texture; static struct mlk_sprite sprite; static unsigned int row, column; static struct mlk_state *states[1]; @@ -146,7 +146,7 @@ static void quit(void) { - texture_finish(&texture); + mlk_texture_finish(&texture); window_finish(); ui_finish(); mlk_core_finish();
--- a/libmlk-core/mlk/core/font.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/font.c Mon Feb 27 11:24:38 2023 +0100 @@ -62,7 +62,7 @@ } int -mlk_font_render(struct mlk_font *font, struct texture *tex, const char *text, unsigned long color) +mlk_font_render(struct mlk_font *font, struct mlk_texture *tex, const char *text, unsigned long color) { assert(mlk_font_ok(font)); assert(text);
--- a/libmlk-core/mlk/core/font.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/font.h Mon Feb 27 11:24:38 2023 +0100 @@ -23,7 +23,7 @@ #include "core.h" -struct texture; +struct mlk_texture; enum mlk_font_style { MLK_FONT_STYLE_ANTIALIASED, @@ -48,7 +48,7 @@ mlk_font_ok(const struct mlk_font *); int -mlk_font_render(struct mlk_font *, struct texture *, const char *, unsigned long); +mlk_font_render(struct mlk_font *, struct mlk_texture *, const char *, unsigned long); unsigned int mlk_font_height(const struct mlk_font *);
--- a/libmlk-core/mlk/core/image.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/image.c Mon Feb 27 11:24:38 2023 +0100 @@ -26,7 +26,7 @@ #include "window_p.h" static void -dimensions(struct texture *tex) +dimensions(struct mlk_texture *tex) { int w, h; @@ -39,7 +39,7 @@ } int -mlk_image_open(struct texture *tex, const char *path) +mlk_image_open(struct mlk_texture *tex, const char *path) { assert(tex); assert(path); @@ -53,7 +53,7 @@ } int -mlk_image_openmem(struct texture *tex, const void *buffer, size_t size) +mlk_image_openmem(struct mlk_texture *tex, const void *buffer, size_t size) { assert(buffer);
--- a/libmlk-core/mlk/core/image.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/image.h Mon Feb 27 11:24:38 2023 +0100 @@ -23,15 +23,15 @@ #include "core.h" -struct texture; +struct mlk_texture; MLK_CORE_BEGIN_DECLS int -mlk_image_open(struct texture *, const char *); +mlk_image_open(struct mlk_texture *, const char *); int -mlk_image_openmem(struct texture *, const void *, size_t); +mlk_image_openmem(struct mlk_texture *, const void *, size_t); MLK_CORE_END_DECLS
--- a/libmlk-core/mlk/core/painter.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/painter.c Mon Feb 27 11:24:38 2023 +0100 @@ -25,16 +25,16 @@ #include "window_p.h" /* Current texture renderer. */ -static struct texture *renderer; +static struct mlk_texture *renderer; -struct texture * +struct mlk_texture * mlk_painter_get_target(void) { return renderer; } void -mlk_painter_set_target(struct texture *tex) +mlk_painter_set_target(struct mlk_texture *tex) { renderer = tex; SDL_SetRenderTarget(RENDERER(), tex ? tex->handle : NULL);
--- a/libmlk-core/mlk/core/painter.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/painter.h Mon Feb 27 11:24:38 2023 +0100 @@ -21,15 +21,15 @@ #include "core.h" -struct texture; +struct mlk_texture; MLK_CORE_BEGIN_DECLS -struct texture * +struct mlk_texture * mlk_painter_get_target(void); void -mlk_painter_set_target(struct texture *); +mlk_painter_set_target(struct mlk_texture *); unsigned long mlk_painter_get_color(void); @@ -59,7 +59,7 @@ #define MLK_PAINTER_BEGIN(tex) \ do { \ - struct texture *__current_texture__; \ + struct mlk_texture *__current_texture__; \ \ __current_texture__ = mlk_painter_get_target(); \ mlk_painter_set_target((tex))
--- a/libmlk-core/mlk/core/sprite.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/sprite.c Mon Feb 27 11:24:38 2023 +0100 @@ -23,12 +23,12 @@ void mlk_sprite_init(struct mlk_sprite *sprite, - struct texture *tex, + struct mlk_texture *tex, unsigned int cellw, unsigned int cellh) { assert(sprite); - assert(tex && texture_ok(tex)); + assert(tex && mlk_texture_ok(tex)); sprite->texture = tex; sprite->cellw = cellw; @@ -40,7 +40,7 @@ int mlk_sprite_ok(const struct mlk_sprite *sprite) { - return sprite && texture_ok(sprite->texture) && sprite->cellw != 0 && sprite->cellh != 0; + return sprite && mlk_texture_ok(sprite->texture) && sprite->cellw != 0 && sprite->cellh != 0; } int @@ -62,7 +62,7 @@ assert(r < sprite->nrows); assert(c < sprite->ncols); - return texture_scale( + return mlk_texture_scale( sprite->texture, c * sprite->cellw, /* src y */ r * sprite->cellh, /* src x */
--- a/libmlk-core/mlk/core/sprite.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/sprite.h Mon Feb 27 11:24:38 2023 +0100 @@ -21,10 +21,10 @@ #include "core.h" -struct texture; +struct mlk_texture; struct mlk_sprite { - struct texture *texture; + struct mlk_texture *texture; unsigned int cellw; unsigned int cellh; unsigned int nrows; @@ -34,7 +34,7 @@ MLK_CORE_BEGIN_DECLS void -mlk_sprite_init(struct mlk_sprite *, struct texture *, unsigned int, unsigned int); +mlk_sprite_init(struct mlk_sprite *, struct mlk_texture *, unsigned int, unsigned int); int mlk_sprite_ok(const struct mlk_sprite *);
--- a/libmlk-core/mlk/core/texture.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/texture.c Mon Feb 27 11:24:38 2023 +0100 @@ -28,7 +28,7 @@ #include "window_p.h" int -texture_new(struct texture *tex, unsigned int w, unsigned int h) +mlk_texture_new(struct mlk_texture *tex, unsigned int w, unsigned int h) { assert(tex); assert(w); @@ -49,22 +49,22 @@ } int -texture_ok(const struct texture *tex) +mlk_texture_ok(const struct mlk_texture *tex) { return tex && tex->handle && tex->w && tex->h; } int -texture_set_blend_mode(struct texture *tex, enum texture_blend blend) +mlk_texture_set_blend_mode(struct mlk_texture *tex, enum mlk_texture_blend blend) { assert(tex); - assert(blend >= TEXTURE_BLEND_NONE && blend <= TEXTURE_BLEND_MODULATE); + assert(blend >= MLK_TEXTURE_BLEND_NONE && blend < MLK_TEXTURE_BLEND_LAST); static const SDL_BlendMode table[] = { - [TEXTURE_BLEND_NONE] = SDL_BLENDMODE_NONE, - [TEXTURE_BLEND_BLEND] = SDL_BLENDMODE_BLEND, - [TEXTURE_BLEND_ADD] = SDL_BLENDMODE_ADD, - [TEXTURE_BLEND_MODULATE] = SDL_BLENDMODE_MOD + [MLK_TEXTURE_BLEND_NONE] = SDL_BLENDMODE_NONE, + [MLK_TEXTURE_BLEND_BLEND] = SDL_BLENDMODE_BLEND, + [MLK_TEXTURE_BLEND_ADD] = SDL_BLENDMODE_ADD, + [MLK_TEXTURE_BLEND_MODULATE] = SDL_BLENDMODE_MOD }; if (SDL_SetTextureBlendMode(tex->handle, table[blend]) < 0) @@ -74,9 +74,9 @@ } int -texture_set_alpha_mod(struct texture *tex, unsigned int alpha) +mlk_texture_set_alpha_mod(struct mlk_texture *tex, unsigned int alpha) { - assert(texture_ok(tex)); + assert(mlk_texture_ok(tex)); assert(alpha <= 255); if (SDL_SetTextureAlphaMod(tex->handle, alpha) < 0) @@ -86,9 +86,9 @@ } int -texture_set_color_mod(struct texture *tex, unsigned long color) +mlk_texture_set_color_mod(struct mlk_texture *tex, unsigned long color) { - assert(texture_ok(tex)); + assert(mlk_texture_ok(tex)); if (SDL_SetTextureColorMod(tex->handle, MLK_COLOR_R(color), MLK_COLOR_G(color), MLK_COLOR_B(color)) < 0) return errorf("%s", SDL_GetError()); @@ -97,7 +97,7 @@ } int -texture_draw(const struct texture *tex, int x, int y) +mlk_texture_draw(const struct mlk_texture *tex, int x, int y) { assert(tex); @@ -115,7 +115,7 @@ } int -texture_scale(const struct texture *tex, +mlk_texture_scale(const struct mlk_texture *tex, int src_x, int src_y, unsigned src_w, @@ -146,7 +146,7 @@ } void -texture_finish(struct texture *tex) +mlk_texture_finish(struct mlk_texture *tex) { assert(tex); @@ -159,7 +159,7 @@ /* private */ int -texture_from_surface(struct texture *tex, SDL_Surface *surface) +texture_from_surface(struct mlk_texture *tex, SDL_Surface *surface) { assert(tex); assert(surface);
--- a/libmlk-core/mlk/core/texture.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/texture.h Mon Feb 27 11:24:38 2023 +0100 @@ -22,42 +22,42 @@ #include "core.h" #include "err.h" -struct texture { +struct mlk_texture { unsigned int w; unsigned int h; void *handle; }; -enum texture_blend { - TEXTURE_BLEND_NONE, - TEXTURE_BLEND_BLEND, - TEXTURE_BLEND_ADD, - TEXTURE_BLEND_MODULATE, - TEXTURE_BLEND_LAST +enum mlk_texture_blend { + MLK_TEXTURE_BLEND_NONE, + MLK_TEXTURE_BLEND_BLEND, + MLK_TEXTURE_BLEND_ADD, + MLK_TEXTURE_BLEND_MODULATE, + MLK_TEXTURE_BLEND_LAST }; MLK_CORE_BEGIN_DECLS int -texture_new(struct texture *, unsigned int, unsigned int); +mlk_texture_new(struct mlk_texture *, unsigned int, unsigned int); int -texture_ok(const struct texture *); +mlk_texture_ok(const struct mlk_texture *); int -texture_set_blend_mode(struct texture *, enum texture_blend); +mlk_texture_set_blend_mode(struct mlk_texture *, enum mlk_texture_blend); int -texture_set_alpha_mod(struct texture *, unsigned int); +mlk_texture_set_alpha_mod(struct mlk_texture *, unsigned int); int -texture_set_color_mod(struct texture *, unsigned long); +mlk_texture_set_color_mod(struct mlk_texture *, unsigned long); int -texture_draw(const struct texture *, int, int); +mlk_texture_draw(const struct mlk_texture *, int, int); int -texture_scale(const struct texture *, +mlk_texture_scale(const struct mlk_texture *, int, int, unsigned int, @@ -69,7 +69,7 @@ double); void -texture_finish(struct texture *); +mlk_texture_finish(struct mlk_texture *); MLK_CORE_END_DECLS
--- a/libmlk-core/mlk/core/texture_p.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-core/mlk/core/texture_p.h Mon Feb 27 11:24:38 2023 +0100 @@ -21,9 +21,9 @@ #include <SDL.h> -struct texture; +struct mlk_texture; int -texture_from_surface(struct texture *, SDL_Surface *); +texture_from_surface(struct mlk_texture *, SDL_Surface *); #endif /* !MLK_CORE_TEXTURE_P_H */
--- a/libmlk-example/mlk/example/registry.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-example/mlk/example/registry.c Mon Feb 27 11:24:38 2023 +0100 @@ -36,8 +36,8 @@ #include "registry.h" -struct texture registry_images[REGISTRY_IMAGE_NUM]; -struct texture registry_textures[REGISTRY_TEXTURE_NUM]; +struct mlk_texture registry_images[REGISTRY_IMAGE_NUM]; +struct mlk_texture registry_textures[REGISTRY_TEXTURE_NUM]; struct mlk_sprite registry_sprites[REGISTRY_TEXTURE_NUM]; struct mlk_sound registry_sounds[REGISTRY_SOUND_NUM]; @@ -85,7 +85,7 @@ load_images(void) { for (size_t i = 0; i < UTIL_SIZE(images); ++i) { - struct texture *texture = ®istry_images[images[i].index]; + struct mlk_texture *texture = ®istry_images[images[i].index]; if (mlk_image_openmem(texture, images[i].data, images[i].datasz) < 0) mlk_panic(); @@ -96,7 +96,7 @@ load_textures_and_sprites(void) { for (size_t i = 0; i < UTIL_SIZE(textures); ++i) { - struct texture *texture = ®istry_textures[textures[i].index]; + struct mlk_texture *texture = ®istry_textures[textures[i].index]; struct mlk_sprite *sprite = ®istry_sprites[textures[i].index]; if (mlk_image_openmem(texture, textures[i].data, textures[i].datasz) < 0) @@ -132,9 +132,9 @@ registry_finish(void) { for (size_t i = 0; i < UTIL_SIZE(registry_images); ++i) - texture_finish(®istry_images[i]); + mlk_texture_finish(®istry_images[i]); for (size_t i = 0; i < UTIL_SIZE(registry_textures); ++i) - texture_finish(®istry_textures[i]); + mlk_texture_finish(®istry_textures[i]); for (size_t i = 0; i < UTIL_SIZE(registry_sounds); ++i) mlk_sound_finish(®istry_sounds[i]); }
--- a/libmlk-example/mlk/example/registry.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-example/mlk/example/registry.h Mon Feb 27 11:24:38 2023 +0100 @@ -52,8 +52,8 @@ REGISTRY_SOUND_NUM }; -extern struct texture registry_images[REGISTRY_IMAGE_NUM]; -extern struct texture registry_textures[REGISTRY_TEXTURE_NUM]; +extern struct mlk_texture registry_images[REGISTRY_IMAGE_NUM]; +extern struct mlk_texture registry_textures[REGISTRY_TEXTURE_NUM]; extern struct mlk_sprite registry_sprites[REGISTRY_TEXTURE_NUM]; extern struct mlk_sound registry_sounds[REGISTRY_SOUND_NUM];
--- a/libmlk-rpg/mlk/rpg/battle-entity-state-blinking.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-entity-state-blinking.c Mon Feb 27 11:24:38 2023 +0100 @@ -60,7 +60,7 @@ assert(battle_entity_ok(et)); blk->tex = et->ch->sprites[CHARACTER_SPRITE_NORMAL]->texture; - texture_set_alpha_mod(blk->tex, TRANSPARENT); + mlk_texture_set_alpha_mod(blk->tex, TRANSPARENT); } int @@ -75,7 +75,7 @@ blk->elapsed = 0; } - texture_set_alpha_mod(blk->tex, blk->count % 2 == 0 ? TRANSPARENT : OPAQUE); + mlk_texture_set_alpha_mod(blk->tex, blk->count % 2 == 0 ? TRANSPARENT : OPAQUE); return blk->count >= 3; }
--- a/libmlk-rpg/mlk/rpg/battle-entity-state-blinking.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-entity-state-blinking.h Mon Feb 27 11:24:38 2023 +0100 @@ -20,10 +20,10 @@ #define MLK_RPG_BATTLE_ENTITY_STATE_BLINKING_H struct battle_entity; -struct texture; +struct mlk_texture; struct battle_entity_state_blinking { - struct texture *tex; + struct mlk_texture *tex; unsigned int elapsed; unsigned int count; };
--- a/libmlk-rpg/mlk/rpg/battle-entity.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-entity.c Mon Feb 27 11:24:38 2023 +0100 @@ -50,7 +50,7 @@ assert(et); character_reset(et->ch); - texture_set_alpha_mod(et->ch->sprites[CHARACTER_SPRITE_NORMAL]->texture, 255); + mlk_texture_set_alpha_mod(et->ch->sprites[CHARACTER_SPRITE_NORMAL]->texture, 255); battle_entity_state_normal(et); }
--- a/libmlk-rpg/mlk/rpg/battle-indicator.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-indicator.c Mon Feb 27 11:24:38 2023 +0100 @@ -78,7 +78,7 @@ int battle_indicator_ok(const struct battle_indicator *bti) { - return bti && texture_ok(&bti->tex[0]) && texture_ok(&bti->tex[1]); + return bti && mlk_texture_ok(&bti->tex[0]) && mlk_texture_ok(&bti->tex[1]); } int @@ -100,13 +100,13 @@ 255 ); - texture_set_color_mod(&bti->tex[0], bti->cur); + mlk_texture_set_color_mod(&bti->tex[0], bti->cur); } else { /* Update alpha next. */ bti->alpha -= 10; - texture_set_alpha_mod(&bti->tex[0], bti->alpha); - texture_set_alpha_mod(&bti->tex[1], bti->alpha); + mlk_texture_set_alpha_mod(&bti->tex[0], bti->alpha); + mlk_texture_set_alpha_mod(&bti->tex[1], bti->alpha); } } @@ -118,8 +118,8 @@ { assert(battle_indicator_ok(bti)); - texture_draw(&bti->tex[1], x + 1, y + 1); - texture_draw(&bti->tex[0], x, y); + mlk_texture_draw(&bti->tex[1], x + 1, y + 1); + mlk_texture_draw(&bti->tex[0], x, y); } void @@ -127,8 +127,8 @@ { assert(bti); - texture_finish(&bti->tex[0]); - texture_finish(&bti->tex[1]); + mlk_texture_finish(&bti->tex[0]); + mlk_texture_finish(&bti->tex[1]); memset(bti, 0, sizeof (*bti)); }
--- a/libmlk-rpg/mlk/rpg/battle-indicator.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-indicator.h Mon Feb 27 11:24:38 2023 +0100 @@ -34,7 +34,7 @@ unsigned int cur; unsigned int elapsed; unsigned int alpha; - struct texture tex[2]; + struct mlk_texture tex[2]; }; MLK_CORE_BEGIN_DECLS
--- a/libmlk-rpg/mlk/rpg/battle-state-check.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-state-check.c Mon Feb 27 11:24:38 2023 +0100 @@ -67,9 +67,9 @@ const struct fadeout *fade = dw->data; struct mlk_sprite *sprite = fade->ch->sprites[CHARACTER_SPRITE_NORMAL]; - texture_set_alpha_mod(sprite->texture, fade->alpha); + mlk_texture_set_alpha_mod(sprite->texture, fade->alpha); mlk_sprite_draw(sprite, 0, 0, fade->x, fade->y); - texture_set_alpha_mod(sprite->texture, 255); + mlk_texture_set_alpha_mod(sprite->texture, 255); } static void
--- a/libmlk-rpg/mlk/rpg/battle-state-closing.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-state-closing.c Mon Feb 27 11:24:38 2023 +0100 @@ -65,17 +65,17 @@ { assert(cls); - if (texture_new(&cls->texture, window.w, window.h) < 0) + if (mlk_texture_new(&cls->texture, window.w, window.h) < 0) mlk_panic(); MLK_PAINTER_BEGIN(&cls->texture); - texture_set_blend_mode(&cls->texture, TEXTURE_BLEND_BLEND); + mlk_texture_set_blend_mode(&cls->texture, MLK_TEXTURE_BLEND_BLEND); mlk_painter_set_color(0x000000ff); mlk_painter_clear(); mlk_painter_draw_rectangle(0, 0, window.w, window.h); MLK_PAINTER_END(); - texture_set_alpha_mod(&cls->texture, 0); + mlk_texture_set_alpha_mod(&cls->texture, 0); } int @@ -98,7 +98,7 @@ } cls->alpha += 5; - texture_set_alpha_mod(&cls->texture, cls->alpha); + mlk_texture_set_alpha_mod(&cls->texture, cls->alpha); } return 0; @@ -110,7 +110,7 @@ assert(cls); battle_draw_component(bt, BATTLE_COMPONENT_ALL); - texture_draw(&cls->texture, 0, 0); + mlk_texture_draw(&cls->texture, 0, 0); } void @@ -118,7 +118,7 @@ { assert(cls); - texture_finish(&cls->texture); + mlk_texture_finish(&cls->texture); memset(cls, 0, sizeof (*cls)); }
--- a/libmlk-rpg/mlk/rpg/battle-state-closing.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-state-closing.h Mon Feb 27 11:24:38 2023 +0100 @@ -24,7 +24,7 @@ struct battle; struct battle_state_closing { - struct texture texture; + struct mlk_texture texture; unsigned int alpha; unsigned int elapsed; };
--- a/libmlk-rpg/mlk/rpg/battle.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle.c Mon Feb 27 11:24:38 2023 +0100 @@ -468,8 +468,8 @@ { assert(bt); - if ((comp & BATTLE_COMPONENT_BACKGROUND) && texture_ok(bt->background)) - texture_scale(bt->background, + if ((comp & BATTLE_COMPONENT_BACKGROUND) && mlk_texture_ok(bt->background)) + mlk_texture_scale(bt->background, 0, 0, bt->background->w, bt->background->h, 0, 0, window.w, window.h, 0.f);
--- a/libmlk-rpg/mlk/rpg/battle.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle.h Mon Feb 27 11:24:38 2023 +0100 @@ -77,7 +77,7 @@ struct battle_entity **order; struct battle_entity **ordercur; size_t ordersz; - struct texture *background; + struct mlk_texture *background; struct mlk_music *music[3]; struct theme *theme; struct mlk_drawable_stack *effects;
--- a/libmlk-rpg/mlk/rpg/equipment.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/equipment.h Mon Feb 27 11:24:38 2023 +0100 @@ -22,7 +22,7 @@ #include <mlk/core/core.h> struct character; -struct texture; +struct mlk_texture; enum equipment_type { /* Attack weapons. */ @@ -48,7 +48,7 @@ const char *description; unsigned int price; enum equipment_type type; - struct texture *icon; + struct mlk_texture *icon; void (*equip)(const struct equipment *, struct character *); };
--- a/libmlk-rpg/mlk/rpg/item.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/item.h Mon Feb 27 11:24:38 2023 +0100 @@ -23,12 +23,12 @@ struct battle; struct character; -struct texture; +struct mlk_texture; struct item { const char *name; const char *description; - struct texture *icon; + struct mlk_texture *icon; void (*exec_menu)(const struct item *, struct character *);
--- a/libmlk-rpg/mlk/rpg/map.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/map.c Mon Feb 27 11:24:38 2023 +0100 @@ -471,7 +471,7 @@ static inline void draw_layer_tile(const struct map *map, const struct map_layer *layer, - struct texture *colbox, + struct mlk_texture *colbox, int start_col, int start_row, int start_x, @@ -499,8 +499,8 @@ tileset_draw(map->tileset, sr, sc, mx, my); - if ((td = find_tiledef_by_id(map, id)) && texture_ok(colbox)) - texture_scale(colbox, 0, 0, 5, 5, mx + td->x, my + td->y, td->w, td->h, 0); + if ((td = find_tiledef_by_id(map, id)) && mlk_texture_ok(colbox)) + mlk_texture_scale(colbox, 0, 0, 5, 5, mx + td->x, my + td->y, td->w, td->h, 0); if (map->flags & MAP_FLAGS_SHOW_GRID) { mlk_painter_set_color(0x202e37ff); @@ -529,15 +529,15 @@ const unsigned int ncols = (map->view_w / map->tileset->sprite->cellw) + 2; const unsigned int nrows = (map->view_h / map->tileset->sprite->cellh) + 2; - struct texture colbox = {0}; + struct mlk_texture colbox = {0}; if (!layer->tiles) return; /* Show collision box if requested. */ - if (map->flags & MAP_FLAGS_SHOW_COLLIDE && texture_new(&colbox, 16, 16) == 0) { - texture_set_blend_mode(&colbox, TEXTURE_BLEND_BLEND); - texture_set_alpha_mod(&colbox, 100); + if (map->flags & MAP_FLAGS_SHOW_COLLIDE && mlk_texture_new(&colbox, 16, 16) == 0) { + mlk_texture_set_blend_mode(&colbox, MLK_TEXTURE_BLEND_BLEND); + mlk_texture_set_alpha_mod(&colbox, 100); MLK_PAINTER_BEGIN(&colbox); mlk_painter_set_color(0xa53030ff); mlk_painter_clear(); @@ -554,23 +554,23 @@ } } - texture_finish(&colbox); + mlk_texture_finish(&colbox); } static void draw_collide(const struct map *map) { - struct texture box = {0}; + struct mlk_texture box = {0}; - if (map->flags & MAP_FLAGS_SHOW_COLLIDE && texture_new(&box, 64, 64) == 0) { + if (map->flags & MAP_FLAGS_SHOW_COLLIDE && mlk_texture_new(&box, 64, 64) == 0) { /* Draw collide box around player if requested. */ - texture_set_alpha_mod(&box, 100); - texture_set_blend_mode(&box, TEXTURE_BLEND_BLEND); + mlk_texture_set_alpha_mod(&box, 100); + mlk_texture_set_blend_mode(&box, MLK_TEXTURE_BLEND_BLEND); MLK_PAINTER_BEGIN(&box); mlk_painter_set_color(0x4f8fbaff); mlk_painter_clear(); MLK_PAINTER_END(); - texture_scale(&box, 0, 0, 64, 64, + mlk_texture_scale(&box, 0, 0, 64, 64, map->player_x - map->view_x, map->player_y - map->view_y, map->player_sprite->cellw, map->player_sprite->cellh, 0.f); @@ -581,13 +581,13 @@ MLK_PAINTER_END(); for (size_t i = 0; i < map->blocksz; ++i) { - texture_scale(&box, 0, 0, 64, 64, + mlk_texture_scale(&box, 0, 0, 64, 64, map->blocks[i].x - map->view_x, map->blocks[i].y - map->view_y, map->blocks[i].w, map->blocks[i].h, 0.f); } - texture_finish(&box); + mlk_texture_finish(&box); } }
--- a/libmlk-rpg/mlk/rpg/message.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/message.c Mon Feb 27 11:24:38 2023 +0100 @@ -262,7 +262,7 @@ { assert(msg); - struct texture tex; + struct mlk_texture tex; int x, y; unsigned int w, h; @@ -271,7 +271,7 @@ return; } - if (texture_new(&tex, msg->w, msg->h) < 0) + if (mlk_texture_new(&tex, msg->w, msg->h) < 0) mlk_panic(); MLK_PAINTER_BEGIN(&tex); @@ -287,8 +287,8 @@ align(ALIGN_CENTER, &x, &y, w, h, msg->x, msg->y, msg->w, msg->h); /* Draw and clear. */ - texture_scale(&tex, 0, 0, msg->w, msg->h, x, y, w, h, 0); - texture_finish(&tex); + mlk_texture_scale(&tex, 0, 0, msg->w, msg->h, x, y, w, h, 0); + mlk_texture_finish(&tex); } void
--- a/libmlk-rpg/mlk/rpg/tileset-file.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/tileset-file.c Mon Feb 27 11:24:38 2023 +0100 @@ -65,7 +65,7 @@ */ struct tileset_animation_block { - struct texture texture; + struct mlk_texture texture; struct mlk_sprite sprite; struct mlk_animation animation; }; @@ -94,7 +94,7 @@ { struct tileset_animation_block *anim = data; - texture_finish(&anim->texture); + mlk_texture_finish(&anim->texture); } static int @@ -330,7 +330,7 @@ mlk_alloc_pool_finish(&tf->anims[0]); mlk_alloc_pool_finish(&tf->anims[1]); - texture_finish(&tf->image); + mlk_texture_finish(&tf->image); memset(tf, 0, sizeof (*tf)); }
--- a/libmlk-rpg/mlk/rpg/tileset-file.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/tileset-file.h Mon Feb 27 11:24:38 2023 +0100 @@ -32,7 +32,7 @@ struct tileset_file { struct mlk_alloc_pool tiledefs; struct mlk_alloc_pool anims[2]; - struct texture image; + struct mlk_texture image; struct mlk_sprite sprite; };
--- a/libmlk-ui/mlk/ui/debug.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-ui/mlk/ui/debug.c Mon Feb 27 11:24:38 2023 +0100 @@ -58,7 +58,7 @@ char line[DEBUG_LINE_MAX]; const struct theme *theme; struct mlk_font *font; - struct texture tex; + struct mlk_texture tex; int x, y; vsnprintf(line, sizeof (line), fmt, ap); @@ -73,6 +73,6 @@ y = (theme->padding * (report->count + 1)) + (tex.h * (report->count)); report->count++; - texture_draw(&tex, x, y); - texture_finish(&tex); + mlk_texture_draw(&tex, x, y); + mlk_texture_finish(&tex); }
--- a/libmlk-ui/mlk/ui/label.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-ui/mlk/ui/label.c Mon Feb 27 11:24:38 2023 +0100 @@ -33,7 +33,7 @@ assert(label); struct mlk_font *font; - struct texture tex; + struct mlk_texture tex; unsigned long color; font = label->flags & LABEL_FLAGS_IMPORTANT @@ -48,16 +48,16 @@ if (mlk_font_render(font, &tex, label->text, t->colors[THEME_COLOR_SHADOW]) < 0) mlk_panic(); - texture_draw(&tex, label->x + 1, label->y + 1); - texture_finish(&tex); + mlk_texture_draw(&tex, label->x + 1, label->y + 1); + mlk_texture_finish(&tex); } /* Normal text. */ if (mlk_font_render(font, &tex, label->text, color) < 0) mlk_panic(); - texture_draw(&tex, label->x, label->y); - texture_finish(&tex); + mlk_texture_draw(&tex, label->x, label->y); + mlk_texture_finish(&tex); } int
--- a/libmlk-ui/mlk/ui/notify.c Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-ui/mlk/ui/notify.c Mon Feb 27 11:24:38 2023 +0100 @@ -115,7 +115,7 @@ static void draw_icon(const struct geo *geo, const struct notify *n) { - texture_draw(n->icon, geo->icon_x, geo->icon_y); + mlk_texture_draw(n->icon, geo->icon_x, geo->icon_y); } #include <stdio.h> @@ -161,7 +161,7 @@ } void -notify(const struct texture *icon, const char *title, const char *body) +notify(const struct mlk_texture *icon, const char *title, const char *body) { assert(icon); assert(title);
--- a/libmlk-ui/mlk/ui/notify.h Mon Feb 27 11:18:52 2023 +0100 +++ b/libmlk-ui/mlk/ui/notify.h Mon Feb 27 11:24:38 2023 +0100 @@ -26,11 +26,11 @@ #define NOTIFY_MAX (4) #define NOTIFY_TIMEOUT_DEFAULT (5000) -struct texture; +struct mlk_texture; struct theme; struct notify { - const struct texture *icon; + const struct mlk_texture *icon; const char *title; const char *body; unsigned int elapsed; @@ -44,7 +44,7 @@ MLK_CORE_BEGIN_DECLS void -notify(const struct texture *, const char *, const char *); +notify(const struct mlk_texture *, const char *, const char *); void notify_update(unsigned int ticks);