Reimplement list sorting and Fix UI7 Layers
This commit is contained in:
@@ -132,10 +132,24 @@ class CmdPool {
|
||||
size_t idx = pPoolIdx++;
|
||||
*pPool[idx] = *p.GetCmd(i);
|
||||
pPool[idx]->Index = idx;
|
||||
pPool[idx]->Layer += Layer;
|
||||
}
|
||||
}
|
||||
|
||||
void Sort() {
|
||||
std::sort(begin(), end(),
|
||||
[](const Command::Ref& a, const Command::Ref& b) -> bool {
|
||||
if (a->Layer == b->Layer) {
|
||||
return a->Tex < b->Tex;
|
||||
}
|
||||
return a->Layer < b->Layer;
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
friend class DrawList;
|
||||
Command::Ref* begin() { return &pPool[0]; }
|
||||
Command::Ref* end() { return &pPool[pPoolIdx]; }
|
||||
std::vector<Command::Ref> pPool;
|
||||
u32 pPoolIdx = 0;
|
||||
int Layer = 0;
|
||||
|
||||
@@ -83,10 +83,10 @@ class PD_LITHIUM_API DrawList {
|
||||
|
||||
Command::Ref GetNewCmd();
|
||||
void Clear();
|
||||
void Layer(int l) { this->pLayer = l; }
|
||||
int Layer() { return this->pLayer; }
|
||||
void LayerUp() { this->pLayer++; }
|
||||
void LayerDown() { this->pLayer--; }
|
||||
void Layer(int l) { this->pPool.Layer = l; }
|
||||
int Layer() { return this->pPool.Layer; }
|
||||
void LayerUp() { this->pPool.Layer++; }
|
||||
void LayerDown() { this->pPool.Layer--; }
|
||||
|
||||
void SetFont(Font::Ref font) { pCurrentFont = font; }
|
||||
void SetFontScale(float scale) { pFontScale = scale; }
|
||||
@@ -212,7 +212,6 @@ class PD_LITHIUM_API DrawList {
|
||||
/** Data Section */
|
||||
|
||||
std::stack<fvec4> pClipRects;
|
||||
int pLayer;
|
||||
float pFontScale = 0.7f;
|
||||
Font::Ref pCurrentFont;
|
||||
Texture::Ref CurrentTex;
|
||||
|
||||
Reference in New Issue
Block a user