-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgauntlet_pro_stdlib.c
More file actions
46 lines (38 loc) · 1.68 KB
/
gauntlet_pro_stdlib.c
File metadata and controls
46 lines (38 loc) · 1.68 KB
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
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mquickjs.h"
#include "mquickjs_build.h"
// Prototypes for all Gauntlet Series functions
static JSValue js_gauntlet_set(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);
static JSValue js_gauntlet_flush(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);
static JSValue js_gauntlet_poll(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);
static JSValue js_draw(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);
static JSValue js_get_rom(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);
static JSValue js_performance_now(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv);
// Include standard library logic
#define main mqjs_main
#include "mqjs_stdlib.c"
#undef main
static const JSPropDef gauntlet_pro_global_object[] = {
JS_PROP_CLASS_DEF("Object", &js_object_class),
JS_PROP_CLASS_DEF("Function", &js_function_class),
JS_PROP_CLASS_DEF("Number", &js_number_class),
JS_PROP_CLASS_DEF("Boolean", &js_boolean_class),
JS_PROP_CLASS_DEF("String", &js_string_class),
JS_PROP_CLASS_DEF("Array", &js_array_class),
JS_PROP_CLASS_DEF("Math", &js_math_obj),
// Gauntlet Pro + CHIP8 Bindings
JS_CFUNC_DEF("set", 3, js_gauntlet_set),
JS_CFUNC_DEF("draw", 3, js_draw),
JS_CFUNC_DEF("flush", 0, js_gauntlet_flush),
JS_CFUNC_DEF("poll", 0, js_gauntlet_poll),
JS_CFUNC_DEF("get_rom", 1, js_get_rom),
JS_CFUNC_DEF("performance_now", 0, js_performance_now),
JS_PROP_END,
};
int main(int argc, char **argv)
{
return build_atoms("gauntlet_pro_stdlib", gauntlet_pro_global_object, js_c_function_decl, argc, argv);
}