view libmlk-rpg/mlk/rpg/tileset-loader-file.h @ 646:7e1eb7f6c049 default tip @

misc: remove .clang
author David Demelier <markand@malikania.fr>
date Sun, 04 Feb 2024 15:24:37 +0100
parents bb67f935a93f
children
line wrap: on
line source

/*
 * tileset-loader-file.h -- tileset file loader implementation
 *
 * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr>
 *
 * 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 MLK_RPG_TILESET_LOADER_FILE_H
#define MLK_RPG_TILESET_LOADER_FILE_H

/**
 * \file mlk/rpg/tileset-loader-file.h
 * \brief Tileset file loader implementation
 *
 * This convenient tileset loader loads a tileset from file and its associative
 * resources relative to the tileset file directory.
 *
 * It also allocate memory for individual element and as such must be kept
 * valid until the tileset is no longer used. If this behavior is not wanted,
 * the allocator functions can be changed.
 */

#include "tileset-loader.h"

struct mlk_tileset_collision;
struct mlk_tileset_animation;
struct mlk__loader_file;

/**
 * \struct mlk_tileset_loader_file
 * \brief Tileset loader from file.
 */
struct mlk_tileset_loader_file {
	/**
	 * (read-write)
	 *
	 * Underlying tileset loader.
	 */
	struct mlk_tileset_loader iface;
	
	/** \cond MLK_PRIVATE_DECLS */
	struct mlk_tileset_collision *tilecollisions;
	struct mlk_tileset_animation *tileanimations;
	struct mlk__loader_file *lf;
	/** \endcond MLK_PRIVATE_DECLS */
};

#if defined(__cplusplus)
extern "C" {
#endif

/**
 * Initialize this file loader and the underlying abstract tileset loader
 * interface.
 *
 * After loading the tileset with this underlying loader, it should be kept
 * until the tileset is no longer used.
 *
 * \pre file != NULL
 * \pre filename != NULL
 * \param file the file loader
 * \param filename path to the tileset file
 * \return 0 on success or -1 on error
 */
int
mlk_tileset_loader_file_init(struct mlk_tileset_loader_file *file, const char *filename);

#if defined(__cplusplus)
}
#endif

#endif /* !MLK_RPG_TILESET_LOADER_FILE_H */