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 467B

123456789101112131415161718192021222324252627282930313233
  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 { w_, h_ }; }
  17. SDL_Window *sdlWindow();
  18. private:
  19. std::unique_ptr<WindowState> state_;
  20. int w_;
  21. int h_;
  22. };
  23. }