Main.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include <GLFW/glfw3.h>
  2. #include <core/Logger.h>
  3. #include <core/Utility.h>
  4. #include <stdio.h>
  5. #include "Tests.h"
  6. #include "core/Window.h"
  7. static int ticks = 40;
  8. static bool isRunning(void*) {
  9. return !coreWindowShouldClose() && ticks > 0;
  10. }
  11. static void tick(void*) {
  12. ticks -= ticks > 0;
  13. printf("TPS: %.3f\nFPS: %.3f\n", (double)coreWindowTicksPerSecond(),
  14. (double)coreWindowFramesPerSecond());
  15. }
  16. static void render(void*, float) {
  17. }
  18. static void testWindow(void) {
  19. CoreWindowOptions options = {{800, 480}, false, "Test"};
  20. if(coreWindowOpen(&options)) {
  21. return;
  22. }
  23. coreWindowShow();
  24. coreWindowRunHandler(isRunning, nullptr);
  25. coreWindowTickHandler(tick, nullptr);
  26. coreWindowRenderHandler(render, nullptr);
  27. coreWindowNanosPerTick(50000000);
  28. coreWindowRun();
  29. coreWindowClose();
  30. }
  31. int main(int argAmount, char** args) {
  32. (void)args;
  33. if(argAmount < 2) {
  34. CORE_LOG_ERROR("missing path to images");
  35. return 0;
  36. }
  37. // coreTestImageReader(args[1]);
  38. // coreTestNetwork();
  39. testWindow();
  40. coreFinalizeTests();
  41. corePrintMemoryReport();
  42. return 0;
  43. }