1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-28 08:49:30 +00:00

Updated all the libs, added citro3d, added ctr.swkbd (WIP, untested)

This commit is contained in:
Firew0lf 2016-08-05 17:30:24 +02:00
parent 68a44645f7
commit 49c87e5526
97 changed files with 7341 additions and 944 deletions

View file

@ -4,10 +4,9 @@
* @date 22 March 2015
* @brief sf2dlib header
*/
#ifndef SF2D_H
#define SF2D_H
#pragma once
#include <3ds.h>
#include <citro3d.h>
#ifdef __cplusplus
extern "C" {
@ -83,7 +82,6 @@ typedef enum {
typedef enum {
SF2D_PLACE_RAM, /**< RAM allocated */
SF2D_PLACE_VRAM, /**< VRAM allocated */
SF2D_PLACE_TEMP /**< Temporary memory pool allocated */
} sf2d_place;
// Structs
@ -131,21 +129,15 @@ typedef struct {
*/
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 */
int pow2_h; /**< Nearest power of 2 >= height */
int data_size; /**< Size of the raw texture data */
void *data; /**< Pointer to the data */
C3D_Tex tex; /**< citro3d texture object */
int tiled; /**< Whether the texture is tiled or not */
int width; /**< Actual texture width */
int height; /**< Actual texture height */
} sf2d_texture;
typedef struct {
sf2d_texture texture; // "inherit"/extend standard texture
float projection[4*4]; /**< Orthographic projection matrix for this target */
C3D_RenderTarget* target; /**< citro3d render target object */
C3D_Mtx projection; /**< Orthographic projection matrix for this target */
} sf2d_rendertarget;
// Basic functions
@ -176,6 +168,12 @@ int sf2d_fini();
*/
void sf2d_set_3D(int enable);
/**
* @brief Sets a transformation matrix to apply to vertices
* @param mtx Transformation matrix (or NULL to disable it)
*/
void sf2d_set_transform(C3D_Mtx* mtx);
/**
* @brief Starts a frame
* @param screen target screen
@ -416,14 +414,6 @@ void sf2d_bind_texture(const sf2d_texture *texture, GPU_TEXUNIT unit);
*/
void sf2d_bind_texture_color(const sf2d_texture *texture, GPU_TEXUNIT unit, u32 color);
/**
* @brief Binds a texture to a GPU texture unit with custom parameters
* @param texture the texture to bind
* @param unit GPU texture unit to bind to
* @param params the parameters the bind with the texture
*/
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
@ -633,24 +623,6 @@ void sf2d_draw_texture_part_rotate_scale(const sf2d_texture *texture, int x, int
*/
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);
/**
* @brief Draws a part of a texture, with rotation, scaling, color and 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 tex_x the starting point (x coordinate) where to start drawing
* @param tex_y the starting point (y coordinate) where to start drawing
* @param tex_w the width to draw from the starting point
* @param tex_h the height to draw from the starting point
* @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_part_rotate_scale_hotspot_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, float center_x, float center_y, u32 color);
/**
* @brief Draws a texture blended in a certain depth
* @param texture the texture to draw
@ -683,8 +655,7 @@ void sf2d_draw_texture_depth(const sf2d_texture *texture, int x, int y, signed s
void sf2d_draw_texture_depth_blend(const sf2d_texture *texture, int x, int y, signed short z, u32 color);
/**
* @brief Draws a texture using custom texture coordinates and parameters
* @param texture the texture to draw
* @brief Draws the currently-bound texture using custom texture coordinates
* @param left the left coordinate of the texture to start drawing
* @param top the top coordinate of the texture to start drawing
* @param width the width to draw from the starting left coordinate
@ -693,10 +664,24 @@ void sf2d_draw_texture_depth_blend(const sf2d_texture *texture, int x, int y, si
* @param v0 the V texture coordinate of the top vertices
* @param u1 the U texture coordinate of the right vertices
* @param v1 the V texture coordinate of the bottom vertices
* @param params the parameters to draw the texture with
*/
void sf2d_draw_quad_uv_current(float left, float top, float right, float bottom, float u0, float v0,
float u1, float v1);
/**
* @brief Like sf2d_draw_quad_uv_current, but binds the texture
* @param texture the texture to draw
**/
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);
float u0, float v0, float u1, float v1);
/**
* @brief Like sf2d_draw_quad_uv_current, but binds the texture with the given blend color
* @param texture the texture to draw
* @param color the color to blend the texture with
**/
void sf2d_draw_quad_uv_blend(const sf2d_texture *texture, float left, float top, float right, float bottom,
float u0, float v0, float u1, float v1, u32 color);
/**
* @brief Changes a pixel of the texture
@ -749,5 +734,3 @@ gfx3dSide_t sf2d_get_current_side();
#ifdef __cplusplus
}
#endif
#endif