mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Updated sf2dlib, added a "thickness" argument to lines (warning: break some old lines), Added WIP render targets, Added arguments (main file and root path)
You'll need to update some of your codes if you used lines with colors, or you'll have some ... Nice line effects.
This commit is contained in:
parent
694159f444
commit
5107f0277c
12 changed files with 477 additions and 41 deletions
|
|
@ -4,7 +4,6 @@
|
|||
* @date 22 March 2015
|
||||
* @brief sf2dlib header
|
||||
*/
|
||||
|
||||
#ifndef SF2D_H
|
||||
#define SF2D_H
|
||||
|
||||
|
|
@ -136,6 +135,11 @@ typedef struct {
|
|||
void *data; /**< Pointer to the data */
|
||||
} sf2d_texture;
|
||||
|
||||
typedef struct {
|
||||
sf2d_texture texture; // "inherit"/extend standard texture
|
||||
float projection[4*4]; /**< Orthographic projection matrix for this target */
|
||||
} sf2d_rendertarget;
|
||||
|
||||
// Basic functions
|
||||
|
||||
/**
|
||||
|
|
@ -171,6 +175,12 @@ void sf2d_set_3D(int enable);
|
|||
*/
|
||||
void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side);
|
||||
|
||||
/**
|
||||
* @brief Starts a frame bound to a rendertarget
|
||||
* @param target rendertarget to draw to
|
||||
*/
|
||||
void sf2d_start_frame_target(sf2d_rendertarget *target);
|
||||
|
||||
/**
|
||||
* @brief Ends a frame, should be called on pair with sf2d_start_frame
|
||||
*/
|
||||
|
|
@ -239,9 +249,10 @@ void sf2d_set_clear_color(u32 color);
|
|||
* @param y0 y coordinate of the first dot
|
||||
* @param x1 x coordinate of the second dot
|
||||
* @param y1 y coordinate of the sceond dot
|
||||
* @param width thickness of the line
|
||||
* @param color the color to draw the line
|
||||
*/
|
||||
void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color);
|
||||
void sf2d_draw_line(float x0, float y0, float x1, float y1, float width, u32 color);
|
||||
|
||||
/**
|
||||
* @brief Draws a rectangle
|
||||
|
|
@ -292,12 +303,37 @@ void sf2d_draw_fill_circle(int x, int y, int radius, u32 color);
|
|||
*/
|
||||
sf2d_texture *sf2d_create_texture(int width, int height, sf2d_texfmt pixel_format, sf2d_place place);
|
||||
|
||||
/**
|
||||
* @brief Creates an empty rendertarget.
|
||||
* Functions similarly to sf2d_create_texture.
|
||||
* @param width the width of the texture
|
||||
* @param height the height of the texture
|
||||
* @return a pointer to the newly created rendertarget
|
||||
* @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_rendertarget *sf2d_create_rendertarget(int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Frees a texture
|
||||
* @param texture pointer to the texture to freeze
|
||||
*/
|
||||
void sf2d_free_texture(sf2d_texture *texture);
|
||||
|
||||
/**
|
||||
* @brief Frees a rendertarget
|
||||
* @param target pointer to the rendertarget to free
|
||||
*/
|
||||
void sf2d_free_target(sf2d_rendertarget *target);
|
||||
|
||||
/**
|
||||
* @brief Clears a rendertarget to the specified color
|
||||
* @param target pointer to the rendertarget to clear
|
||||
*/
|
||||
void sf2d_clear_target(sf2d_rendertarget *target, u32 color);
|
||||
|
||||
/**
|
||||
* @brief Fills an already allocated texture from a RGBA8 source
|
||||
* @param dst pointer to the destination texture to fill
|
||||
|
|
@ -419,6 +455,33 @@ void sf2d_draw_texture_rotate(const sf2d_texture *texture, int x, int y, float r
|
|||
*/
|
||||
void sf2d_draw_texture_rotate_blend(const sf2d_texture *texture, int x, int y, float rad, u32 color);
|
||||
|
||||
/**
|
||||
* @brief Draws a scaled texture with rotation around its hotspot
|
||||
* @param texture the texture to draw
|
||||
* @param x the x coordinate to draw the texture to
|
||||
* @param y the y coordinate to draw the texture to
|
||||
* @param rad rotation (in radians) to draw the texture
|
||||
* @param x_scale the x scale
|
||||
* @param y_scale the y scale
|
||||
* @param center_x the x position of the hotspot
|
||||
* @param center_y the y position of the hotspot
|
||||
*/
|
||||
void sf2d_draw_texture_rotate_scale_hotspot(const sf2d_texture *texture, int x, int y, float rad, float scale_x, float scale_y, float center_x, float center_y);
|
||||
|
||||
/**
|
||||
* @brief Draws a scaled texture with rotation around its hotspot with color
|
||||
* @param texture the texture to draw
|
||||
* @param x the x coordinate to draw the texture to
|
||||
* @param y the y coordinate to draw the texture to
|
||||
* @param rad rotation (in radians) to draw the texture
|
||||
* @param x_scale the x scale
|
||||
* @param y_scale the y scale
|
||||
* @param center_x the x position of the hotspot
|
||||
* @param center_y the y position of the hotspot
|
||||
* @param color the color to blend with the texture
|
||||
*/
|
||||
void sf2d_draw_texture_rotate_scale_hotspot_blend(const sf2d_texture *texture, int x, int y, float rad, float scale_x, float scale_y, float center_x, float center_y, u32 color);
|
||||
|
||||
/**
|
||||
* @brief Draws a part of a texture
|
||||
* @param texture the texture to draw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue