Monorepo for Aesthetic.Computer
aesthetic.computer
1// main.c - KidLisp Playdate Entry Point
2// This is the generated main.c template that includes compiled KidLisp code
3
4#include <stdio.h>
5#include <stdlib.h>
6#include "pd_api.h"
7#include "kidlisp.h"
8
9// Forward declarations
10static int update(void* userdata);
11
12// === USER VARIABLES (generated from def statements) ===
13// KIDLISP_VARIABLES_PLACEHOLDER
14
15// === USER FUNCTIONS (generated from later statements) ===
16// KIDLISP_FUNCTIONS_PLACEHOLDER
17
18// === MAIN LOOP (generated from KidLisp code) ===
19static void kidlisp_main(void) {
20 // KIDLISP_MAIN_PLACEHOLDER
21}
22
23// Playdate event handler
24#ifdef _WINDLL
25__declspec(dllexport)
26#endif
27int eventHandler(PlaydateAPI* pd, PDSystemEvent event, uint32_t arg) {
28 (void)arg;
29
30 if (event == kEventInit) {
31 // Initialize KidLisp runtime
32 kl_init(pd);
33
34 // Set update callback
35 pd->system->setUpdateCallback(update, pd);
36 }
37
38 return 0;
39}
40
41// Frame update
42static int update(void* userdata) {
43 (void)userdata;
44
45 // Update KidLisp state (buttons, crank, frame counter)
46 kl_update();
47
48 // Run the KidLisp program
49 kidlisp_main();
50
51 // Return 1 to indicate display needs updating
52 return 1;
53}