#ifndef _H_GLWINDOW_H
#define _H_GLWINDOW_H

#include <SDL_video.h>
#include <thirdparty/glad/glad.h>

#include "utility/logger.h"

class GLWindow {
public:
  GLWindow(const char *windowName, int width, int height)
      : w(width), h(height), name(windowName) {};
  ~GLWindow();

  bool Init();

  void swap() { SDL_GL_SwapWindow(window); }
  void makeCurrent() { SDL_GL_MakeCurrent(window, glContext); }

  unsigned Width() const { return w; }
  unsigned Height() const { return h; }

  void resizeWindow(size_t w, size_t h);

  SDL_Window *getWindow() const { return window; }
  const SDL_GLContext &getContext() const { return glContext; }

private:
  SDL_Window *window = nullptr;
  SDL_GLContext glContext = NULL;

  unsigned w, h;
  const char *name;
};

#endif // _H_GLWINDOW_H
