26 #define RGBA8(r, g, b, a) ((((a)&0xFF)<<24) | (((b)&0xFF)<<16) | (((g)&0xFF)<<8) | (((r)&0xFF)<<0))
28 #define RGBA8_GET_R(c) (((c) >> 0) & 0xFF)
29 #define RGBA8_GET_G(c) (((c) >> 8) & 0xFF)
30 #define RGBA8_GET_B(c) (((c) >> 16) & 0xFF)
31 #define RGBA8_GET_A(c) (((c) >> 24) & 0xFF)
36 #define SF2D_GPUCMD_DEFAULT_SIZE 0x80000
41 #define SF2D_TEMPPOOL_DEFAULT_SIZE 0x80000
46 #define SF2D_DEFAULT_DEPTH 0.5f
537 void sf2d_draw_texture_part_rotate_scale_blend(
const sf2d_texture *texture,
int x,
int y,
float rad,
int tex_x,
int tex_y,
int tex_w,
int tex_h,
float x_scale,
float y_scale, u32 color);
584 float u0,
float v0,
float u1,
float v1,
unsigned int params);
int width
Definition: sf2d.h:142
float v
Definition: sf2d.h:90
void sf2d_draw_quad_uv(const sf2d_texture *texture, float left, float top, float right, float bottom, float u0, float v0, float u1, float v1, unsigned int params)
Draws a texture using custom texture coordinates and parameters.
void sf2d_bind_texture(const sf2d_texture *texture, GPU_TEXUNIT unit)
Binds a texture to a GPU texture unit.
void sf2d_bind_texture_color(const sf2d_texture *texture, GPU_TEXUNIT unit, u32 color)
Binds a texture to a GPU texture unit with a constant color.
sf2d_vector_2f texcoord
Definition: sf2d.h:130
void sf2d_draw_texture(const sf2d_texture *texture, int x, int y)
Draws a texture.
void sf2d_set_scissor_test(GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h)
Sets the scissor test.
int sf2d_init_advanced(int gpucmd_size, int temppool_size)
Initializates the library (with advanced settings)
void sf2d_draw_texture_rotate_hotspot_blend(const sf2d_texture *texture, int x, int y, float rad, float center_x, float center_y, u32 color)
Draws a texture with rotation around a hotspot with a color.
unsigned char b
Definition: sf2d.h:110
void sf2d_set_clear_color(u32 color)
Sets the screen clear color.
unsigned char a
Definition: sf2d.h:111
sf2d_place place
Definition: sf2d.h:138
void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side)
Starts a frame.
void sf2d_set_3D(int enable)
Enables or disables the 3D.
gfx3dSide_t sf2d_get_current_side()
Returns the current screen side (latest call to sf2d_start_frame)
void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color)
Draws a rectangle.
void sf2d_end_frame()
Ends a frame, should be called on pair with sf2d_start_frame.
int sf2d_init()
Initializates the library.
void sf2d_draw_texture_part(const sf2d_texture *texture, int x, int y, int tex_x, int tex_y, int tex_w, int tex_h)
Draws a part of a texture.
void sf2d_draw_texture_rotate_hotspot(const sf2d_texture *texture, int x, int y, float rad, float center_x, float center_y)
Draws a texture with rotation around a hotspot.
void sf2d_draw_texture_part_rotate_scale_blend(const sf2d_texture *texture, int x, int y, float rad, int tex_x, int tex_y, int tex_w, int tex_h, float x_scale, float y_scale, u32 color)
Draws a part of a texture, with rotation, scaling and color.
sf2d_vector_4uc color
Definition: sf2d.h:121
float sf2d_get_fps()
Returns the FPS (frames per second)
int sf2d_texture_get_params(const sf2d_texture *texture)
Returns the texture params.
int height
Definition: sf2d.h:143
int sf2d_fini()
Finishes the library.
sf2d_texfmt
Represents a texture format.
Definition: sf2d.h:54
Represents a two dimensional float vector.
Definition: sf2d.h:88
int tiled
Definition: sf2d.h:139
void * sf2d_pool_calloc(u32 nmemb, u32 size)
Allocates aligned memory for an array from a temporary pool. Works as sf2d_pool_malloc.
void sf2d_draw_fill_circle(int x, int y, int radius, u32 color)
Draws a filled circle.
sf2d_place
Data allocated on the RAM or VRAM.
Definition: sf2d.h:76
u32 sf2d_get_pixel(sf2d_texture *texture, int x, int y)
Gets a pixel of the texture.
void sf2d_draw_texture_rotate(const sf2d_texture *texture, int x, int y, float rad)
Draws a texture with rotation around its center.
Represents a four dimensional unsigned char vector.
Definition: sf2d.h:107
void sf2d_swapbuffers()
Swaps the framebuffers, should be called once after all the frames have been finished.
void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color)
Draws a line.
void * sf2d_pool_malloc(u32 size)
Allocates memory from a temporary pool. The pool will be emptied after a sf2d_swapbuffers call...
int pow2_h
Definition: sf2d.h:145
void sf2d_draw_texture_part_blend(const sf2d_texture *texture, int x, int y, int tex_x, int tex_y, int tex_w, int tex_h, u32 color)
Draws a part of a texture with color.
void sf2d_texture_set_params(sf2d_texture *texture, u32 params)
Changes the texture params (filters and wrapping)
void sf2d_bind_texture_parameters(const sf2d_texture *texture, GPU_TEXUNIT unit, unsigned int params)
Binds a texture to a GPU texture unit with custom parameters.
void sf2d_free_texture(sf2d_texture *texture)
Frees a texture.
void sf2d_draw_texture_part_scale_blend(const sf2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale, u32 color)
Draws a part of a texture, with scaling, with color.
sf2d_texture * sf2d_create_texture_mem_RGBA8(const void *src_buffer, int src_w, int src_h, sf2d_texfmt pixel_format, sf2d_place place)
Creates a texture and fills it from a RGBA8 memory source. The returned texture is already tiled...
void * sf2d_pool_memalign(u32 size, u32 alignment)
Allocates aligned memory from a temporary pool. Works as sf2d_pool_malloc.
void sf2d_set_pixel(sf2d_texture *texture, int x, int y, u32 new_color)
Changes a pixel of the texture.
float z
Definition: sf2d.h:100
void sf2d_draw_texture_scale_blend(const sf2d_texture *texture, int x, int y, float x_scale, float y_scale, u32 color)
Draws a texture with scaling with color.
sf2d_vector_3f position
Definition: sf2d.h:129
Represents a vertex containing position (float) and color (unsigned char)
Definition: sf2d.h:119
sf2d_texfmt pixel_format
Definition: sf2d.h:140
void sf2d_set_vblank_wait(int enable)
Enables or disables the VBlank waiting.
int pow2_w
Definition: sf2d.h:144
float u
Definition: sf2d.h:89
gfxScreen_t sf2d_get_current_screen()
Returns the current screen (latest call to sf2d_start_frame)
unsigned char g
Definition: sf2d.h:109
void sf2d_draw_texture_scale(const sf2d_texture *texture, int x, int y, float x_scale, float y_scale)
Draws a texture with scaling.
unsigned char r
Definition: sf2d.h:108
int data_size
Definition: sf2d.h:146
Represents a texture.
Definition: sf2d.h:137
sf2d_vector_3f position
Definition: sf2d.h:120
Represents a vertex containing position and texture coordinates.
Definition: sf2d.h:128
void sf2d_pool_reset()
Empties the temporary pool.
void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad)
Draws a rotated rectangle.
void sf2d_draw_texture_rotate_blend(const sf2d_texture *texture, int x, int y, float rad, u32 color)
Draws a texture with rotation around its center with color.
sf2d_texture * sf2d_create_texture(int width, int height, sf2d_texfmt pixel_format, sf2d_place place)
Creates an empty texture. The returned texture has the data allocated, this means that the raw pixel ...
u32 params
Definition: sf2d.h:141
Represents a three dimensional float vector.
Definition: sf2d.h:97
void sf2d_draw_texture_part_rotate_scale(const sf2d_texture *texture, int x, int y, float rad, int tex_x, int tex_y, int tex_w, int tex_h, float x_scale, float y_scale)
Draws a part of a texture, with rotation and scaling.
void sf2d_draw_texture_part_scale(const sf2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale)
Draws a part of a texture, with scaling.
void sf2d_draw_texture_blend(const sf2d_texture *texture, int x, int y, u32 color)
Draws a texture blended with a color.
float x
Definition: sf2d.h:98
void sf2d_draw_texture_depth_blend(const sf2d_texture *texture, int x, int y, signed short z, u32 color)
Draws a texture blended in a certain depth.
float y
Definition: sf2d.h:99
void sf2d_texture_tile32(sf2d_texture *texture)
Tiles a texture.
void sf2d_draw_texture_depth(const sf2d_texture *texture, int x, int y, signed short z)
Draws a texture blended in a certain depth.
void * data
Definition: sf2d.h:147
unsigned int sf2d_pool_space_free()
Returns the temporary pool's free space.
void sf2d_fill_texture_from_RGBA8(sf2d_texture *dst, const void *rgba8, int source_w, int source_h)
Fills an already allocated texture from a RGBA8 source.