#include "render_device.hpp"

#include <SDL/SDL.h>

class SDLdev : public Render_device
{
private:
  SDL_Surface *rgbsurface;
  int bpp;

  Imlib_Image resized;
  int width, height;
  int line_len;

  int initialized;
  int verbose;

  bool fullscreen;

  ost::Mutex locked_mutex;

  void draw_rectangle(int x, int y, int w, int h);

  void sdldev_draw();

  void sdldev_draw_32();

  bool getSDLkey();
  void set_key_string(SDLKey key);
  bool input_wants_event;

public:
  SDL_Surface *screen;

  ost::Event get_input_event;
  std::string input_key;

  void get_input();

  SDLdev();
  ~SDLdev() { SDL_ShowCursor(SDL_ENABLE); terminate(); /* thread */ }
  
  void init();
  void deinit();

  void lock();
  void unlock();

  void redraw();

  void toggle_fullscreen();

 private:
  void run();
};
