renderwindow.h File Reference
Go to the documentation of this file.
Source: include/ffw/graphics/renderwindow.h
/* This file is part of FineFramework project */
#ifndef FFW_GRAPHICS_RENDER_WINDOW
#define FFW_GRAPHICS_RENDER_WINDOW
#include <string>
#include "glrenderextensions.h"
#include "vec2.h"
namespace ffw {
class WindowException: public std::runtime_error {
public:
WindowException(const char* msg):std::runtime_error(msg) {
}
WindowException(const std::string& msg) :std::runtime_error(msg) {
}
};
enum class ClientGLAPI {
NONE,
OPENGL,
OPENGL_ES,
ANY
};
enum class ClientGLProfile {
ANY,
CORE,
COMPAT
};
struct FFW_API RenderWindowArgs {
ClientGLAPI glApi = ClientGLAPI::ANY;
ClientGLProfile glProfile = ClientGLProfile::ANY;
Vec2<int> pos = Vec2<int>(-1, -1);
Vec2<int> size = Vec2<int>(400, 400);
std::string title;
bool resizable = true;
bool border = true;
bool maximize = true;
bool floating = false;
bool focused = true;
bool visible = true;
int samples = 0;
const unsigned char* iconPtr = nullptr;
int iconWidth = 0;
int iconHeight = 0;
Vec2<int> contextVersion = Vec2<int>(0, 0);
void setCore() {
contextVersion.set(3, 3);
glProfile = ClientGLProfile::CORE;
}
};
class FFW_API RenderWindow {
public:
virtual ~RenderWindow() = default;
virtual void* getGlextFunc(const std::string& name) const = 0;
virtual bool isGlextExtSupported(const std::string& name) const = 0;
virtual void setPos(int posx, int posy) = 0;
virtual void setSize(int width, int height) = 0;
virtual Vec2<int> getPos() const = 0;
virtual Vec2<int> getSize() const = 0;
virtual bool shouldRender() const = 0;
virtual void renderFrame() = 0;
virtual void poolEvents() = 0;
virtual void waitForEvents() = 0;
virtual bool isInitialized() const = 0;
virtual void shouldClose(bool close) = 0;
virtual void show() = 0;
virtual void hide() = 0;
virtual void iconify() = 0;
virtual void restore() = 0;
virtual void maximize() = 0;
virtual void setSingleBufferMode(bool enabled) = 0;
};
};
#endif