› Foros › Nintendo 3DS › Scene
int sf2d_init();
int sf2d_init_advanced(int gpucmd_size, int temppool_size);
int sf2d_fini();
void sf2d_set_3D(int enable);
void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side);
void sf2d_end_frame();
void sf2d_swapbuffers();
void sf2d_set_vblank_wait(int enable);
float sf2d_get_fps();
void *sf2d_pool_malloc(u32 size);
void *sf2d_pool_memalign(u32 size, u32 alignment);
unsigned int sf2d_pool_space_free();
void sf2d_pool_reset();
void sf2d_set_clear_color(u32 color);
void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color);
void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color);
void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad);
sf2d_texture *sf2d_create_texture(int width, int height, GPU_TEXCOLOR pixel_format, sf2d_place place);
void sf2d_free_texture(sf2d_texture *texture);
void sf2d_fill_texture_from_RGBA8(sf2d_texture *dst, const void *rgba8, int source_w, int source_h);
sf2d_texture *sf2d_create_texture_mem_RGBA8(const void *src_buffer, int src_w, int src_h, GPU_TEXCOLOR pixel_format, sf2d_place place);
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);
void sf2d_draw_texture(const sf2d_texture *texture, int x, int y);
void sf2d_draw_texture_rotate(const sf2d_texture *texture, int x, int y, float rad);
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);
void sf2d_draw_texture_scale(const sf2d_texture *texture, int x, int y, float x_scale, float y_scale);
void sf2d_draw_texture_rotate_cut_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);
void sf2d_draw_texture_blend(const sf2d_texture *texture, int x, int y, u32 color);
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);
void sf2d_draw_texture_depth(const sf2d_texture *texture, int x, int y, signed short z);
void sf2d_texture_tile32(sf2d_texture *texture);
void sf2d_set_scissor_test(GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h);
gfxScreen_t sf2d_get_current_screen();
gfx3dSide_t sf2d_get_current_side();
Top screen:
X
---------->
| (0,0)
| ______________________
Y | | |
| | |
v | |
| |
| |
|______________________|
(400, 240)
Bottom screen:
X
---------->
| (0,0)
| ________________
Y | | |
| | |
v | |
| |
| |
|________________|
(320, 240)
int main()
{
sf2d_init();
sf2d_set_clear_color(RGBA8(0x0, 0x00, 0x00, 0x00));
while (aptMainLoop()) {
hidScanInput();
if (hidKeysDown() & KEY_START) break;
sf2d_start_frame(GFX_TOP, GFX_LEFT);
//Draws a 100x100 yellow rectangle (255, 255, 00, 255) at (150, 70)
sf2d_draw_rectangle(150, 70, 100, 100, RGBA8(0xFF, 0xFF, 0x00, 0xFF));
sf2d_end_frame();
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
//Draws a 70x100 blue rectangle (0, 0, 00, 255) at (120, 30)
sf2d_draw_rectangle(120, 30, 70, 100, RGBA8(0x00, 0x00, 0xFF, 0xFF));
sf2d_end_frame();
sf2d_swapbuffers();
}
sf2d_fini();
return 0;
}
EmaDarko escribió:buen aporte compañero!!! se podrian hacer juegos homebrew buenos!!
sf2d_texture *sfil_load_PNG_file(const char *filename, sf2d_place place);
sf2d_texture *sfil_load_PNG_buffer(const void *buffer, sf2d_place place);
sf2d_texture *sfil_load_JPEG_file(const char *filename, sf2d_place place);
sf2d_texture *sfil_load_JPEG_buffer(const void *buffer, unsigned long buffer_size, sf2d_place place);
sf2d_texture *sfil_load_BMP_file(const char *filename, sf2d_place place);
sf2d_texture *sfil_load_BMP_buffer(const void *buffer, sf2d_place place);