aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wii/gfx.h
blob: f4c49653c59dfa50dbc32361037a53149fea9193 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* 
 * Gamecube/Wii VIDEO/GX subsystem wrapper
 *
 * Copyright (C) 2008, 2009		Andre Heider "dhewg" <dhewg@wiibrew.org>
 *
 * This code is licensed to you under the terms of the GNU GPL, version 2;
 * see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
 *
 */

#ifndef __GFX_H__
#define __GFX_H__

#include <gccore.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
	GFX_MODE_AUTO = -1,
	GFX_MODE_PROGRESSIVE = 0,
	GFX_MODE_NTSC,
	GFX_MODE_PAL,
	GFX_MODE_EURGB60,
	GFX_MODE_MPAL
} gfx_video_mode_t;

typedef enum {
	GFX_SETUP_STANDARD = 0,
	GFX_SETUP_STANDARD_AA,
	GFX_SETUP_DS,
	GFX_SETUP_DS_AA
} gfx_video_setup_t;

typedef enum {
	GFX_TF_RGB565 = 0,
	GFX_TF_RGB5A3,
	GFX_TF_PALETTE_RGB565,
	GFX_TF_PALETTE_RGB5A3
} gfx_tex_format_t;

typedef struct {
	void *pixels;
	u16 *palette;

	gfx_tex_format_t format;
	u16 width;
	u16 height;
	u8 bpp;
	GXTexObj obj;
	GXTlutObj tlut;
	u32 tlut_name;
} gfx_tex_t;

typedef enum {
	GFX_COORD_FULLSCREEN = 0,
	GFX_COORD_CENTER
} gfx_coord_t;

typedef struct {
	f32 x, y;
	f32 w, h;
} gfx_coords_t;

void gfx_video_init(gfx_video_mode_t mode, gfx_video_setup_t setup);
void gfx_video_deinit(void);

u16 gfx_video_get_width(void);
u16 gfx_video_get_height(void);

void gfx_init(void);
void gfx_deinit(void);

void gfx_set_underscan(u16 underscan_x, u16 underscan_y);
void gfx_set_ar(f32 ar);
void gfx_set_pillarboxing(bool enable);

bool gfx_tex_init(gfx_tex_t *tex, gfx_tex_format_t format, u32 tlut_name,
					u16 width, u16 height);
void gfx_tex_deinit(gfx_tex_t *tex);

void gfx_coords(gfx_coords_t *coords, gfx_tex_t *tex, gfx_coord_t type);

bool gfx_tex_flush_texture(gfx_tex_t *tex);
bool gfx_tex_flush_palette(gfx_tex_t *tex);
bool gfx_tex_clear_palette(gfx_tex_t *tex);

bool gfx_tex_convert(gfx_tex_t *tex, const void *src);

void gfx_frame_start(void);
void gfx_frame_end(void);

void gfx_draw_tex(gfx_tex_t *tex, gfx_coords_t *coords);

#ifdef __cplusplus
}
#endif

#endif