|
sf2dlib
Simple and Fast 2D library for the Nintendo 3DS
|
sf2dlib header More...
#include <3ds.h>Go to the source code of this file.
Data Structures | |
| struct | sf2d_vector_2f |
| Represents a two dimensional float vector. More... | |
| struct | sf2d_vector_3f |
| Represents a three dimensional float vector. More... | |
| struct | sf2d_vector_4uc |
| Represents a four dimensional unsigned char vector. More... | |
| struct | sf2d_vertex_pos_col |
| Represents a vertex containing position (float) and color (unsigned char) More... | |
| struct | sf2d_vertex_pos_tex |
| Represents a vertex containing position and texture coordinates. More... | |
| struct | sf2d_texture |
| Represents a texture. More... | |
Macros | |
| #define | RGBA8(r, g, b, a) ((((a)&0xFF)<<24) | (((b)&0xFF)<<16) | (((g)&0xFF)<<8) | (((r)&0xFF)<<0)) |
| Creates a new RGBA8 color. More... | |
| #define | RGBA8_GET_R(c) (((c) >> 0) & 0xFF) |
| #define | RGBA8_GET_G(c) (((c) >> 8) & 0xFF) |
| #define | RGBA8_GET_B(c) (((c) >> 16) & 0xFF) |
| #define | RGBA8_GET_A(c) (((c) >> 24) & 0xFF) |
| #define | SF2D_GPUCMD_DEFAULT_SIZE 0x80000 |
| Default size of the GPU commands FIFO buffer. | |
| #define | SF2D_TEMPPOOL_DEFAULT_SIZE 0x80000 |
| Default size of the temporary memory pool. | |
| #define | SF2D_DEFAULT_DEPTH 0.5f |
| Default depth (Z coordinate) to draw the textures to. | |
Enumerations | |
| enum | sf2d_texfmt { TEXFMT_RGBA8 = 0, TEXFMT_RGB8 = 1, TEXFMT_RGB5A1 = 2, TEXFMT_RGB565 = 3, TEXFMT_RGBA4 = 4, TEXFMT_IA8 = 5, TEXFMT_I8 = 7, TEXFMT_A8 = 8, TEXFMT_IA4 = 9, TEXFMT_I4 = 10, TEXFMT_A4 = 11, TEXFMT_ETC1 = 12, TEXFMT_ETC1A4 = 13 } |
| Represents a texture format. | |
| enum | sf2d_place { SF2D_PLACE_RAM, SF2D_PLACE_VRAM, SF2D_PLACE_TEMP } |
| Data allocated on the RAM or VRAM. More... | |
Functions | |
| int | sf2d_init () |
| Initializates the library. More... | |
| int | sf2d_init_advanced (int gpucmd_size, int temppool_size) |
| Initializates the library (with advanced settings) More... | |
| int | sf2d_fini () |
| Finishes the library. More... | |
| void | sf2d_set_3D (int enable) |
| Enables or disables the 3D. More... | |
| void | sf2d_start_frame (gfxScreen_t screen, gfx3dSide_t side) |
| Starts a frame. More... | |
| void | sf2d_end_frame () |
| Ends a frame, should be called on pair with sf2d_start_frame. | |
| void | sf2d_swapbuffers () |
| Swaps the framebuffers, should be called once after all the frames have been finished. | |
| void | sf2d_set_vblank_wait (int enable) |
| Enables or disables the VBlank waiting. More... | |
| float | sf2d_get_fps () |
| Returns the FPS (frames per second) More... | |
| void * | sf2d_pool_malloc (u32 size) |
| Allocates memory from a temporary pool. The pool will be emptied after a sf2d_swapbuffers call. More... | |
| void * | sf2d_pool_memalign (u32 size, u32 alignment) |
| Allocates aligned memory from a temporary pool. Works as sf2d_pool_malloc. More... | |
| void * | sf2d_pool_calloc (u32 nmemb, u32 size) |
| Allocates aligned memory for an array from a temporary pool. Works as sf2d_pool_malloc. More... | |
| unsigned int | sf2d_pool_space_free () |
| Returns the temporary pool's free space. More... | |
| void | sf2d_pool_reset () |
| Empties the temporary pool. | |
| void | sf2d_set_clear_color (u32 color) |
| Sets the screen clear color. More... | |
| void | sf2d_draw_line (int x0, int y0, int x1, int y1, u32 color) |
| Draws a line. More... | |
| void | sf2d_draw_rectangle (int x, int y, int w, int h, u32 color) |
| Draws a rectangle. More... | |
| void | sf2d_draw_rectangle_rotate (int x, int y, int w, int h, u32 color, float rad) |
| Draws a rotated rectangle. More... | |
| void | sf2d_draw_fill_circle (int x, int y, int radius, u32 color) |
| Draws a filled circle. More... | |
| 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 data can be filled just after the return. More... | |
| void | sf2d_free_texture (sf2d_texture *texture) |
| Frees a texture. More... | |
| 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. More... | |
| 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. More... | |
| void | sf2d_bind_texture (const sf2d_texture *texture, GPU_TEXUNIT unit) |
| Binds a texture to a GPU texture unit. More... | |
| 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. More... | |
| 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. More... | |
| void | sf2d_texture_set_params (sf2d_texture *texture, u32 params) |
| Changes the texture params (filters and wrapping) More... | |
| int | sf2d_texture_get_params (const sf2d_texture *texture) |
| Returns the texture params. More... | |
| void | sf2d_draw_texture (const sf2d_texture *texture, int x, int y) |
| Draws a texture. More... | |
| void | sf2d_draw_texture_blend (const sf2d_texture *texture, int x, int y, u32 color) |
| Draws a texture blended with a color. More... | |
| 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. More... | |
| 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. More... | |
| void | sf2d_draw_texture_rotate (const sf2d_texture *texture, int x, int y, float rad) |
| Draws a texture with rotation around its center. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| void | sf2d_draw_texture_scale (const sf2d_texture *texture, int x, int y, float x_scale, float y_scale) |
| Draws a texture with scaling. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| void | sf2d_draw_texture_depth (const sf2d_texture *texture, int x, int y, signed short z) |
| Draws a texture blended in a certain depth. More... | |
| 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. More... | |
| 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. More... | |
| void | sf2d_set_pixel (sf2d_texture *texture, int x, int y, u32 new_color) |
| Changes a pixel of the texture. More... | |
| u32 | sf2d_get_pixel (sf2d_texture *texture, int x, int y) |
| Gets a pixel of the texture. More... | |
| void | sf2d_texture_tile32 (sf2d_texture *texture) |
| Tiles a texture. More... | |
| void | sf2d_set_scissor_test (GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h) |
| Sets the scissor test. More... | |
| gfxScreen_t | sf2d_get_current_screen () |
| Returns the current screen (latest call to sf2d_start_frame) More... | |
| gfx3dSide_t | sf2d_get_current_side () |
| Returns the current screen side (latest call to sf2d_start_frame) More... | |
sf2dlib header
| #define RGBA8 | ( | r, | |
| g, | |||
| b, | |||
| a | |||
| ) | ((((a)&0xFF)<<24) | (((b)&0xFF)<<16) | (((g)&0xFF)<<8) | (((r)&0xFF)<<0)) |
Creates a new RGBA8 color.
| r | the red component of the color to create |
| g | the green component of the color to create |
| b | the blue component of the color to create |
| a | the alpha component of the color to create |
| enum sf2d_place |
| void sf2d_bind_texture | ( | const sf2d_texture * | texture, |
| GPU_TEXUNIT | unit | ||
| ) |
Binds a texture to a GPU texture unit.
| texture | the texture to bind |
| unit | GPU texture unit to bind to |
| 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.
| texture | the texture to bind |
| unit | GPU texture unit to bind to |
| color | the color the bind with the texture |
| 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.
| texture | the texture to bind |
| unit | GPU texture unit to bind to |
| params | the parameters the bind with the texture |
| 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 data can be filled just after the return.
| width | the width of the texture |
| height | the height of the texture |
| pixel_format | the pixel_format of the texture |
| place | where to allocate the texture |
| 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.
| src_buffer | pointer to the RGBA8 data to fill from |
| src_w | width (in pixels) of the RGAB8 source |
| src_h | height (in pixels) of the RGAB8 source |
| pixel_format | the pixel_format of the texture to create |
| place | where to allocate the texture |
| void sf2d_draw_fill_circle | ( | int | x, |
| int | y, | ||
| int | radius, | ||
| u32 | color | ||
| ) |
Draws a filled circle.
| x | x coordinate of the center of the circle |
| y | y coordinate of the center of the circle |
| radius | the radius of the circle |
| color | the color to draw the circle |
| void sf2d_draw_line | ( | int | x0, |
| int | y0, | ||
| int | x1, | ||
| int | y1, | ||
| u32 | color | ||
| ) |
Draws a line.
| x0 | x coordinate of the first dot |
| y0 | y coordinate of the first dot |
| x1 | x coordinate of the second dot |
| y1 | y coordinate of the sceond dot |
| color | the color to draw the line |
| 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.
| texture | the texture to draw |
| left | the left coordinate of the texture to start drawing |
| top | the top coordinate of the texture to start drawing |
| width | the width to draw from the starting left coordinate |
| height | the height to draw from the starting top coordinate |
| u0 | the U texture coordinate of the left vertices |
| v0 | the V texture coordinate of the top vertices |
| u1 | the U texture coordinate of the right vertices |
| v1 | the V texture coordinate of the bottom vertices |
| params | the parameters to draw the texture with |
| void sf2d_draw_rectangle | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| u32 | color | ||
| ) |
Draws a rectangle.
| x | x coordinate of the top left corner of the rectangle |
| y | y coordinate of the top left corner of the rectangle |
| w | rectangle width |
| h | rectangle height |
| color | the color to draw the rectangle |
| void sf2d_draw_rectangle_rotate | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| u32 | color, | ||
| float | rad | ||
| ) |
Draws a rotated rectangle.
| x | x coordinate of the top left corner of the rectangle |
| y | y coordinate of the top left corner of the rectangle |
| w | rectangle width |
| h | rectangle height |
| color | the color to draw the rectangle |
| rad | rotation (in radians) to draw the rectangle |
| void sf2d_draw_texture | ( | const sf2d_texture * | texture, |
| int | x, | ||
| int | y | ||
| ) |
Draws a texture.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| void sf2d_draw_texture_blend | ( | const sf2d_texture * | texture, |
| int | x, | ||
| int | y, | ||
| u32 | color | ||
| ) |
Draws a texture blended with a color.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| color | the color to blend with the 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| z | the depth to draw the texture to |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| z | the depth to draw the texture to |
| color | the color to blend with the texture |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| tex_x | the starting point (x coordinate) where to start drawing |
| tex_y | the starting point (y coordinate) where to start drawing |
| tex_w | the width to draw from the starting point |
| tex_h | the height to draw from the starting point |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| tex_x | the starting point (x coordinate) where to start drawing |
| tex_y | the starting point (y coordinate) where to start drawing |
| tex_w | the width to draw from the starting point |
| tex_h | the height to draw from the starting point |
| color | the color to blend with the texture |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| rad | rotation (in radians) to draw the texture |
| tex_x | the starting point (x coordinate) where to start drawing |
| tex_y | the starting point (y coordinate) where to start drawing |
| tex_w | the width to draw from the starting point |
| tex_h | the height to draw from the starting point |
| x_scale | the x scale |
| y_scale | the y scale |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| rad | rotation (in radians) to draw the texture |
| tex_x | the starting point (x coordinate) where to start drawing |
| tex_y | the starting point (y coordinate) where to start drawing |
| tex_w | the width to draw from the starting point |
| tex_h | the height to draw from the starting point |
| x_scale | the x scale |
| y_scale | the y scale |
| color | the color to blend with the texture |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| tex_x | the starting point (x coordinate) where to start drawing |
| tex_y | the starting point (y coordinate) where to start drawing |
| tex_w | the width to draw from the starting point |
| tex_h | the height to draw from the starting point |
| x_scale | the x scale |
| y_scale | the y scale |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| tex_x | the starting point (x coordinate) where to start drawing |
| tex_y | the starting point (y coordinate) where to start drawing |
| tex_w | the width to draw from the starting point |
| tex_h | the height to draw from the starting point |
| x_scale | the x scale |
| y_scale | the y scale |
| color | the color to blend with 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| rad | rotation (in radians) to draw the texture |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| rad | rotation (in radians) to draw the texture |
| color | the color to blend with the 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| rad | rotation (in radians) to draw the texture |
| center_x | the x position of the hotspot |
| center_y | the y position of the hotspot |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| rad | rotation (in radians) to draw the texture |
| center_x | the x position of the hotspot |
| center_y | the y position of the hotspot |
| color | the color to blend with the texture |
| void sf2d_draw_texture_scale | ( | const sf2d_texture * | texture, |
| int | x, | ||
| int | y, | ||
| float | x_scale, | ||
| float | y_scale | ||
| ) |
Draws a texture with scaling.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| x_scale | the x scale |
| y_scale | the y scale |
| 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.
| texture | the texture to draw |
| x | the x coordinate to draw the texture to |
| y | the y coordinate to draw the texture to |
| x_scale | the x scale |
| y_scale | the y scale |
| color | the color to blend with the texture |
| 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.
| dst | pointer to the destination texture to fill |
| rgba8 | pointer to the RGBA8 data to fill from |
| source_w | width (in pixels) of the RGAB8 source |
| source_h | height (in pixels) of the RGAB8 source |
| int sf2d_fini | ( | ) |
Finishes the library.
| void sf2d_free_texture | ( | sf2d_texture * | texture | ) |
Frees a texture.
| texture | pointer to the texture to freeze |
| gfxScreen_t sf2d_get_current_screen | ( | ) |
Returns the current screen (latest call to sf2d_start_frame)
| gfx3dSide_t sf2d_get_current_side | ( | ) |
Returns the current screen side (latest call to sf2d_start_frame)
| float sf2d_get_fps | ( | ) |
Returns the FPS (frames per second)
| u32 sf2d_get_pixel | ( | sf2d_texture * | texture, |
| int | x, | ||
| int | y | ||
| ) |
Gets a pixel of the texture.
| texture | the texture to get the pixel |
| x | the x coordinate to get the pixel |
| y | the y coordinate to get the pixel |
| int sf2d_init | ( | ) |
Initializates the library.
| int sf2d_init_advanced | ( | int | gpucmd_size, |
| int | temppool_size | ||
| ) |
Initializates the library (with advanced settings)
| gpucmd_size | the size of the GPU FIFO |
| temppool_size | the size of the temporary pool |
| void* sf2d_pool_calloc | ( | u32 | nmemb, |
| u32 | size | ||
| ) |
Allocates aligned memory for an array from a temporary pool. Works as sf2d_pool_malloc.
| nmemb | the number of elements to allocate |
| size | the size (and alignment) of each element to allocate |
| void* sf2d_pool_malloc | ( | u32 | size | ) |
Allocates memory from a temporary pool. The pool will be emptied after a sf2d_swapbuffers call.
| size | the number of bytes to allocate |
| void* sf2d_pool_memalign | ( | u32 | size, |
| u32 | alignment | ||
| ) |
Allocates aligned memory from a temporary pool. Works as sf2d_pool_malloc.
| size | the number of bytes to allocate |
| alignment | the alignment to where allocate the memory |
| unsigned int sf2d_pool_space_free | ( | ) |
Returns the temporary pool's free space.
| void sf2d_set_3D | ( | int | enable | ) |
Enables or disables the 3D.
| enable | whether to enable or disable the 3D |
| void sf2d_set_clear_color | ( | u32 | color | ) |
Sets the screen clear color.
| color | the color |
| void sf2d_set_pixel | ( | sf2d_texture * | texture, |
| int | x, | ||
| int | y, | ||
| u32 | new_color | ||
| ) |
Changes a pixel of the texture.
| texture | the texture to change the pixel |
| x | the x coordinate to change the pixel |
| y | the y coordinate to change the pixel |
| new_color | the new color to set to the pixel at (x, y) |
| void sf2d_set_scissor_test | ( | GPU_SCISSORMODE | mode, |
| u32 | x, | ||
| u32 | y, | ||
| u32 | w, | ||
| u32 | h | ||
| ) |
Sets the scissor test.
| mode | the test mode (disable, invert or normal) |
| x | the starting x coordinate of the scissor |
| y | the starting y coordinate of the scissor |
| w | the width of the scissor rectangle |
| h | the height of the scissor rectangle |
| void sf2d_set_vblank_wait | ( | int | enable | ) |
Enables or disables the VBlank waiting.
| enable | whether to enable or disable the VBlank waiting |
| void sf2d_start_frame | ( | gfxScreen_t | screen, |
| gfx3dSide_t | side | ||
| ) |
Starts a frame.
| screen | target screen |
| side | target eye (only for top screen) |
| int sf2d_texture_get_params | ( | const sf2d_texture * | texture | ) |
Returns the texture params.
| texture | the texture to get the params |
| void sf2d_texture_set_params | ( | sf2d_texture * | texture, |
| u32 | params | ||
| ) |
Changes the texture params (filters and wrapping)
| texture | the texture to change the params |
| params | the new texture params to use. You can use the GPU_TEXTURE_[MIN,MAG]_FILTER and GPU_TEXTURE_WRAP_[S,T] macros as helpers. |
| void sf2d_texture_tile32 | ( | sf2d_texture * | texture | ) |
Tiles a texture.
| texture | the texture to tile |
1.8.10