BaseWindow.h 859 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <glad/glad.h>
  3. #include <GLFW/glfw3.h>
  4. #include <imgui.h>
  5. #include <imgui_impl_glfw.h>
  6. #include <imgui_impl_opengl3.h>
  7. #include "Audio.h"
  8. struct Color {
  9. float r;
  10. float g;
  11. float b;
  12. float a;
  13. static Color color_from_short(uint8_t r, uint8_t g, uint8_t b,
  14. uint8_t alpha) {
  15. Color c;
  16. c.r = r / 256.0f;
  17. c.g = g / 256.0f;
  18. c.b = b / 256.0f;
  19. c.a = alpha / 256.0f;
  20. return c;
  21. }
  22. };
  23. class BaseWindow {
  24. public:
  25. BaseWindow(int width, int height, const char *title, Color clear_color,
  26. Audio *audio_handler);
  27. ~BaseWindow();
  28. int run();
  29. private:
  30. Color m_clear_color = {0};
  31. int m_window_width;
  32. int m_window_height;
  33. const char *m_window_title;
  34. GLFWwindow *m_window{};
  35. Audio *m_audio_handler;
  36. };