glrenderwindow.h File Reference

Go to the documentation of this file. Source: include/ffw/graphics/glrenderwindow.h

/* This file is part of FineFramework project */
#ifndef FFW_GRAPHICS_GL_RENDER_WINDOW
#define FFW_GRAPHICS_GL_RENDER_WINDOW

#include <vector>
#include <memory>
#include "renderwindow.h"
#include "monitors.h"
#include "vec2.h"
#include "config.h"
#include "constants.h"

namespace ffw {
    class FFW_API GLRenderWindow: public RenderWindow {
    public:
        static std::vector<Monitor> getMonitors();
        static Monitor getPrimaryMonitor();
        static std::vector<Monitor::Mode> getMonitorModes(const Monitor& monitor);
        GLRenderWindow(const RenderWindowArgs& args, GLRenderWindow* other, Monitor* monitor = nullptr);
        virtual ~GLRenderWindow();
        void setPos(int posx, int posy) override;
        void setSize(int width, int height) override;
        Vec2<int> getPos() const override;
        Vec2<int> getSize() const override;
        void setWindowedMode() const;
        void setWindowedMode(int posx, int posy, int width, int height) const;
        void setFullscreen(const Monitor* monitor) const;
        bool shouldRender() const override;
        void renderFrame() override;
        void poolEvents() override;
        void waitForEvents() override;
        bool isInitialized() const override;
        void* getGlextFunc(const std::string& name) const override;
        bool isGlextExtSupported(const std::string& name) const override;
        void setSwapInterval(int interval) const;
        void shouldClose(bool close) override;
        void show() override;
        void hide() override;
        void iconify() override;
        void restore() override;
        void maximize() override;
        void setSingleBufferMode(bool enabled) override;
#if defined(FFW_WINDOWS)

        void* getWin32Window();
        void* getWGLContext();
#elif defined(FFW_LINUX)

        void* getX11Window();
        void* getX11Display();
#elif defined(FFW_OSX)

        void* getCocoaWindow();
        void* getNSGLContext();
#endif
        struct WindowCallback;
        friend struct WindowCallback;
    protected:
        virtual void render() = 0;
        virtual void textInputEvent(unsigned int c);
        virtual void keyPressedEvent(ffw::Key key, ffw::KeyMode mode);
        virtual void mouseMovedEvent(int mousex, int mousey);
        virtual void mouseScrollEvent(int scroll);
        virtual void mouseButtonEvent(ffw::MouseButton button, ffw::MouseMode mode);
        virtual void windowResizedEvent(int width, int height);
        virtual void windowMovedEvent(int posx, int posy);
        virtual void windowCloseEvent();
        virtual void windowFocusEvent(bool focus);
        virtual void filesDroppedEvent(std::vector<std::string> filelist);
    private:
        class Impl;
        std::unique_ptr<Impl> pimpl;
    };
};

#endif