Merge dev-0.7-rewrite into stable
This commit is contained in:
+92
-96
@@ -41,27 +41,24 @@ PD_API std::string GetVersion(bool show_build) {
|
||||
}
|
||||
|
||||
PD_API void Context::AddViewPort(const ID& id, const ivec4& vp) {
|
||||
pIO->AddViewPort(id, vp);
|
||||
pIO.AddViewPort(id, vp);
|
||||
}
|
||||
|
||||
PD_API void Context::UseViewPort(const ID& id) {
|
||||
if (!pIO->ViewPorts.count(id)) {
|
||||
if (!pIO.ViewPorts.count(id)) {
|
||||
return;
|
||||
}
|
||||
pIO->CurrentViewPort = pIO->ViewPorts[id];
|
||||
pIO.CurrentViewPort = pIO.ViewPorts[id.RawID()];
|
||||
}
|
||||
|
||||
PD_API Menu::Ref Context::BeginMenu(const ID& id, UI7MenuFlags flags,
|
||||
bool* pShow) {
|
||||
PD_API Menu* Context::BeginMenu(const ID& id, UI7MenuFlags flags, bool* pShow) {
|
||||
if (pCurrent) {
|
||||
std::cout << "[UI7] Error: You are already in " << pCurrent->pID.GetName()
|
||||
<< " Menu" << std::endl;
|
||||
PDERR("UI7: You are already in {} Menu!", pCurrent->pID.GetName());
|
||||
return nullptr;
|
||||
}
|
||||
if (std::find(pCurrentMenus.begin(), pCurrentMenus.end(), (u32)id) !=
|
||||
pCurrentMenus.end()) {
|
||||
std::cout << "[UI7] Error: Menu " << id.GetName() << " already exists!"
|
||||
<< std::endl;
|
||||
PDERR("UI7: Menu {} already exists!", id.GetName());
|
||||
return nullptr;
|
||||
}
|
||||
pCurrent = pGetOrCreateMenu(id);
|
||||
@@ -73,7 +70,7 @@ PD_API Menu::Ref Context::BeginMenu(const ID& id, UI7MenuFlags flags,
|
||||
}
|
||||
}
|
||||
/** Probably we dont even need Input Handling in this stage */
|
||||
// this->pIO->InputHandler->CurrentMenu = id;
|
||||
// this->pIO.InputHandler.CurrentMenu = id;
|
||||
pCurrentMenus.push_back(id);
|
||||
pCurrent->Flags = flags;
|
||||
if (!pCurrent->pIsOpen) {
|
||||
@@ -101,7 +98,7 @@ PD_API void Context::EndMenu() {
|
||||
return;
|
||||
}
|
||||
pCurrent = nullptr;
|
||||
// pIO->InputHandler->CurrentMenu = 0;
|
||||
// pIO.InputHandler.CurrentMenu = 0;
|
||||
}
|
||||
|
||||
PD_API void Context::Update() {
|
||||
@@ -117,41 +114,44 @@ PD_API void Context::Update() {
|
||||
*
|
||||
* Very simple ...
|
||||
*/
|
||||
pIO->FDL->Clear();
|
||||
pIO.FDL.Clear();
|
||||
if (std::find(pCurrentMenus.begin(), pCurrentMenus.end(),
|
||||
pIO->InputHandler->FocusedMenu) == pCurrentMenus.end()) {
|
||||
pIO->InputHandler->FocusedMenu = 0;
|
||||
pIO->InputHandler->FocusedMenuRect = fvec4(0);
|
||||
pIO.InputHandler.FocusedMenu) == pCurrentMenus.end()) {
|
||||
pIO.InputHandler.FocusedMenu = 0;
|
||||
pIO.InputHandler.FocusedMenuRect = fvec4(0);
|
||||
}
|
||||
std::vector<u32> FinalList;
|
||||
for (auto it : pDFO) {
|
||||
if (std::find(pCurrentMenus.begin(), pCurrentMenus.end(), it) !=
|
||||
pCurrentMenus.end() &&
|
||||
it != pIO->InputHandler->FocusedMenu) {
|
||||
it != pIO.InputHandler.FocusedMenu) {
|
||||
FinalList.push_back(it);
|
||||
}
|
||||
}
|
||||
for (auto it : pCurrentMenus) {
|
||||
if (std::find(FinalList.begin(), FinalList.end(), it) == FinalList.end() &&
|
||||
it != pIO->InputHandler->FocusedMenu) {
|
||||
it != pIO.InputHandler.FocusedMenu) {
|
||||
FinalList.push_back(it);
|
||||
}
|
||||
}
|
||||
if (pMenus.count(pIO->InputHandler->FocusedMenu)) {
|
||||
FinalList.insert(FinalList.begin(), pIO->InputHandler->FocusedMenu);
|
||||
if (pMenus.count(pIO.InputHandler.FocusedMenu)) {
|
||||
FinalList.insert(FinalList.begin(), pIO.InputHandler.FocusedMenu);
|
||||
}
|
||||
pDFO = FinalList;
|
||||
for (auto& it : FinalList) {
|
||||
this->pIO->InputHandler->CurrentMenu = it;
|
||||
this->pIO.InputHandler.CurrentMenu = it;
|
||||
pMenus[it]->Update(); /** Render */
|
||||
this->pIO->InputHandler->CurrentMenu = 0;
|
||||
this->pIO.InputHandler.CurrentMenu = 0;
|
||||
}
|
||||
int base_layer = 0;
|
||||
for (int i = (int)FinalList.size() - 1; i >= 0; i--) {
|
||||
pIO->FDL->Merge(pMenus[FinalList[i]]->pLayout->GetDrawList());
|
||||
pIO.FDL.SetLayer(base_layer);
|
||||
pIO.FDL.Merge(pMenus[FinalList[i]]->pLayout.GetDrawList());
|
||||
base_layer += 100;
|
||||
}
|
||||
pCurrentMenus.clear();
|
||||
pIO->Update();
|
||||
pIO->FDL->pPool.Sort();
|
||||
pIO.Update();
|
||||
pIO.FDL.Optimize();
|
||||
}
|
||||
|
||||
PD_API void Context::AboutMenu(bool* show) {
|
||||
@@ -169,7 +169,7 @@ PD_API void Context::AboutMenu(bool* show) {
|
||||
m->Label("sizeof(size_t) -> " + std::to_string(sizeof(size_t)));
|
||||
m->Label("sizeof(LI::Vertex) -> " + std::to_string(sizeof(Li::Vertex)));
|
||||
m->Label("__cplusplus -> " + std::to_string(__cplusplus));
|
||||
m->Label("Compiler -> " +
|
||||
m->Label("Compiler -> {}",
|
||||
Strings::GetCompilerVersion()); // + LibInfo::CompiledWith());
|
||||
}
|
||||
EndMenu();
|
||||
@@ -182,47 +182,46 @@ PD_API void Context::MetricsMenu(bool* show) {
|
||||
m->Separator();
|
||||
m->Label(
|
||||
std::format("Average {:.3f} ms/f ({:.1f} FPS)",
|
||||
((float)pIO->DeltaStats->GetAverage() / 1000.f),
|
||||
1000.f / ((float)pIO->DeltaStats->GetAverage() / 1000.f)));
|
||||
m->Label(std::format("NumVertices: {}", pIO->NumVertices));
|
||||
m->Label(std::format("NumIndices: {} -> {} Tris", pIO->NumIndices,
|
||||
pIO->NumIndices / 3));
|
||||
((float)pIO.DeltaStats.GetAverage() / 1000.f),
|
||||
1000.f / ((float)pIO.DeltaStats.GetAverage() / 1000.f)));
|
||||
m->Label(std::format("NumVertices: {}", pIO.NumVertices));
|
||||
m->Label(std::format("NumIndices: {} -> {} Tris", pIO.NumIndices,
|
||||
pIO.NumIndices / 3));
|
||||
m->Label("Menus: " + std::to_string(pMenus.size()));
|
||||
/** Section TimeTrace */
|
||||
m->SeparatorText("TimeTrace");
|
||||
if (m->BeginTreeNode("Traces (" +
|
||||
std::to_string(pIO->pCtx.Os()->GetTraceMap().size()) +
|
||||
")")) {
|
||||
for (auto& it : pIO->pCtx.Os()->GetTraceMap()) {
|
||||
if (m->BeginTreeNode(it.second->GetID())) {
|
||||
m->Label("Diff: " + UI7DTF(it.second->GetLastDiff()));
|
||||
std::to_string(PD::TT::GetTraceMap().size()) + ")")) {
|
||||
for (auto& it : PD::TT::GetTraceMap()) {
|
||||
if (m->BeginTreeNode(it.second.GetID())) {
|
||||
m->Label("Diff: " + UI7DTF(it.second.GetLastDiff()));
|
||||
m->Label("Protocol Len: " +
|
||||
std::to_string(it.second->GetProtocol()->GetLen()));
|
||||
m->Label("Average: " +
|
||||
UI7DTF(it.second->GetProtocol()->GetAverage()));
|
||||
m->Label("Min: " + UI7DTF(it.second->GetProtocol()->GetMin()));
|
||||
m->Label("Max: " + UI7DTF(it.second->GetProtocol()->GetMax()));
|
||||
std::to_string(it.second.GetProtocol().GetLen()));
|
||||
m->Label("Average: " + UI7DTF(it.second.GetProtocol().GetAverage()));
|
||||
m->Label("Min: " + UI7DTF(it.second.GetProtocol().GetMin()));
|
||||
m->Label("Max: " + UI7DTF(it.second.GetProtocol().GetMax()));
|
||||
m->EndTreeNode();
|
||||
}
|
||||
}
|
||||
m->EndTreeNode();
|
||||
}
|
||||
m->SeparatorText("Palladium Info");
|
||||
m->Label("Os Driver: {}", pIO->pCtx.Os()->GetName());
|
||||
m->Label("Renderer: " + pIO->pCtx.Gfx()->GetName());
|
||||
if (m->BeginTreeNode(std::string("Input: " + pIO->pCtx.Hid()->GetName()))) {
|
||||
if (pIO->pCtx.Hid()->Flags & PD::HidDriver::Flags_HasKeyboard) {
|
||||
m->Label("- Keyboard Supported");
|
||||
}
|
||||
if (pIO->pCtx.Hid()->Flags & PD::HidDriver::Flags_HasMouse) {
|
||||
m->Label("- Mouse Supported");
|
||||
}
|
||||
if (pIO->pCtx.Hid()->Flags & PD::HidDriver::Flags_HasTouch) {
|
||||
m->Label("- Touch Supported");
|
||||
}
|
||||
if (pIO->pCtx.Hid()->Flags & PD::HidDriver::FLags_HasGamepad) {
|
||||
m->Label("- Gamepad Supported");
|
||||
}
|
||||
m->Label("Os Driver: {}", PD::Os::GetDriverName());
|
||||
m->Label("Renderer: {}", PD::Gfx::GetDriverName());
|
||||
if (m->BeginTreeNode(
|
||||
std::string(std::string("Input: ") + PD::Hid::GetDriverName()))) {
|
||||
/* if (pIO.pCtx.Hid()->Flags & PD::HidDriver::Flags_HasKeyboard) {
|
||||
m->Label("- Keyboard Supported");
|
||||
}
|
||||
if (pIO.pCtx.Hid()->Flags & PD::HidDriver::Flags_HasMouse) {
|
||||
m->Label("- Mouse Supported");
|
||||
}
|
||||
if (pIO.pCtx.Hid()->Flags & PD::HidDriver::Flags_HasTouch) {
|
||||
m->Label("- Touch Supported");
|
||||
}
|
||||
if (pIO.pCtx.Hid()->Flags & PD::HidDriver::FLags_HasGamepad) {
|
||||
m->Label("- Gamepad Supported");
|
||||
}*/
|
||||
m->EndTreeNode();
|
||||
}
|
||||
/** Section IO */
|
||||
@@ -231,14 +230,14 @@ PD_API void Context::MetricsMenu(bool* show) {
|
||||
for (auto& it : pMenus) {
|
||||
if (m->BeginTreeNode(it.second->pID.GetName())) {
|
||||
m->Label("Name: " + it.second->pID.GetName());
|
||||
m->Label(std::format("Pos: {}", it.second->pLayout->GetPosition()));
|
||||
m->Label(std::format("Size: {}", it.second->pLayout->GetSize()));
|
||||
m->Label(std::format("WorkRect: {}", it.second->pLayout->WorkRect));
|
||||
m->Label(std::format("Cursor: {}", it.second->pLayout->Cursor));
|
||||
m->Label(std::format("Pos: {}", it.second->pLayout.GetPosition()));
|
||||
m->Label(std::format("Size: {}", it.second->pLayout.GetSize()));
|
||||
m->Label(std::format("WorkRect: {}", it.second->pLayout.WorkRect));
|
||||
m->Label(std::format("Cursor: {}", it.second->pLayout.Cursor));
|
||||
if (m->BeginTreeNode(
|
||||
"ID Objects (" +
|
||||
std::to_string(it.second->pLayout->IDObjects.size()) + ")")) {
|
||||
for (auto& jt : it.second->pLayout->IDObjects) {
|
||||
std::to_string(it.second->pLayout.IDObjects.size()) + ")")) {
|
||||
for (auto& jt : it.second->pLayout.IDObjects) {
|
||||
m->Label(std::format("{:08X}", jt->GetID()));
|
||||
}
|
||||
m->EndTreeNode();
|
||||
@@ -253,15 +252,14 @@ PD_API void Context::MetricsMenu(bool* show) {
|
||||
for (auto& it : pCurrentMenus) {
|
||||
if (m->BeginTreeNode(pMenus[it]->pID.GetName())) {
|
||||
m->Label("Name: " + pMenus[it]->pID.GetName());
|
||||
m->Label(std::format("Pos: {}", pMenus[it]->pLayout->GetPosition()));
|
||||
m->Label(std::format("Size: {}", pMenus[it]->pLayout->GetSize()));
|
||||
m->Label(std::format("WorkRect: {}", pMenus[it]->pLayout->WorkRect));
|
||||
m->Label(std::format("Cursor: {}", pMenus[it]->pLayout->Cursor));
|
||||
m->Label(std::format("Pos: {}", pMenus[it]->pLayout.GetPosition()));
|
||||
m->Label(std::format("Size: {}", pMenus[it]->pLayout.GetSize()));
|
||||
m->Label(std::format("WorkRect: {}", pMenus[it]->pLayout.WorkRect));
|
||||
m->Label(std::format("Cursor: {}", pMenus[it]->pLayout.Cursor));
|
||||
if (m->BeginTreeNode(
|
||||
"ID Objects (" +
|
||||
std::to_string(pMenus[it]->pLayout->IDObjects.size()) +
|
||||
")")) {
|
||||
for (auto& jt : pMenus[it]->pLayout->IDObjects) {
|
||||
std::to_string(pMenus[it]->pLayout.IDObjects.size()) + ")")) {
|
||||
for (auto& jt : pMenus[it]->pLayout.IDObjects) {
|
||||
m->Label(std::format("{:08X}", jt->GetID()));
|
||||
}
|
||||
m->EndTreeNode();
|
||||
@@ -273,8 +271,8 @@ PD_API void Context::MetricsMenu(bool* show) {
|
||||
}
|
||||
// Well this are Li Drawlists now and they do not count their stats (yet)
|
||||
/*if (m->BeginTreeNode("DrawLists (" +
|
||||
std::to_string(pIO->DrawListRegestry.size()) + ")")) {
|
||||
for (auto &it : pIO->DrawListRegestry) {
|
||||
std::to_string(pIO.DrawListRegestry.size()) + ")")) {
|
||||
for (auto &it : pIO.DrawListRegestry) {
|
||||
if (m->BeginTreeNode(it.First.GetName())) {
|
||||
m->Label("Vertices: " + std::to_string(it.Second->NumVertices));
|
||||
m->Label("Indices: " + std::to_string(it.Second->NumIndices));
|
||||
@@ -284,21 +282,20 @@ PD_API void Context::MetricsMenu(bool* show) {
|
||||
}
|
||||
m->EndTreeNode();
|
||||
}*/
|
||||
m->Label("io->Time: " + Strings::FormatMillis(pIO->Time->Get()));
|
||||
m->Label(std::format("Delta: {:.3f}", pIO->Delta));
|
||||
m->Label(std::format("Framerate: {:.2f}", pIO->Framerate));
|
||||
m->Label("io->Time: " + Strings::FormatMillis(pIO.Time.Get()));
|
||||
m->Label(std::format("Delta: {:.3f}", pIO.Delta));
|
||||
m->Label(std::format("Framerate: {:.2f}", pIO.Framerate));
|
||||
m->Label(std::format("Focused Menu: {:08X}", pIO.InputHandler.FocusedMenu));
|
||||
m->Label(
|
||||
std::format("Focused Menu: {:08X}", pIO->InputHandler->FocusedMenu));
|
||||
m->Label(std::format("Dragged Object: {:08X}",
|
||||
pIO->InputHandler->DraggedObject));
|
||||
std::format("Dragged Object: {:08X}", pIO.InputHandler.DraggedObject));
|
||||
m->Label(std::format("DragTime: {:.2f}s",
|
||||
pIO->InputHandler->DragTime->GetSeconds()));
|
||||
m->Label(std::format("DragDestination: [{}]",
|
||||
pIO->InputHandler->DragDestination));
|
||||
m->Label(std::format("DragSource: [{}]", pIO->InputHandler->DragSourcePos));
|
||||
m->Label(std::format("DragPos: [{}]", pIO->InputHandler->DragPosition));
|
||||
pIO.InputHandler.DragTime.GetSeconds()));
|
||||
m->Label(
|
||||
std::format("DragLastPos: [{}]", pIO->InputHandler->DragLastPosition));
|
||||
std::format("DragDestination: [{}]", pIO.InputHandler.DragDestination));
|
||||
m->Label(std::format("DragSource: [{}]", pIO.InputHandler.DragSourcePos));
|
||||
m->Label(std::format("DragPos: [{}]", pIO.InputHandler.DragPosition));
|
||||
m->Label(
|
||||
std::format("DragLastPos: [{}]", pIO.InputHandler.DragLastPosition));
|
||||
EndMenu();
|
||||
}
|
||||
}
|
||||
@@ -307,28 +304,27 @@ PD_API void UI7::Context::StyleEditor(bool* show) {
|
||||
if (auto m = BeginMenu("UI7 Style Editor", UI7MenuFlags_Scrolling, show)) {
|
||||
m->Label("Palladium - UI7 " + GetVersion() + " Style Editor");
|
||||
m->Separator();
|
||||
m->DragData("MenuPadding", (float*)&pIO->MenuPadding, 2, 0.f, 100.f);
|
||||
m->DragData("FramePadding", (float*)&pIO->FramePadding, 2, 0.f, 100.f);
|
||||
m->DragData("ItemSpace", (float*)&pIO->ItemSpace, 2, 0.f, 100.f);
|
||||
m->DragData("MinSliderSize", (float*)&pIO->MinSliderDragSize, 2, 1.f,
|
||||
100.f);
|
||||
m->DragData("OverScroll Modifier", &pIO->OverScrollMod, 1, 0.01f,
|
||||
m->DragData("MenuPadding", (float*)&pIO.MenuPadding, 2, 0.f, 100.f);
|
||||
m->DragData("FramePadding", (float*)&pIO.FramePadding, 2, 0.f, 100.f);
|
||||
m->DragData("ItemSpace", (float*)&pIO.ItemSpace, 2, 0.f, 100.f);
|
||||
m->DragData("MinSliderSize", (float*)&pIO.MinSliderDragSize, 2, 1.f, 100.f);
|
||||
m->DragData("OverScroll Modifier", &pIO.OverScrollMod, 1, 0.01f,
|
||||
std::numeric_limits<float>::max(), 0.01f, 2);
|
||||
m->Checkbox("Menu Border", pIO->ShowMenuBorder);
|
||||
m->Checkbox("Frame Border", pIO->ShowFrameBorder);
|
||||
m->Checkbox("Menu Border", pIO.ShowMenuBorder);
|
||||
m->Checkbox("Frame Border", pIO.ShowFrameBorder);
|
||||
m->SeparatorText("Theme");
|
||||
if (m->Button("Dark")) {
|
||||
UI7::Theme::Default(*pIO->Theme.get());
|
||||
UI7::Theme::Default(pIO.Theme);
|
||||
}
|
||||
m->SameLine();
|
||||
if (m->Button("Flashbang")) {
|
||||
UI7::Theme::Flashbang(*pIO->Theme.get());
|
||||
UI7::Theme::Flashbang(pIO.Theme);
|
||||
}
|
||||
/// Small trick to print without prefix
|
||||
#define ts(x) m->ColorEdit(std::string(#x).substr(9), pIO->Theme->GetRef(x));
|
||||
#define ts2(x) \
|
||||
m->DragData(std::string(#x).substr(9), (u8*)&pIO->Theme->GetRef(x), 4, \
|
||||
(u8)0, (u8)255);
|
||||
#define ts(x) m->ColorEdit(std::string(#x).substr(9), pIO.Theme.GetRef(x));
|
||||
#define ts2(x) \
|
||||
m->DragData(std::string(#x).substr(9), (u8*)&pIO.Theme.GetRef(x), 4, (u8)0, \
|
||||
(u8)255);
|
||||
ts(UI7Color_Background);
|
||||
ts(UI7Color_Border);
|
||||
ts(UI7Color_Button);
|
||||
|
||||
Reference in New Issue
Block a user