Ylva And Malin
Data Structures | Macros | Functions
ym_gfx_sprite.c File Reference
#include <ym_gfx_sprite.h>
#include <lodepng.h>
Include dependency graph for ym_gfx_sprite.c:

Data Structures

struct  sprite_sheet
 Sprite sheet "container interaction". More...
 

Macros

#define MAX_SPRITE_SHEETS   256
 

Functions

ym_errc add_sheet_ (uint row_count, uint col_count, GLuint texture_id, ym_sheet_id *out_id)
 
sprite_sheetget_sheets_ (int *out_count)
 
ym_errc ym_gfx_load_png (const char *filename, u8 **out_image, int *out_width, int *out_height)
 PNG loading. More...
 
ym_errc ym_sprite_init (ym_mem_region *region, ym_gfx_window *window)
 ym_sprite API implementation More...
 
ym_errc ym_sprite_shutdown ()
 
ym_errc ym_sprite_load_sheet (const char *filename, uint col_count, uint row_count, ym_sheet_id *out_sheet_id)
 
ym_errc ym_sprite_delete_sheet (ym_sheet_id sheet_id)
 
ym_errc ym_sprite_draw (ym_sheet_id sheet_id, ym_sprite_id sprite_id, uint layer, ym_vec2 pos)
 
ym_errc ym_sprite_draw_extd (ym_sheet_id sheet_id, ym_sprite_id sprite_id, uint layer, ym_vec2 pos, ym_vec2 scale, float angle)
 
void ym_sprite_set_camera_pos (ym_vec3 camera_pos)
 

Macro Definition Documentation

#define MAX_SPRITE_SHEETS   256

Function Documentation

ym_errc add_sheet_ ( uint  row_count,
uint  col_count,
GLuint  texture_id,
ym_sheet_id out_id 
)

Here is the caller graph for this function:

sprite_sheet* get_sheets_ ( int out_count)
ym_errc ym_gfx_load_png ( const char *  filename,
u8 **  out_image,
int out_width,
int out_height 
)

PNG loading.

Todo:
Move over to using the lodepng function that takes in memory

Here is the call graph for this function:

Here is the caller graph for this function:

ym_errc ym_sprite_delete_sheet ( ym_sheet_id  sheet_id)
ym_errc ym_sprite_draw ( ym_sheet_id  sheet_id,
ym_sprite_id  sprite_id,
uint  layer,
ym_vec2  pos 
)
Todo:
Add layering support

Here is the call graph for this function:

Here is the caller graph for this function:

ym_errc ym_sprite_draw_extd ( ym_sheet_id  sheet_id,
ym_sprite_id  sprite_id,
uint  layer,
ym_vec2  pos,
ym_vec2  scale,
float  angle 
)
Todo:
add layering support

Here is the call graph for this function:

Here is the caller graph for this function:

ym_errc ym_sprite_init ( ym_mem_region region,
ym_gfx_window window 
)

ym_sprite API implementation

Here is the call graph for this function:

Here is the caller graph for this function:

ym_errc ym_sprite_load_sheet ( const char *  filename,
uint  col_count,
uint  row_count,
ym_sheet_id out_sheet_id 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void ym_sprite_set_camera_pos ( ym_vec3  camera_pos)

Here is the call graph for this function:

Here is the caller graph for this function:

ym_errc ym_sprite_shutdown ( )

Here is the caller graph for this function:

Variable Documentation

GLint atlas_col_count
GLint atlas_row_count
GLint color
GLuint ibo
GLuint ibo_size
GLint mvp
ym_mat4 projection_matrix
GLuint shader_program
GLuint shaders[2]
GLint texture_id
GLuint texture_vbo
struct { ... } uniforms
GLuint vao
GLuint vbo
ym_mat4 view_matrix