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.

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <SDL.h>
  3. #include <stdint.h>
  4. #include "util.h"
  5. namespace Cygnet {
  6. class GlTexture;
  7. class Window {
  8. public:
  9. Window(const char *name, int width, int height);
  10. ~Window();
  11. void makeCurrent();
  12. void clear();
  13. void flip();
  14. int width() { return w_; }
  15. int height() { return h_; }
  16. // xScale and yScale are what drawn objects need to be scaled with
  17. // in order to have square pixels.
  18. float xScale() { return xScale_; }
  19. float yScale() { return yScale_; }
  20. void onResize(int w, int h);
  21. private:
  22. CPtr<SDL_Window, SDL_DestroyWindow> win_;
  23. SDL_GLContext glctx_;
  24. int w_;
  25. int h_;
  26. float yScale_;
  27. float xScale_;
  28. };
  29. }