Allow nested frame buffer binds.

Allow windows with frame buffers.
Allow resize frame buffers.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2017-10-08 04:18:11 -03:00
parent 26889629e9
commit d16b0f6aa1
13 changed files with 174 additions and 13 deletions

View File

@@ -41,6 +41,9 @@ class EE_API FrameBuffer {
** This is needed by the engine to recover any context lost. */
virtual void reload() = 0;
/** @brief Resizes the current Frame Buffer */
virtual void resize( const Uint32& Width, const Uint32& Height ) = 0;
/** @return The frame buffer texture. Everything is rendered to this texture.
** To render the frame buffer you just need to draw the texture as any other texture.
** The frame buffer must be unbinded before any rendering is done outside the frame buffer.
@@ -73,6 +76,7 @@ class EE_API FrameBuffer {
bool mHasStencilBuffer;
Texture * mTexture;
ColorAf mClearColor;
View mView;
View mPrevView;
float mProjMat[16];

View File

@@ -159,12 +159,16 @@ class EE_API UIControl {
Uint32 isScaled();
Uint32 isFrameBuffer();
bool isMeOrParentTreeRotated();
bool isMeOrParentTreeScaled();
bool isMeOrParentTreeScaledOrRotated();
bool isMeOrParentTreeScaledOrRotatedOrFrameBuffer();
Uint32 addEventListener( const Uint32& EventType, const UIEventCallback& Callback );
void removeEventListener( const Uint32& CallbackId );

View File

@@ -26,6 +26,7 @@ enum UI_CONTROL_FLAGS_VALUES {
UI_CTRL_FLAG_OWNED_BY_WINDOW = (1<<17),
UI_CTRL_FLAG_DRAWABLE_OWNER = (1<<18),
UI_CTRL_FLAG_REVERSE_DRAW = (1<<19),
UI_CTRL_FLAG_FRAME_BUFFER = (1<<20),
UI_CTRL_FLAG_FREE_USE = (1<<31)
};
@@ -121,7 +122,8 @@ enum UI_MANAGER_FLAGS {
UI_MANAGER_HIGHLIGHT_FOCUS = ( 1 << 0 ),
UI_MANAGER_HIGHLIGHT_OVER = ( 1 << 1 ),
UI_MANAGER_DRAW_DEBUG_DATA = ( 1 << 2 ),
UI_MANAGER_DRAW_BOXES = ( 1 << 3 )
UI_MANAGER_DRAW_BOXES = ( 1 << 3 ),
UI_MANAGER_MAIN_CONTROL_IN_FRAME_BUFFER = ( 1 << 4 )
};
enum UI_WINDOW_FLAGS {
@@ -134,7 +136,8 @@ enum UI_WINDOW_FLAGS {
UI_WIN_DRAGABLE_CONTAINER = ( 1 << 6 ),
UI_WIN_SHARE_ALPHA_WITH_CHILDS = ( 1 << 7 ),
UI_WIN_MODAL = ( 1 << 8 ),
UI_WIN_SHADOW = ( 1 << 9 )
UI_WIN_SHADOW = ( 1 << 9 ),
UI_WIN_FRAME_BUFFER = ( 1 << 10 )
};
enum UI_COMMON_DIALOG_FLAGS {

View File

@@ -83,6 +83,10 @@ class EE_API UIManager {
void setHighlightOverColor( const Color& Color );
void setMainControlInFrameBuffer( const bool& set );
bool isMainControlInFrameBuffer() const;
const Color& getHighlightOverColor() const;
void sendMouseClick( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags );

View File

@@ -5,6 +5,10 @@
#include <eepp/ui/uipushbutton.hpp>
#include <eepp/ui/uitextview.hpp>
namespace EE { namespace Graphics {
class FrameBuffer;
}}
namespace EE { namespace UI {
class EE_API UIWindow : public UIWidget {
@@ -95,6 +99,8 @@ class EE_API UIWindow : public UIWidget {
const Sizei& getMinWindowSize();
bool ownsFrameBuffer();
virtual void loadFromXmlNode( const pugi::xml_node& node );
protected:
class KeyboardShortcut {
@@ -130,6 +136,7 @@ class EE_API UIWindow : public UIWidget {
RESIZE_TOPRIGHT
};
FrameBuffer * mFrameBuffer;
UIWindowStyleConfig mStyleConfig;
UIControlAnim * mWindowDecoration;
UIControlAnim * mBorderLeft;
@@ -162,6 +169,10 @@ class EE_API UIWindow : public UIWidget {
virtual Uint32 onKeyDown( const UIEventKey &Event );
virtual void matrixSet();
virtual void matrixUnset();
void onButtonCloseClick( const UIEvent * Event );
void onButtonMaximizeClick( const UIEvent * Event );
@@ -207,6 +218,8 @@ class EE_API UIWindow : public UIWidget {
void applyMinWinSize();
void updateWinFlags();
void createFrameBuffer();
};
}}