#include "engine.h" #include "platform.h" #include #include #include // MAIN int main(int argc, char *argv[]) { if (argc != 3) { fprintf(stderr, "Usage: %s \n", argv[0]); return EXIT_FAILURE; } char *objFilename = argv[1]; char *mtlFilename = argv[2]; Platform platform = {}; int result = Platform_Init(platform, WINDOW_WIDTH, WINDOW_HEIGHT); platform.framerateMillis = (1000 / WINDOW_FPS); if (result == PLATFORM_OK) { EngineBuffer buffer = {}; buffer.buffer = (uint32_t*)platform.surface->pixels; buffer.width = platform.surface->w; buffer.height = platform.surface->h; result = EngineInit(objFilename, mtlFilename); if (result < 0) { return EXIT_FAILURE; } while (true) { Platform_GetFrameTime(platform); result = Platform_CheckForEvents(platform); if (result == PLATFORM_QUIT) { break; } Platform_ClearWindow(platform); EngineRender(buffer, platform.input); Platform_UpdateWindow(platform); Platform_SyncToFramerate(platform); } EngineShutdown(); Platform_Shutdown(platform); } else { return EXIT_FAILURE; } return EXIT_SUCCESS; }