#include <string.h>
#include "mape/cpp-handles/mapgen-handle.h"
#include "mape/cpp-handles/material-handle.h"
#include "mape/cpp-handles/texture-handle.h"
#include "mape/mapgen.h"
Go to the source code of this file.
Functions | |
C4GroupHandle * | _mape_group_get_handle (MapeGroup *group) |
C4MaterialMapHandle * | _mape_material_map_get_handle (MapeMaterialMap *map) |
gboolean | mape_mapgen_init (GError **error) |
void | mape_mapgen_deinit () |
void | mape_mapgen_set_root_group (MapeGroup *group) |
GdkPixbuf * | mape_mapgen_render (const gchar *filename, const gchar *source, MapeMapgenType type, const gchar *script_path, MapeMaterialMap *material_map, MapeTextureMap *texture_map, guint width, guint height, GError **error) |
as a | |
32-bit integer. | |
C4TextureMapHandle * | _mape_texture_map_get_handle (MapeTextureMap *map) |
C4GroupHandle* _mape_group_get_handle | ( | MapeGroup * | group | ) |
SECTION:mape-group @title: MapeGroup @short_description: C4Group interface mape/group.h @stability: Unstable
MapeGroup is a simple GObject-based interface to C4Group. It currntly only supports a subset of the C4Group operations, it does not support writing groups for example. It is just enough for what Mape requires.
Definition at line 682 of file group.c.
Referenced by mape_mapgen_set_root_group().
C4MaterialMapHandle * _mape_material_map_get_handle | ( | MapeMaterialMap * | map | ) |
Definition at line 396 of file material.c.
References MAPE_IS_MATERIAL_MAP, and MAPE_MATERIAL_MAP_PRIVATE.
Referenced by mape_mapgen_render().
C4TextureMapHandle * _mape_texture_map_get_handle | ( | MapeTextureMap * | map | ) |
Definition at line 591 of file texture.c.
References MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
Referenced by mape_mapgen_render().
void mape_mapgen_deinit | ( | ) |
Deinitializes the map generator.
Definition at line 156 of file mapgen.c.
References c4_mapgen_handle_deinit_script_engine().
gboolean mape_mapgen_init | ( | GError ** | error | ) |
mape_mapgen_init: @error: Location to store error information, if any.
Initializes the map generator.
Returns: TRUE on success or FALSE on error.
Definition at line 144 of file mapgen.c.
References c4_mapgen_handle_init_script_engine().
GdkPixbuf* mape_mapgen_render | ( | const gchar * | filename, |
const gchar * | source, | ||
MapeMapgenType | type, | ||
const gchar * | script_path, | ||
MapeMaterialMap * | material_map, | ||
MapeTextureMap * | texture_map, | ||
guint | width, | ||
guint | height, | ||
GError ** | error | ||
) |
mape_mapgen_render:
@filename: The filename of the file that is being parsed. This is only used for display purposes. @source: The map generator source code for the map to generate. @type: Specifies how the text in @source should be interpreted. Must not be MAPE_MAPGEN_NONE. @script_path: Path to the script source for algo=script overlays, or NULL. @material_map: The material map containing the materials to be used during map generation. @texture_map: The texture map containing the textures to be used during map generation. @width: The width of the map to generate. @height: The height of the map to generate. @error: Location to store error information, if any, or NULL.
Renders the map described by @source with the C4MapCreatorS2 into a pixbuf. The pixel color depends on the texture at the corresponding position and is determined by the average color of that texture.
If the source contains one or more algo=script overlays and @script_path is NULL, an error is generated. Otherwise, the file at @script_path is opened and used to look up the relevant script functions.
In case an error occurs, for example when the map generator source code is not valid, @error is set and the function returns NULL.
Return Value: A #GdkPixbuf with the generated map, or NULL. Free with g_object_unref().
Definition at line 227 of file mapgen.c.
References _mape_material_map_get_handle(), _mape_texture_map_get_handle(), c4_mapgen_handle_get_error(), c4_mapgen_handle_new(), c4_mapgen_handle_new_script(), MAPE_MAPGEN_LANDSCAPE_TXT, and MAPE_MAPGEN_MAP_C.
void mape_mapgen_set_root_group | ( | MapeGroup * | group | ) |
mape_mapgen_set_root_group: @group: The root group.
Sets the root group for the map generator. This group is used to lookup the Library_Map definition.
Definition at line 169 of file mapgen.c.
References _mape_group_get_handle(), c4_mapgen_handle_set_map_library(), and mape_group_open_child().