os.hpp 890 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef SAURA_OS_HPP_
  2. #define SAURA_OS_HPP_
  3. #include <cstdint>
  4. #include <filesystem>
  5. #include <SDL3/SDL_render.h>
  6. #include <SDL3/SDL_video.h>
  7. namespace fs = std::filesystem;
  8. namespace saura {
  9. class OS {
  10. struct Window_Context {
  11. uint32_t w, h;
  12. std::string title;
  13. SDL_Window *handle;
  14. SDL_Renderer *renderer;
  15. };
  16. private:
  17. std::unique_ptr<Window_Context> root_window_ctx;
  18. public:
  19. OS();
  20. ~OS();
  21. void draw_begin();
  22. void draw_end();
  23. void update();
  24. bool update_events();
  25. void sleep(double ms);
  26. int get_root_window_width();
  27. int get_root_window_height();
  28. void set_root_window_title(std::string title);
  29. double get_performance_frequency();
  30. double get_performance_counter();
  31. static std::string get_safe_getenv(const std::string key);
  32. static fs::path get_home_config_path();
  33. static std::string get_user_name();
  34. };
  35. } // namespace saura
  36. #endif