update stuff

This commit is contained in:
Maix0 2024-05-20 00:35:39 +02:00
parent 5973022688
commit 544ed8b045
194 changed files with 2060 additions and 1464 deletions

View file

@ -35,19 +35,63 @@ typedef struct s_sprite
bool big_endian;
} t_sprite;
bool blx_sprite_from_xpm(t_blx *ctx, t_str path,
/// @brief Create a sprite from an XPM file
/// @param ctx the BLX context
/// @param path the path to the XPM file
/// @param[out] out the output sprite
/// @return true if an error occured, false otherwise
t_error blx_sprite_from_xpm(t_blx *ctx, t_str path,
t_sprite *out);
bool blx_sprite_new(t_blx *ctx, t_i32 width, t_i32 height,
/// @brief Create a new sprite
/// @param ctx the BLX context
/// @param width the width of the sprite in pixels
/// @param height the height of the sprite in pixels
/// @param out[out] the output sprite
/// @return true if an error occured, false otherwise
t_error blx_sprite_new(t_blx *ctx, t_i32 width, t_i32 height,
t_sprite *out);
/// @brief Free a sprite
/// @param img the sprite to free
void blx_sprite_free(t_sprite img);
/// @brief Draw a sprite at a position onto the screen
/// @param ctx the BLX context
/// @param pos the position to draw the sprite at
/// @param img the sprite to draw
void blx_draw_sprite_raw(t_blx *ctx, t_vi2d pos,
t_sprite *img);
/// @brief Draw a pixel onto the sprite
/// @param img the sprite to draw onto
/// @param pos the position to draw the pixel at
/// @param col the color of the pixel
void sprite_draw(t_sprite *img, t_vi2d pos, t_color col);
/// @brief Clear a sprite with a color
/// @param img the sprite to clear
/// @param col the color to clear the sprite with
void sprite_clear(t_sprite *img, t_color col);
bool sprite_get_pixel(t_sprite *spr, t_vi2d pos,
/// @brief Get the color of a pixel on a sprite
/// @param spr the sprite to get the pixel from
/// @param pos the position of the pixel
/// @param[out] out the color of the pixel
/// @return true if an error occured, false otherwise
t_error sprite_get_pixel(t_sprite *spr, t_vi2d pos,
t_color *out);
/// @brief Draw a sprite onto another sprite
/// @param dest The sprite to be drawn onto
/// @param pos The position to draw the sprite at
/// @param source The sprite to draw
void sprite_draw_onto(t_sprite *dest, t_vi2d pos,
t_sprite *source);
/// @brief Draw a string onto a sprite
/// @param spr The sprite to draw onto
/// @param pos The position to draw the string at
/// @param sText The string to draw
/// @param col The color of the string
void sprite_draw_string(t_sprite *spr, t_vi2d pos,
t_const_str sText, t_color col);