#include <SDL.h>
+#include <functional>
+
namespace IPDF
{
/*
// Returns 'false' if the program should quit.
bool PumpEvents();
+ // Clears the screen to a given colour.
+ void Clear(float r=1.0, float g=1.0, float b=1.0, float a=1.0);
+
// Finishes rendering a frame, and presents it on the screen.
void Present();
// Get the current width/height of the window's viewport.
- int ViewportWidth() { return m_viewport_width; }
- int ViewportHeight() { return m_viewport_height; }
+ int ViewportWidth() const { return m_viewport_width; }
+ int ViewportHeight() const { return m_viewport_height; }
+
+ // Handle mouse input.
+ typedef std::function<void(int x, int y, int button, int wheel)> MouseHandler;
+ void SetMouseHandler(MouseHandler handler)
+ {
+ m_mouse_handler = handler;
+ }
+
+ enum MouseCursors
+ {
+ CursorArrow,
+ CursorWait,
+ CursorWaitArrow,
+ CursorMove,
+ CursorHand
+ };
+ void SetMouseCursor(MouseCursors cursor);
+
+ void ScreenShot(const char * filename) const;
+ void RenderBMP(const char * filename) const;
private:
void ResizeViewport(int width, int height);
+
+ MouseHandler m_mouse_handler;
+ int m_last_mouse_x;
+ int m_last_mouse_y;
int m_viewport_width;
int m_viewport_height;
SDL_Window *m_window;
SDL_GLContext m_gl_context;
};
+
}
#endif // _SCREEN_H