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.

Context.cc 583B

123456789101112131415161718192021222324252627
  1. #include "Context.h"
  2. #include <SDL.h>
  3. #include "util.h"
  4. namespace Cygnet {
  5. Context::Context() {
  6. SDL_Init(SDL_INIT_VIDEO);
  7. SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
  8. SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
  9. SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
  10. SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
  11. SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
  12. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
  13. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8);
  14. SDL_GL_SetSwapInterval(1);
  15. }
  16. Context::~Context() {
  17. SDL_Quit();
  18. }
  19. }