RetroArch
vita2d.h
Go to the documentation of this file.
1 #ifndef VITA2D_H
2 #define VITA2D_H
3 
4 #include <psp2/gxm.h>
5 #include <psp2/types.h>
6 #include <psp2/kernel/sysmem.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #define RGBA8(r,g,b,a) ((((a)&0xFF)<<24) | (((b)&0xFF)<<16) | (((g)&0xFF)<<8) | (((r)&0xFF)<<0))
13 
14 typedef struct vita2d_clear_vertex {
15  float x;
16  float y;
18 
19 typedef struct vita2d_color_vertex {
20  float x;
21  float y;
22  float z;
23  unsigned int color;
25 
26 typedef struct vita2d_texture_vertex {
27  float x;
28  float y;
29  float z;
30  float u;
31  float v;
33 
34 typedef struct vita2d_texture {
35  SceGxmTexture gxm_tex;
39 
40 typedef struct vita2d_font vita2d_font;
41 typedef struct vita2d_pgf vita2d_pgf;
42 
43 int vita2d_init();
44 int vita2d_init_advanced(unsigned int temp_pool_size);
46 int vita2d_fini();
47 
48 void vita2d_clear_screen();
49 void vita2d_swap_buffers();
50 
52 void vita2d_end_drawing();
53 
55 
56 void vita2d_set_clear_color(unsigned int color);
57 unsigned int vita2d_get_clear_color();
58 
60 void *vita2d_get_current_fb();
61 
62 void vita2d_set_region_clip(SceGxmRegionClipMode mode, unsigned int x_min, unsigned int y_min, unsigned int x_max, unsigned int y_max);
63 
64 void *vita2d_pool_malloc(unsigned int size);
65 void *vita2d_pool_memalign(unsigned int size, unsigned int alignment);
66 unsigned int vita2d_pool_free_space();
67 void vita2d_pool_reset();
68 
69 void vita2d_draw_pixel(float x, float y, unsigned int color);
70 void vita2d_draw_line(float x0, float y0, float x1, float y1, unsigned int color);
71 void vita2d_draw_rectangle(float x, float y, float w, float h, unsigned int color);
72 void vita2d_draw_fill_circle(float x, float y, float radius, unsigned int color);
73 
74 vita2d_texture *vita2d_create_empty_texture(unsigned int w, unsigned int h);
75 vita2d_texture *vita2d_create_empty_texture_format(unsigned int w, unsigned int h, SceGxmTextureFormat format);
77 
81 SceGxmTextureFormat vita2d_texture_get_format(const vita2d_texture *texture);
84 SceGxmTextureFilter vita2d_texture_get_min_filter(const vita2d_texture *texture);
85 SceGxmTextureFilter vita2d_texture_get_mag_filter(const vita2d_texture *texture);
86 void vita2d_texture_set_filters(vita2d_texture *texture, SceGxmTextureFilter min_filter, SceGxmTextureFilter mag_filter);
87 
88 void vita2d_draw_texture(const vita2d_texture *texture, float x, float y);
89 void vita2d_draw_texture_rotate(const vita2d_texture *texture, float x, float y, float rad);
90 void vita2d_draw_texture_rotate_hotspot(const vita2d_texture *texture, float x, float y, float rad, float center_x, float center_y);
91 void vita2d_draw_texture_scale(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale);
92 void vita2d_draw_texture_part(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h);
93 void vita2d_draw_texture_part_scale(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale);
94 void vita2d_draw_texture_scale_rotate_hotspot(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad, float center_x, float center_y);
95 void vita2d_draw_texture_scale_rotate(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad);
96 
97 void vita2d_draw_texture_tint(const vita2d_texture *texture, float x, float y, unsigned int color);
98 void vita2d_draw_texture_tint_rotate(const vita2d_texture *texture, float x, float y, float rad, unsigned int color);
99 void vita2d_draw_texture_tint_rotate_hotspot(const vita2d_texture *texture, float x, float y, float rad, float center_x, float center_y, unsigned int color);
100 void vita2d_draw_texture_tint_scale(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, unsigned int color);
101 void vita2d_draw_texture_tint_part(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, unsigned int color);
102 void vita2d_draw_texture_tint_part_scale(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale, unsigned int color);
103 void vita2d_draw_texture_tint_scale_rotate_hotspot(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad, float center_x, float center_y, unsigned int color);
104 void vita2d_draw_texture_tint_scale_rotate(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad, unsigned int color);
105 
107 void vita2d_texture_set_wvp(float x, float y, float width, float height);
111 void vita2d_draw_texture_part_generic(const vita2d_texture *texture, SceGxmPrimitiveType type, vita2d_texture_vertex *vertices, unsigned int num_vertices);
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif
Definition: vita2d.h:34
void vita2d_draw_texture_scale_rotate(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad)
Definition: vita2d_texture.c:630
void vita2d_draw_texture_tint_part(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, unsigned int color)
Definition: vita2d_texture.c:481
unsigned int vita2d_pool_free_space()
Definition: vita2d.c:812
void vita2d_draw_pixel(float x, float y, unsigned int color)
Definition: vita2d_draw.c:5
GLenum mode
Definition: glext.h:6857
void vita2d_draw_fill_circle(float x, float y, float radius, unsigned int color)
Definition: vita2d_draw.c:117
vita2d_texture * vita2d_create_empty_texture_format(unsigned int w, unsigned int h, SceGxmTextureFormat format)
Definition: vita2d_texture.c:44
float x
Definition: vita2d.h:27
vita2d_texture * vita2d_create_empty_texture(unsigned int w, unsigned int h)
Definition: vita2d_texture.c:39
float z
Definition: vita2d.h:22
unsigned int vita2d_texture_get_width(const vita2d_texture *texture)
Definition: vita2d_texture.c:118
void vita2d_draw_texture_scale_rotate_hotspot(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad, float center_x, float center_y)
Definition: vita2d_texture.c:622
int vita2d_init()
Definition: vita2d.c:152
void vita2d_draw_texture_tint_rotate(const vita2d_texture *texture, float x, float y, float rad, unsigned int color)
Definition: vita2d_texture.c:273
GLsizeiptr size
Definition: glext.h:6559
unsigned int color
Definition: vita2d.h:23
GLboolean enable
Definition: glext.h:12027
void vita2d_draw_texture_tint_scale(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, unsigned int color)
Definition: vita2d_texture.c:411
struct vita2d_clear_vertex vita2d_clear_vertex
SceGxmTextureFormat vita2d_texture_get_format(const vita2d_texture *texture)
Definition: vita2d_texture.c:134
float y
Definition: vita2d.h:28
float y
Definition: vita2d.h:21
struct vita2d_color_vertex vita2d_color_vertex
void vita2d_end_drawing()
Definition: vita2d.c:740
void vita2d_texture_set_wvp(float x, float y, float width, float height)
Definition: vita2d_texture.c:653
void vita2d_texture_set_tint_color_uniform(unsigned int color)
Definition: vita2d_texture.c:669
float x
Definition: vita2d.h:20
void vita2d_draw_texture_tint(const vita2d_texture *texture, float x, float y, unsigned int color)
Definition: vita2d_texture.c:258
void * vita2d_pool_memalign(unsigned int size, unsigned int alignment)
Definition: vita2d.c:801
void vita2d_swap_buffers()
Definition: vita2d.c:707
void * vita2d_texture_get_palette(const vita2d_texture *texture)
Definition: vita2d_texture.c:144
GLenum type
Definition: glext.h:6233
struct vita2d_texture_vertex vita2d_texture_vertex
unsigned int vita2d_texture_get_height(const vita2d_texture *texture)
Definition: vita2d_texture.c:123
float z
Definition: vita2d.h:29
void vita2d_draw_rectangle(float x, float y, float w, float h, unsigned int color)
Definition: vita2d_draw.c:71
void vita2d_set_vblank_wait(int enable)
Definition: vita2d.c:776
unsigned int vita2d_texture_get_stride(const vita2d_texture *texture)
Definition: vita2d_texture.c:128
void vita2d_clear_screen()
Definition: vita2d.c:691
void vita2d_texture_set_tint_program()
Definition: vita2d_texture.c:665
Definition: vita2d.h:14
void vita2d_draw_texture_tint_scale_rotate(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad, unsigned int color)
Definition: vita2d_texture.c:646
void * vita2d_get_current_fb()
Definition: vita2d.c:781
GLfixed y1
Definition: glsym_gl.h:1051
void vita2d_draw_texture(const vita2d_texture *texture, float x, float y)
Definition: vita2d_texture.c:251
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
float v
Definition: vita2d.h:31
void vita2d_set_region_clip(SceGxmRegionClipMode mode, unsigned int x_min, unsigned int y_min, unsigned int x_max, unsigned int y_max)
Definition: vita2d.c:786
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
void vita2d_start_drawing()
Definition: vita2d.c:724
void vita2d_free_texture(vita2d_texture *texture)
Definition: vita2d_texture.c:107
int vita2d_common_dialog_update()
Definition: vita2d.c:745
SceGxmTexture gxm_tex
Definition: vita2d.h:35
float y
Definition: vita2d.h:16
void vita2d_draw_texture_tint_part_scale(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale, unsigned int color)
Definition: vita2d_texture.c:553
void vita2d_draw_line(float x0, float y0, float x1, float y1, unsigned int color)
Definition: vita2d_draw.c:35
int SceUID
Definition: pte_types.h:24
void vita2d_draw_texture_rotate(const vita2d_texture *texture, float x, float y, float rad)
Definition: vita2d_texture.c:266
SceUID data_UID
Definition: vita2d.h:36
void vita2d_texture_set_filters(vita2d_texture *texture, SceGxmTextureFilter min_filter, SceGxmTextureFilter mag_filter)
Definition: vita2d_texture.c:159
void * vita2d_pool_malloc(unsigned int size)
Definition: vita2d.c:791
SceGxmTextureFilter vita2d_texture_get_min_filter(const vita2d_texture *texture)
Definition: vita2d_texture.c:149
GLuint color
Definition: glext.h:6883
void vita2d_draw_texture_tint_scale_rotate_hotspot(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale, float rad, float center_x, float center_y, unsigned int color)
Definition: vita2d_texture.c:637
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:6293
void vita2d_draw_texture_part(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h)
Definition: vita2d_texture.c:474
float x
Definition: vita2d.h:15
GLint GLint GLsizei width
Definition: glext.h:6293
Definition: vita2d.h:26
void vita2d_set_clear_color(unsigned int color)
Definition: vita2d.c:763
int vita2d_init_advanced(unsigned int temp_pool_size)
Definition: vita2d.c:157
SceGxmTextureFilter vita2d_texture_get_mag_filter(const vita2d_texture *texture)
Definition: vita2d_texture.c:154
void vita2d_wait_rendering_done()
Definition: vita2d.c:608
SceUID palette_UID
Definition: vita2d.h:37
struct vita2d_texture vita2d_texture
void vita2d_draw_texture_rotate_hotspot(const vita2d_texture *texture, float x, float y, float rad, float center_x, float center_y)
Definition: vita2d_texture.c:340
void vita2d_pool_reset()
Definition: vita2d.c:817
void vita2d_texture_set_program()
Definition: vita2d_texture.c:661
Definition: metal_common.m:516
struct vita2d_pgf vita2d_pgf
Definition: vita2d.h:41
void * vita2d_texture_get_datap(const vita2d_texture *texture)
Definition: vita2d_texture.c:139
void vita2d_draw_texture_scale(const vita2d_texture *texture, float x, float y, float x_scale, float y_scale)
Definition: vita2d_texture.c:404
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6742
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:8390
struct vita2d_font vita2d_font
Definition: vita2d.h:40
Definition: vita2d.h:19
float u
Definition: vita2d.h:30
void vita2d_draw_texture_part_generic(const vita2d_texture *texture, SceGxmPrimitiveType type, vita2d_texture_vertex *vertices, unsigned int num_vertices)
Definition: vita2d_texture.c:674
int vita2d_fini()
Definition: vita2d.c:613
unsigned int vita2d_get_clear_color()
Definition: vita2d.c:772
void vita2d_draw_texture_part_scale(const vita2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale)
Definition: vita2d_texture.c:546
GLint GLint GLsizei GLsizei height
Definition: glext.h:6293
void vita2d_draw_texture_tint_rotate_hotspot(const vita2d_texture *texture, float x, float y, float rad, float center_x, float center_y, unsigned int color)
Definition: vita2d_texture.c:347