work-in-progress for 3d triangle rendering
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static SDL_Surface *image_to_surface(char *path) {
|
||||
static SDL_Surface *image_to_surface(const char *path) {
|
||||
SDL_RWops *handle = PHYSFSRWOPS_openRead(path);
|
||||
if (handle == NULL)
|
||||
goto fail;
|
||||
@@ -236,7 +236,7 @@ void textures_dump_atlases(struct texture_cache *cache) {
|
||||
}
|
||||
|
||||
|
||||
void textures_load(struct texture_cache *cache, char *path) {
|
||||
void textures_load(struct texture_cache *cache, const char *path) {
|
||||
/* no need to do anything if it was loaded already */
|
||||
if (shgeti(cache->hash, path) >= 0 || shgeti(cache->loner_hash, path) >= 0)
|
||||
return;
|
||||
@@ -300,18 +300,19 @@ void textures_update_current_atlas(struct texture_cache *cache) {
|
||||
}
|
||||
|
||||
|
||||
SDL_Rect textures_get_srcrect(struct texture_cache *cache, char *path) {
|
||||
SDL_Rect textures_get_srcrect(struct texture_cache *cache, const char *path) {
|
||||
struct texture_cache_item *texture = shgetp_null(cache->hash, path);
|
||||
if (texture == NULL) {
|
||||
CRY("Texture lookup failed.",
|
||||
"Tried to get texture that isn't loaded.");
|
||||
return (SDL_Rect){ 0, 0, 0, 0 };
|
||||
}
|
||||
|
||||
return texture->value.srcrect;
|
||||
}
|
||||
|
||||
|
||||
int textures_get_atlas_index(struct texture_cache *cache, char *path) {
|
||||
int textures_get_atlas_index(struct texture_cache *cache, const char *path) {
|
||||
struct texture_cache_item *texture = shgetp_null(cache->hash, path);
|
||||
|
||||
/* it might be a loner texture */
|
||||
@@ -339,7 +340,7 @@ SDL_Texture *textures_get_atlas(struct texture_cache *cache, int index) {
|
||||
}
|
||||
|
||||
|
||||
SDL_Texture *textures_get_loner(struct texture_cache *cache, char *path) {
|
||||
SDL_Texture *textures_get_loner(struct texture_cache *cache, const char *path) {
|
||||
struct texture_cache_item *texture = shgetp_null(cache->loner_hash, path);
|
||||
|
||||
if (texture == NULL) {
|
||||
|
Reference in New Issue
Block a user