# Changes
- Remove () from vec formatter -Add Merge function to DrawList to Move Data into the Current DrawList - Fix stupid bug in Rect.hpp which caused some problems in line rendering - Remove some unused UI7 Flags - io: Allocate FinalDrawList and add GetViewPort func - Readd TreeNodes to Menu - Add ABout/Style and Metrics Menu to Context - Add some Variables for cliprects in ui7 container.hpp - Add InputHandler functionality to DynObj - Fix Menu Layout Render Order - Add Better Menu Sorting to Context # ppam - Use stringview instead of hardcoded const char* # Todos - Work on the Lithium 3D System - Fix UI7 Menu Order to Pop new Menus into the front instead of the background - Add Scrolling support to menu (or integrate it into layout maybe)
This commit is contained in:
@ -63,6 +63,11 @@ class PD_UI7_API Container {
|
||||
// this->screen = io->Ren->CurrentScreen();
|
||||
}
|
||||
|
||||
void SetClipRect(fvec4 clip) {
|
||||
pClipRect = clip;
|
||||
pCLipRectUsed = true;
|
||||
}
|
||||
|
||||
/** Setter for Position */
|
||||
void SetPos(const fvec2& pos) { this->pos = pos; }
|
||||
/** Setter for Size */
|
||||
@ -161,6 +166,10 @@ class PD_UI7_API Container {
|
||||
bool pPressed = false;
|
||||
/** Was Pressed Twice */
|
||||
bool pPressedTwice = false;
|
||||
/** ClipRect */
|
||||
fvec4 pClipRect;
|
||||
/** Clip Rect used */
|
||||
bool pCLipRectUsed = false;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
|
@ -52,6 +52,10 @@ class PD_UI7_API DynObj : public Container {
|
||||
|
||||
PD_SHARED(DynObj);
|
||||
|
||||
void AddInputHandler(std::function<void(UI7::IO::Ref, Container*)> inp) {
|
||||
pInp = inp;
|
||||
}
|
||||
|
||||
/** Return true if butten is pressed*/
|
||||
bool IsPressed() { return pressed; }
|
||||
/**
|
||||
@ -72,6 +76,7 @@ class PD_UI7_API DynObj : public Container {
|
||||
UI7Color color = UI7Color_Button; ///< current button color
|
||||
bool pressed = false; ///< ispressed value
|
||||
std::function<void(UI7::IO::Ref, Li::DrawList::Ref, Container*)> pRenFun;
|
||||
std::function<void(UI7::IO::Ref, Container*)> pInp;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
@ -31,8 +31,6 @@ using UI7Align = unsigned int;
|
||||
using UI7IOFlags = unsigned int;
|
||||
/** 32Bit Value for Layout Flags */
|
||||
using UI7LayoutFlags = unsigned int;
|
||||
/** 32Bit value for DrawFlags */
|
||||
using UI7DrawFlags = unsigned int;
|
||||
|
||||
/** Menu Flags */
|
||||
enum UI7MenuFlags_ {
|
||||
@ -48,6 +46,9 @@ enum UI7MenuFlags_ {
|
||||
UI7MenuFlags_NoResize = 1 << 8, ///< Disable Menu Resize
|
||||
UI7MenuFlags_NoClose = 1 << 9, ///< Disable Close Button
|
||||
UI7MenuFlags_NoScrollbar = 1 << 10, ///< Hide the Scrollbar
|
||||
// POC
|
||||
UI7MenuFlags_Maximize = 1 << 11, ///< Add a Maximize Button
|
||||
UI7MenuFlags_Minimize = 1 << 12, ///< Add a Minimize Button
|
||||
// Enable Horizontal and Vertical Scrolling
|
||||
UI7MenuFlags_Scrolling = UI7MenuFlags_HzScrolling | UI7MenuFlags_VtScrolling,
|
||||
};
|
||||
@ -58,12 +59,6 @@ enum UI7LayoutFlags_ {
|
||||
UI7LayoutFlags_UseClipRect = 1 << 0, ///< Enable ClipRect
|
||||
};
|
||||
|
||||
enum UI7DrawFlags_ {
|
||||
UI7DrawFlags_None = 0,
|
||||
UI7DrawFlags_Close = 1 << 0, ///< Close a PolyLine
|
||||
UI7DrawFlags_AALines = 1 << 1, ///< Anti aliased Lines
|
||||
};
|
||||
|
||||
/** UI7 Context Flags */
|
||||
enum UI7IOFlags_ {
|
||||
UI7IOFlags_None = 0, ///< No Additional Config available
|
||||
@ -91,6 +86,11 @@ enum UI7LytAdd_ {
|
||||
UI7LytAdd_Front = 1 << 2, ///< Add in front of the list
|
||||
};
|
||||
|
||||
/**
|
||||
* Todo: Look at this
|
||||
* Maybe proof of concept ???
|
||||
* Didnt remember that this exists
|
||||
*/
|
||||
enum UI7ContainerFlags_ {
|
||||
UI7ContainerFlags_None = 0,
|
||||
UI7ContainerFlags_EnableInternalInput = 1 << 0,
|
||||
|
@ -40,6 +40,7 @@ class PD_UI7_API IO {
|
||||
Theme = UI7::Theme::New();
|
||||
Back = Li::DrawList::New();
|
||||
Front = Li::DrawList::New();
|
||||
FDL = Li::DrawList::New();
|
||||
DeltaStats = TimeStats::New(60);
|
||||
/** Probably not the best solution i guess */
|
||||
CurrentViewPort.z = PD::Li::Gfx::pGfx->ViewPort.x;
|
||||
@ -54,6 +55,12 @@ class PD_UI7_API IO {
|
||||
*/
|
||||
void Update();
|
||||
|
||||
/**
|
||||
* Final Draw List for PD::Li::Gfx::RednerDrawData
|
||||
*
|
||||
* Possible thanks to the DrawList::Merge Feature
|
||||
*/
|
||||
Li::DrawList::Ref FDL = nullptr;
|
||||
ivec4 CurrentViewPort = ivec4(0, 0, 0, 0);
|
||||
std::unordered_map<u32, ViewPort::Ref> ViewPorts;
|
||||
float Framerate = 0.f;
|
||||
@ -94,6 +101,13 @@ class PD_UI7_API IO {
|
||||
ViewPorts[id] = ViewPort::New(id, size);
|
||||
}
|
||||
|
||||
ViewPort::Ref GetViewPort(const ID& id) {
|
||||
if (ViewPorts.count(id)) {
|
||||
return nullptr;
|
||||
}
|
||||
return ViewPorts[id];
|
||||
}
|
||||
|
||||
UI7::InputHandler::Ref InputHandler;
|
||||
};
|
||||
} // namespace UI7
|
||||
|
@ -126,7 +126,8 @@ class PD_UI7_API Layout {
|
||||
fvec2 MaxPosition;
|
||||
fvec4 WorkRect;
|
||||
|
||||
// Scrolling
|
||||
// Scrolling (Only theoretical)
|
||||
// Rendering must be done by the Objective that uses the Lyt
|
||||
fvec2 ScrollOffset;
|
||||
bool Scrolling[2];
|
||||
|
||||
|
@ -24,16 +24,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "pd/ui7/container/dragdata.hpp"
|
||||
#include <pd/core/core.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
#include <pd/ui7/layout.hpp>
|
||||
#include <pd/ui7/pd_p_api.hpp>
|
||||
|
||||
#include "pd/ui7/container/dragdata.hpp"
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
class PD_UI7_API Menu {
|
||||
public:
|
||||
public:
|
||||
Menu(const UI7::ID &id, UI7::IO::Ref pIO);
|
||||
~Menu() {}
|
||||
|
||||
@ -87,9 +88,11 @@ public:
|
||||
}
|
||||
pLayout->AddObject(r);
|
||||
}
|
||||
void Sameline() { pLayout->SameLine(); }
|
||||
void SameLine() { pLayout->SameLine(); }
|
||||
void Separator();
|
||||
void SeparatorText(const std::string &label);
|
||||
bool BeginTreeNode(const ID &id);
|
||||
void EndTreeNode();
|
||||
|
||||
void HandleFocus();
|
||||
void HandleScrolling();
|
||||
@ -106,8 +109,9 @@ public:
|
||||
ID pID;
|
||||
bool *pIsShown = nullptr;
|
||||
bool pIsOpen = true;
|
||||
std::unordered_map<u32, bool> pTreeNodes;
|
||||
|
||||
float TitleBarHeight = 0.f;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
|
@ -24,12 +24,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "pd/ui7/flags.hpp"
|
||||
#include <pd/core/core.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
#include <pd/ui7/menu.hpp>
|
||||
#include <pd/ui7/pd_p_api.hpp>
|
||||
|
||||
#include "pd/ui7/flags.hpp"
|
||||
|
||||
/**
|
||||
* Declare UI7 Version
|
||||
* Format: 00 00 00 00
|
||||
@ -48,7 +49,7 @@ namespace UI7 {
|
||||
PD_UI7_API std::string GetVersion(bool show_build = false);
|
||||
/** Base Context for UI7 */
|
||||
class PD_UI7_API Context {
|
||||
public:
|
||||
public:
|
||||
Context() { pIO = IO::New(); }
|
||||
~Context() = default;
|
||||
|
||||
@ -57,8 +58,13 @@ public:
|
||||
void AddViewPort(const ID &id, const ivec4 &vp);
|
||||
void UseViewPort(const ID &id);
|
||||
void Update();
|
||||
bool BeginMenu(const ID &id, UI7MenuFlags flags, bool *pShow = nullptr);
|
||||
bool BeginMenu(const ID &id, UI7MenuFlags flags = 0, bool *pShow = nullptr);
|
||||
void EndMenu();
|
||||
void AboutMenu(bool *show = nullptr);
|
||||
void MetricsMenu(bool *show = nullptr);
|
||||
void StyleEditor(bool *show = nullptr);
|
||||
|
||||
Li::DrawList::Ref GetDrawData() { return pIO->FDL; }
|
||||
|
||||
Menu::Ref pGetOrCreateMenu(const ID &id) {
|
||||
auto menu = pMenus.find(id);
|
||||
@ -73,7 +79,8 @@ public:
|
||||
/** Current Menu */
|
||||
Menu::Ref pCurrent = nullptr;
|
||||
std::vector<u32> pCurrentMenus;
|
||||
std::vector<u32> pDFO; /** Debug Final Order */
|
||||
std::unordered_map<u32, Menu::Ref> pMenus;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
|
Reference in New Issue
Block a user