1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include <GLFW/glfw3.h>
- #include <core/Logger.h>
- #include <core/Utility.h>
- #include <stdio.h>
- #include "Tests.h"
- #include "core/Window.h"
- static int ticks = 40;
- static bool isRunning(void*) {
- return !coreWindowShouldClose() && ticks > 0;
- }
- static void tick(void*) {
- ticks -= ticks > 0;
- printf("TPS: %.3f\nFPS: %.3f\n", (double)coreWindowTicksPerSecond(),
- (double)coreWindowFramesPerSecond());
- }
- static void render(void*, float) {
- }
- static void testWindow(void) {
- CoreWindowOptions options = {{800, 480}, false, "Test"};
- if(coreWindowOpen(&options)) {
- return;
- }
- coreWindowShow();
- coreWindowRunHandler(isRunning, nullptr);
- coreWindowTickHandler(tick, nullptr);
- coreWindowRenderHandler(render, nullptr);
- coreWindowNanosPerTick(50000000);
- coreWindowRun();
- coreWindowClose();
- }
- int main(int argAmount, char** args) {
- (void)args;
- if(argAmount < 2) {
- CORE_LOG_ERROR("missing path to images");
- return 0;
- }
- // coreTestImageReader(args[1]);
- // coreTestNetwork();
- testWindow();
- coreFinalizeTests();
- corePrintMemoryReport();
- return 0;
- }
|