Mercurial > molko
diff libmlk-core/core/sprite.h @ 253:c4da052c0def
core: goodbye doxygen
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 03 Dec 2020 09:06:52 +0100 |
parents | 71b3b7036de7 |
children | cc676046aac9 |
line wrap: on
line diff
--- a/libmlk-core/core/sprite.h Tue Dec 01 21:53:23 2020 +0100 +++ b/libmlk-core/core/sprite.h Thu Dec 03 09:06:52 2020 +0100 @@ -19,92 +19,27 @@ #ifndef MOLKO_CORE_SPRITE_H #define MOLKO_CORE_SPRITE_H -/** - * \file sprite.h - * \brief Image sprites. - * \ingroup drawing - * - * The sprite is a module to help rendering a large image that is split into - * individual parts. This improves memory usage as several images are loaded - * in a unique one instead of individual parts. - * - * Example of sprite. - * - * ``` - * +---+---+---+ - * | 0 | 1 | 2 | - * +---+---+---+ - * | 3 | 4 | 5 | - * +---+---+---+ - * ``` - * - * If an image is designed like this grid, it contains three columns and 2 rows. - * - * \note The image may not contain space, margins or padding within each cell. - */ - #include <stdbool.h> struct texture; -/** - * \brief Sprite structure. - */ struct sprite { - struct texture *texture; /*!< (+&) Texture to access. */ - unsigned int cellw; /*!< (-) Width per cell. */ - unsigned int cellh; /*!< (-) Height per cell. */ - unsigned int nrows; /*!< (-) Number of rows. */ - unsigned int ncols; /*!< (-) Number of columns. */ + struct texture *texture; + unsigned int cellw; + unsigned int cellh; + unsigned int nrows; + unsigned int ncols; }; -/** - * Initialize a sprite. - * - * The sprite does not take ownership of texture and must be valid until the - * sprite is no longer used. - * - * This function is only provided as convenience, user may initialize the - * sprite by itself if wanted. - * - * The fields `nrows' and `ncols' will be determined automatically from the - * texture size. - * - * \pre sprite != NULL - * \pre tex != NULL && texture_ok(tex) - * \param sprite the sprite to initialize - * \param tex the texture - * \param cellw the width per cell in pixels - * \param cellh the height per cell in pixels - */ void sprite_init(struct sprite *sprite, struct texture *tex, unsigned int cellw, unsigned int cellh); -/** - * Tells if the sprite has a texture and isn't null sized. - * - * \param sprite the sprite to check (may be NULL) - * \return True if it is initialized correctly. - */ bool sprite_ok(const struct sprite *sprite); -/** - * Draw the sprite component from row `r' and column `c'. - * - * \pre r < sprite->nrows - * \pre c < sprite->ncols - * \pre sprite != NULL - * \param sprite the sprite to draw - * \param r the row number - * \param c the column number - * \param x the X destination - * \param y the Y destination - * \return False in case of rendering error. - */ bool sprite_draw(const struct sprite *sprite, unsigned int r, unsigned int c, int x, int y);