summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tileset.c45
-rw-r--r--src/tileset.h9
2 files changed, 54 insertions, 0 deletions
diff --git a/src/tileset.c b/src/tileset.c
index 382220d..0871602 100644
--- a/src/tileset.c
+++ b/src/tileset.c
@@ -28,6 +28,7 @@
struct db_tileset {
char *game_id;
SDL_Surface *image;
+ SDL_Texture *texture;
int tw;
int th;
int tc;
@@ -410,3 +411,47 @@ db_tileset_new(const char *game_id, const char *file, int firstgid,
return tileset;
}
+
+int
+db_tileset_tilewidth(struct db_tileset *tileset)
+{
+ return tileset->tw;
+}
+
+int
+db_tileset_tileheight(struct db_tileset *tileset)
+{
+ return tileset->th;
+}
+
+int
+db_tileset_tilecount(struct db_tileset *tileset)
+{
+ return tileset->tc;
+}
+
+int
+db_tileset_columns(struct db_tileset *tileset)
+{
+ return tileset->cols;
+}
+
+int
+db_tileset_firstgid(struct db_tileset *tileset)
+{
+ return tileset->firstgid;
+}
+
+struct db_tileset *
+db_tileset_next(struct db_tileset *tileset)
+{
+ return tileset->next;
+}
+
+int
+db_tileset_create_texture(struct db_tileset *tileset, SDL_Renderer *renderer)
+{
+ tileset->texture = SDL_CreateTextureFromSurface(renderer,
+ tileset->image);
+ return (tileset->texture != NULL ? 0 : -1);
+}
diff --git a/src/tileset.h b/src/tileset.h
index 7a3a06a..8d660b7 100644
--- a/src/tileset.h
+++ b/src/tileset.h
@@ -24,5 +24,14 @@ struct db_tileset;
struct db_tileset *db_tileset_new(const char *game_id, const char *file,
int firstgid, struct db_tileset *prev);
+int db_tileset_tilewidth (struct db_tileset *tileset) __attribute__((__pure__));
+int db_tileset_tileheight(struct db_tileset *tileset) __attribute__((__pure__));
+int db_tileset_tilecount (struct db_tileset *tileset) __attribute__((__pure__));
+int db_tileset_columns (struct db_tileset *tileset) __attribute__((__pure__));
+int db_tileset_firstgid (struct db_tileset *tileset) __attribute__((__pure__));
+struct db_tileset *db_tileset_next(struct db_tileset *tileset)
+ __attribute__((__pure__));
+int db_tileset_create_texture(struct db_tileset *tileset,
+ SDL_Renderer *renderer);
#endif /* DB_TILESET_H_ */