Atrinik Client  4.0
Functions | Variables
texture.c File Reference
#include <global.h>
#include <toolkit/string.h>

Go to the source code of this file.

Functions

static void texture_data_free (texture_struct *tmp)
 
static int texture_data_new (texture_struct *tmp)
 
static void texture_free (texture_struct *tmp)
 
static texture_structtexture_new (texture_type_t type, const char *name)
 
void texture_init (void)
 
void texture_deinit (void)
 
void texture_delete (texture_struct *texture)
 
void texture_reload (void)
 
void texture_gc (void)
 
texture_structtexture_get (texture_type_t type, const char *name)
 
SDL_Surface * texture_surface (texture_struct *texture)
 

Variables

static texture_structtextures [TEXTURE_TYPE_NUM]
 

Detailed Description

Texture management.

Author
Alex Tokar

Definition in file texture.c.

Function Documentation

static void texture_data_free ( texture_struct tmp)
static

Free texture's data (ie, its surface).

Parameters
tmpTexture.

Definition at line 45 of file texture.c.

static int texture_data_new ( texture_struct tmp)
static

(Re-)create texture's data (the surface).

Parameters
tmpTexture.
Returns
1 on success, 0 on failure.

Definition at line 60 of file texture.c.

void texture_deinit ( void  )

Deinitialize the texture API.

Definition at line 190 of file texture.c.

void texture_delete ( texture_struct texture)

Delete the specified texture.

Definition at line 208 of file texture.c.

static void texture_free ( texture_struct tmp)
static

Free a texture.

Parameters
tmpTexture to free.

Definition at line 138 of file texture.c.

void texture_gc ( void  )

Garbage-collect textures.

Definition at line 238 of file texture.c.

texture_struct* texture_get ( texture_type_t  type,
const char *  name 
)

Find specified texture in the hash table, allocating it if necessary.

Parameters
typeType of the texture to look for.
nameName of the texture.
Returns
The texture; never NULL.

Definition at line 279 of file texture.c.

void texture_init ( void  )

Initialize the texture API.

Definition at line 176 of file texture.c.

static texture_struct* texture_new ( texture_type_t  type,
const char *  name 
)
static

Allocate a new texture structure.

Parameters
typeType of the texture, one of texture_type_t.
nameName of the texture.
Returns
The allocated texture; NULL on failure.

Definition at line 154 of file texture.c.

void texture_reload ( void  )

Reload all textures.

Definition at line 221 of file texture.c.

SDL_Surface* texture_surface ( texture_struct texture)

Acquire texture's surface.

Parameters
textureTexture.
Returns
Texture's surface, never NULL.

Definition at line 303 of file texture.c.

Variable Documentation

texture_struct* textures[TEXTURE_TYPE_NUM]
static

All the textures.

Definition at line 38 of file texture.c.