LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
console.h
Go to the documentation of this file.
1#ifndef __console_console_h
2#define __console_console_h
3
4#include <xetypes.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10extern uint32_t console_color[2];
12
13#define CONSOLE_COLOR_RED 0x0000FF00
14#define CONSOLE_COLOR_BLUE 0xD8444E00
15#define CONSOLE_COLOR_GREEN 0x00800000
16#define CONSOLE_COLOR_BLACK 0x00000000
17#define CONSOLE_COLOR_WHITE 0xFFFFFF00
18#define CONSOLE_COLOR_GREY 0xC0C0C000
19#define CONSOLE_COLOR_BROWN 0x00339900
20#define CONSOLE_COLOR_PURPLE 0xFF009900
21#define CONSOLE_COLOR_YELLOW 0x00FFFF00
22#define CONSOLE_COLOR_ORANGE 0x0066FF00
23#define CONSOLE_COLOR_PINK 0xFF66FF00
24
25#define CONSOLE_SUCCESS CONSOLE_COLOR_GREEN
26#define CONSOLE_WARN CONSOLE_COLOR_YELLOW
27#define CONSOLE_ERR CONSOLE_COLOR_ORANGE
28
29#define PRINT_COL(bg, fg, s, ...) { \
30 console_oldbg = console_color[0]; console_oldfg = console_color[1]; \
31 console_set_colors(bg,fg); \
32 printf(s, ##__VA_ARGS__); \
33 console_set_colors(console_oldbg,console_oldfg); }
34
35#define PRINT_SUCCESS(s, ...) PRINT_COL(console_color[0],CONSOLE_SUCCESS, s, ##__VA_ARGS__)
36#define PRINT_WARN(s, ...) PRINT_COL(console_color[0],CONSOLE_WARN, s, ##__VA_ARGS__)
37#define PRINT_ERR(s, ...) PRINT_COL(console_color[0],CONSOLE_ERR, s, ##__VA_ARGS__)
38
39void console_set_colors(unsigned int background, unsigned int foreground); // can be called before init
40void console_get_dimensions(unsigned int * width,unsigned int * height);
41void console_putch(const char c);
42void console_clrscr();
43void console_clrline();
44void console_init(void);
45void console_open(void);
46void console_close(void);
47void console_pset(int x, int y, unsigned char r, unsigned char g, unsigned char b);
48void console_pset_right(int x, int y, unsigned char r, unsigned char g, unsigned char b);
49
50#ifdef __cplusplus
51};
52#endif
53
54#endif
uint32_t width
Definition: console.c:3
uint32_t height
Definition: console.c:4
uint32_t console_oldfg
Definition: console.h:11
uint32_t console_oldbg
Definition: console.c:41
void console_close(void)
Definition: console.c:214
void console_clrscr()
Definition: console.c:88
void console_pset_right(int x, int y, unsigned char r, unsigned char g, unsigned char b)
Definition: console.c:73
void console_set_colors(unsigned int background, unsigned int foreground)
Definition: console.c:199
void console_open(void)
Definition: console.c:209
void console_clrline()
Definition: console.c:100
void console_get_dimensions(unsigned int *width, unsigned int *height)
Definition: console.c:204
void console_init(void)
Definition: console.c:169
uint32_t console_color[2]
Definition: console.c:40
void console_putch(const char c)
Definition: console.c:145
void console_pset(int x, int y, unsigned char r, unsigned char g, unsigned char b)
Definition: console.c:67
u32 uint32_t
Definition: libfdt_env.h:11
u8 c
Definition: xenos_edid.h:7