libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
graphics.h
Go to the documentation of this file.
1
11#ifndef C8_GRAPHICS_H
12#define C8_GRAPHICS_H
13
14#include <stdint.h>
15
16#define C8_LOW_DISPLAY_WIDTH 64
17#define C8_LOW_DISPLAY_HEIGHT 32
18#define C8_HIGH_DISPLAY_WIDTH 128
19#define C8_HIGH_DISPLAY_HEIGHT 64
20
21#define C8_DEFAULT_WINDOW_WIDTH 800
22#define C8_DEFAULT_WINDOW_HEIGHT 400
23#define C8_WINDOW_SCALE_X (C8_DEFAULT_WINDOW_WIDTH / C8_LOW_DISPLAY_WIDTH)
24#define C8_WINDOW_SCALE_Y (C8_DEFAULT_WINDOW_HEIGHT / C8_LOW_DISPLAY_HEIGHT)
25
26#define C8_DISPLAYMODE_LOW 0
27#define C8_DISPLAYMODE_HIGH 1
28
37typedef struct {
39 uint8_t mode;
40 uint8_t x, y;
42
43uint8_t* c8_get_pixel(c8_display_t*, int, int);
44
45extern void c8_beep(void);
46extern void c8_deinit_graphics(void);
47extern uint8_t c8_init_graphics(void);
48extern void c8_render(c8_display_t*, int*);
49extern int c8_tick(int*);
50
51#endif
int c8_tick(int *)
Grab current keypresses and delay execution to match clockspeed.
Definition: graphics.c:63
void c8_deinit_graphics(void)
Deinitialize graphics system.
Definition: graphics.c:29
uint8_t c8_init_graphics(void)
Initialize graphics system.
Definition: graphics.c:40
void c8_beep(void)
Play sound.
Definition: graphics.c:18
void c8_render(c8_display_t *, int *)
Render graphics.
Definition: graphics.c:52
#define C8_HIGH_DISPLAY_HEIGHT
Definition: graphics.h:19
uint8_t * c8_get_pixel(c8_display_t *, int, int)
Get the value of (x,y) from display
Definition: graphics.c:77
#define C8_HIGH_DISPLAY_WIDTH
Definition: graphics.h:18
Definition: graphics.h:37
uint8_t x
Definition: graphics.h:40
uint8_t mode
Definition: graphics.h:39