-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.c
48 lines (37 loc) · 776 Bytes
/
main.c
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
//
// main.c
// PlayGB
//
// Created by Matteo D'Ignazio on 14/05/22.
//
#include <stdio.h>
#include "pd_api.h"
#include "app.h"
#ifdef _WINDLL
#define DllExport __declspec(dllexport)
#else
#define DllExport
#endif
static int update(void* userdata);
DllExport int eventHandler(PlaydateAPI *pd, PDSystemEvent event, uint32_t arg)
{
if(event == kEventInit)
{
playdate = pd;
PGB_init();
pd->system->setUpdateCallback(update, pd);
}
else if (event == kEventTerminate)
{
PGB_quit();
}
return 0;
}
int update(void* userdata)
{
PlaydateAPI *pd = userdata;
float dt = pd->system->getElapsedTime();
pd->system->resetElapsedTime();
PGB_update(dt);
return 1;
}