You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

60 lines
1.0 KiB

#include "Engine.hpp"
#include "Platform.hpp"
#include <cstdint>
#include <cstdio>
#include <cstdlib>
// MAIN
int main(int argc, char* argv[])
{
if (argc != 3)
{
fprintf(stderr, "Usage: %s <OBJ> <MTL>\n", argv[0]);
return EXIT_FAILURE;
}
char* objFilename = argv[1];
char* mtlFilename = argv[2];
Platform platform{};
if (Platform_Init(platform, WINDOW_WIDTH, WINDOW_HEIGHT) == PlatformStatus::Error)
{
return EXIT_FAILURE;
}
if (EngineInit(objFilename, mtlFilename) < 0)
{
return EXIT_FAILURE;
}
EngineBuffer buffer{};
buffer.buffer = reinterpret_cast<uint32_t*>(platform.surface->pixels);
buffer.width = platform.surface->w;
buffer.height = platform.surface->h;
while (true)
{
Platform_GetFrameTime(platform);
if (Platform_CheckForEvents(platform) == PlatformStatus::Quit)
{
break;
}
Platform_ClearWindow(platform);
EngineRender(buffer, platform.input);
Platform_UpdateWindow(platform);
Platform_SyncToFramerate(platform);
}
EngineShutdown();
Platform_Shutdown(platform);
return EXIT_SUCCESS;
}