#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
// Define entity types and functions here.
int main(int argc, char **argv) {
(void)argc;
(void)argv;
// Runs once, like Unity's Start().
SDL_Window *w;
SDL_Renderer *r;
SDL_Event e;
SDL_Init(SDL_INIT_VIDEO);
SDL_CreateWindowAndRenderer("Game", 800, 600, 0, &w, &r);
SDL_SetWindowResizable(w, true);
// Create your player, enemies and map here.
// Repeats every frame, like Unity's Update().
for (;;) {
// Handle all waiting events.
while (SDL_PollEvent(&e)) {
if (e.type == SDL_EVENT_QUIT) {
SDL_Quit();
return 0;
}
// Handle key presses and mouse movement and clicks here.
}
// Still inside the main loop: update movement, collisions and spawning.
// Clear the previous frame.
SDL_RenderClear(r);
// Draw your map, entities and interface here.
// Show the finished frame.
SDL_RenderPresent(r);
// Wait about 16 milliseconds before repeating.
SDL_Delay(16);
}
}