#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "mape/material.h"
#include "mape/texture.h"
Go to the source code of this file.
Typedefs | |
typedef G_BEGIN_DECLS enum _MapeMapgenError | MapeMapgenError |
typedef enum _MapeMapgenType | MapeMapgenType |
Enumerations | |
enum | _MapeMapgenError { MAPE_MAPGEN_ERROR_COMPILE, MAPE_MAPGEN_ERROR_MEMORY } |
enum | _MapeMapgenType { MAPE_MAPGEN_NONE, MAPE_MAPGEN_LANDSCAPE_TXT, MAPE_MAPGEN_MAP_C } |
Functions | |
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) |
typedef G_BEGIN_DECLS enum _MapeMapgenError MapeMapgenError |
MapeMapgenError: : An error occured while compiling the Landscape.txt source code. : Insufficient memory was available to render the map.
These errors are from the MAPE_MAPGEN_ERROR error domain. They can occur when rendering a map from a Landscape.txt file.
typedef enum _MapeMapgenType MapeMapgenType |
MapeMapgenType: : Does not represent a map description. : Represents a Landscape.txt script. : Represents a Map.c script.
Specifies the different types of maps that can be rendered.
enum _MapeMapgenError |
MapeMapgenError: : An error occured while compiling the Landscape.txt source code. : Insufficient memory was available to render the map.
These errors are from the MAPE_MAPGEN_ERROR error domain. They can occur when rendering a map from a Landscape.txt file.
Enumerator | |
---|---|
MAPE_MAPGEN_ERROR_COMPILE | |
MAPE_MAPGEN_ERROR_MEMORY |
enum _MapeMapgenType |
MapeMapgenType: : Does not represent a map description. : Represents a Landscape.txt script. : Represents a Map.c script.
Specifies the different types of maps that can be rendered.
Enumerator | |
---|---|
MAPE_MAPGEN_NONE | |
MAPE_MAPGEN_LANDSCAPE_TXT | |
MAPE_MAPGEN_MAP_C |
Definition at line 50 of file mapgen.h.
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: : 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:
: The filename of the file that is being parsed. This is only used for display purposes. : The map generator source code for the map to generate. : Specifies how the text in should be interpreted. Must not be MAPE_MAPGEN_NONE. : Path to the script source for algo=script overlays, or NULL. : The material map containing the materials to be used during map generation. : The texture map containing the textures to be used during map generation. : The width of the map to generate. : The height of the map to generate. : Location to store error information, if any, or NULL.
Renders the map described by 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 is NULL, an error is generated. Otherwise, the file at 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, 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(), _C4MapgenHandle::error_message, MAPE_MAPGEN_LANDSCAPE_TXT, and MAPE_MAPGEN_MAP_C.
void mape_mapgen_set_root_group | ( | MapeGroup * | group | ) |
mape_mapgen_set_root_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().