mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Updated the sf2dlib and sftdlib; Added the gfx.color.hex() function; Added the New3DS CPU mode control.
As the color order of the sf2dlib changed, you have to change it in your code, or use the color.hex() function. To fix the problems, just change "0xRRGGBBAA" to "0xAABBGGRR". Also, the shader compiler changed to Picasso, so you'll need it in order to compile. https://github.com/fincs/picasso
This commit is contained in:
parent
0105970ab7
commit
b4d025d602
17 changed files with 205 additions and 131 deletions
|
|
@ -23,7 +23,12 @@ extern "C" {
|
|||
* @param b the blue component of the color to create
|
||||
* @param a the alpha component of the color to create
|
||||
*/
|
||||
#define RGBA8(r, g, b, a) ((((r)&0xFF)<<24) | (((g)&0xFF)<<16) | (((b)&0xFF)<<8) | (((a)&0xFF)<<0))
|
||||
#define RGBA8(r, g, b, a) ((((a)&0xFF)<<24) | (((b)&0xFF)<<16) | (((g)&0xFF)<<8) | (((r)&0xFF)<<0))
|
||||
|
||||
#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)
|
||||
|
||||
/**
|
||||
* @brief Default size of the GPU commands FIFO buffer
|
||||
|
|
@ -96,23 +101,13 @@ typedef struct {
|
|||
} sf2d_vector_3f;
|
||||
|
||||
/**
|
||||
* @brief Represents a four dimensional float vector
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
float r; /**< Red component of the vector/color */
|
||||
float g; /**< Green component of the vector/color */
|
||||
float b; /**< Blue component of the vector/color */
|
||||
float a; /**< Alpha component of the vector/color */
|
||||
} sf2d_vector_4f;
|
||||
|
||||
/**
|
||||
* @brief Represents a vertex containing position and color attributes
|
||||
* @brief Represents a vertex containing position (float)
|
||||
* and color (unsigned int)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
sf2d_vector_3f position; /**< Position of the vertex */
|
||||
sf2d_vector_4f color; /**< Color of the vertex */
|
||||
u32 color; /**< Color of the vertex */
|
||||
} sf2d_vertex_pos_col;
|
||||
|
||||
/**
|
||||
|
|
@ -132,6 +127,7 @@ typedef struct {
|
|||
sf2d_place place; /**< Where the texture data resides, RAM or VRAM */
|
||||
int tiled; /**< Whether the tetxure is tiled or not */
|
||||
sf2d_texfmt pixel_format; /**< Pixel format */
|
||||
u32 params; /**< Texture filters and wrapping */
|
||||
int width; /**< Texture width */
|
||||
int height; /**< Texture height */
|
||||
int pow2_w; /**< Nearest power of 2 >= width */
|
||||
|
|
@ -210,6 +206,15 @@ void *sf2d_pool_malloc(u32 size);
|
|||
*/
|
||||
void *sf2d_pool_memalign(u32 size, u32 alignment);
|
||||
|
||||
/**
|
||||
* @brief Allocates aligned memory for an array from a temporary pool. Works as sf2d_pool_malloc
|
||||
* @param nmemb the number of elements to allocate
|
||||
* @param size the size (and alignment) of each element to allocate
|
||||
* @note Unlike libc's calloc, this function does not initialize to 0,
|
||||
* and returns a pointer aligned to size.
|
||||
*/
|
||||
void *sf2d_pool_calloc(u32 nmemb, u32 size);
|
||||
|
||||
/**
|
||||
* @brief Returns the temporary pool's free space
|
||||
* @return the temporary pool's free space
|
||||
|
|
@ -282,6 +287,8 @@ void sf2d_draw_fill_circle(int x, int y, int radius, u32 color);
|
|||
* @return a pointer to the newly created texture
|
||||
* @note Before drawing the texture, it needs to be tiled
|
||||
* by calling sf2d_texture_tile32.
|
||||
* The default texture params are both min and mag filters
|
||||
* GPU_NEAREST, and both S and T wrappings GPU_CLAMP_TO_BORDER.
|
||||
*/
|
||||
sf2d_texture *sf2d_create_texture(int width, int height, sf2d_texfmt pixel_format, sf2d_place place);
|
||||
|
||||
|
|
@ -336,6 +343,22 @@ void sf2d_bind_texture_color(const sf2d_texture *texture, GPU_TEXUNIT unit, u32
|
|||
*/
|
||||
void sf2d_bind_texture_parameters(const sf2d_texture *texture, GPU_TEXUNIT unit, unsigned int params);
|
||||
|
||||
/**
|
||||
* @brief Changes the texture params (filters and wrapping)
|
||||
* @param texture the texture to change the params
|
||||
* @param 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_set_params(sf2d_texture *texture, u32 params);
|
||||
|
||||
/**
|
||||
* @brief Returns the texture params
|
||||
* @param texture the texture to get the params
|
||||
* @return the current texture params of texture
|
||||
*/
|
||||
int sf2d_texture_get_params(const sf2d_texture *texture);
|
||||
|
||||
/**
|
||||
* @brief Draws a texture
|
||||
* @param texture the texture to draw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue