34 lines
599 B
C
34 lines
599 B
C
#include <stdio.h>
|
|
|
|
#include "../../../vm/vm.h"
|
|
#undef true
|
|
#undef false
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include <emscripten.h>
|
|
#include <emscripten/html5.h>
|
|
|
|
VM vm = {0};
|
|
|
|
void mainloop() {
|
|
if (!step_vm(&vm)) {
|
|
emscripten_cancel_main_loop();
|
|
return;
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
|
printf("SDL initialization failed: %s\n", SDL_GetError());
|
|
return 1;
|
|
}
|
|
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
|
|
|
emscripten_set_canvas_element_size("#canvas", 640, 480);
|
|
|
|
printf("VM loaded successfully\n");
|
|
|
|
emscripten_set_main_loop(mainloop, 0, 1);
|
|
return 0;
|
|
}
|