A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Window.h 526B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <swan-common/Vector2.h>
  3. #include <memory>
  4. #include "util.h"
  5. struct SDL_Window;
  6. namespace Cygnet {
  7. struct WindowState;
  8. class Window {
  9. public:
  10. Window(const char *name, int w, int h);
  11. ~Window();
  12. void makeCurrent();
  13. void clear(Color color = {});
  14. void flip();
  15. void onResize(int w, int h);
  16. SwanCommon::Vec2i size() { return size_; }
  17. double pixelRatio() { return ratio_; }
  18. SDL_Window *sdlWindow();
  19. private:
  20. std::unique_ptr<WindowState> state_;
  21. SwanCommon::Vec2i size_;
  22. double ratio_;
  23. };
  24. }