window.h 875 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include <glad/glad.h> //so we don't have conflicts
  3. #include <GLFW/glfw3.h>
  4. #include <pikaContext.h>
  5. #include "input.h"
  6. #include <chrono>
  7. namespace pika
  8. {
  9. struct WindowState
  10. {
  11. //might differ from framebuffer w, h
  12. int windowW = 0;
  13. int windowH = 0;
  14. //you should probably use this one
  15. int frameBufferW = 0;
  16. int frameBufferH = 0;
  17. };
  18. //this is not intended to have multiple instances in the program
  19. struct PikaWindow
  20. {
  21. pika::PikaContext context = {};
  22. //this is made to be passed to the user code
  23. //on live code editing this will be recorded every frame
  24. Input input = {};
  25. WindowState windowState = {};
  26. //this doesn't return error codes because it will do the asserts for you
  27. void create();
  28. void saveWindowPositions();
  29. bool shouldClose();
  30. void update();
  31. std::chrono::steady_clock::time_point timer = {};
  32. };
  33. }