-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameboy.h
54 lines (45 loc) · 940 Bytes
/
gameboy.h
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
/*
* gameboy.h
* Copyright (C) 2019 martian <martian@Martian-sys>
*
* Distributed under terms of the MIT license.
*/
#ifndef GAMEBOY_H
#define GAMEBOY_H
#include "renderer.h"
enum gb_keys {
GB_UP = 0,
GB_LEFT,
GB_RIGHT,
GB_DOWN,
GB_A,
GB_B,
GB_SELECT,
GB_START,
GB_KEY_MAX
};
struct gb_interface {
/* 0 key up, 1 key down */
int keys[GB_KEY_MAX];
/* graphic renderer */
struct gb_renderer *renderer;
};
struct gb_event {
/* 0 key up, 1 key down */
int keys[GB_KEY_MAX];
};
struct gb_hardware {
};
struct gb {
/* Interact with the user */
struct gb_interface interface;
/* Emulation of the hardware */
struct gb_hardware hardware;
unsigned char *gb_rom;
};
int gb_init(struct gb *gb_instance);
int gb_trigger_event(struct gb *gb_instance, struct gb_event *ev);
int gb_render(struct gb *gb_instance);
int gb_show_state(struct gb *gb_instance);
int gb_destroy(struct gb *gb_instance);
#endif /* !GAMEBOY_H */