mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
special input widget doesn't remake colour texture when inactive/not selected.
Improves performance on some machines with servers that eedefine colours a lot (like auto rainbow plugin)
This commit is contained in:
parent
50c676dd6d
commit
22ae79b466
@ -19,8 +19,8 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
|
|
||||||
public void UpdateColours() {
|
public void UpdateColours() {
|
||||||
elements[0].Contents = GetColourString();
|
elements[0].Contents = GetColourString();
|
||||||
|
if (!Active || selectedIndex != 0) return;
|
||||||
Redraw();
|
Redraw();
|
||||||
SetActive(Active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture texture;
|
public Texture texture;
|
||||||
@ -63,7 +63,7 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
{
|
{
|
||||||
drawer.SetBitmap(bmp);
|
drawer.SetBitmap(bmp);
|
||||||
DrawTitles(drawer, font);
|
DrawTitles(drawer, font);
|
||||||
drawer.Clear(new FastColour(30, 30, 30, 200), 0, titleHeight,
|
drawer.Clear(new PackedCol(30, 30, 30, 200), 0, titleHeight,
|
||||||
size.Width, bodySize.Height);
|
size.Width, bodySize.Height);
|
||||||
|
|
||||||
DrawContent(drawer, font, e, titleHeight);
|
DrawContent(drawer, font, e, titleHeight);
|
||||||
@ -201,8 +201,8 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
DrawTextArgs args = new DrawTextArgs(null, font, false);
|
DrawTextArgs args = new DrawTextArgs(null, font, false);
|
||||||
for (int i = 0; i < elements.Length; i++) {
|
for (int i = 0; i < elements.Length; i++) {
|
||||||
args.Text = elements[i].Title;
|
args.Text = elements[i].Title;
|
||||||
FastColour col = i == selectedIndex ? new FastColour(30, 30, 30, 200) :
|
PackedCol col = i == selectedIndex ? new PackedCol(30, 30, 30, 200) :
|
||||||
new FastColour(0, 0, 0, 127);;
|
new PackedCol(0, 0, 0, 127);;
|
||||||
Size size = elements[i].TitleSize;
|
Size size = elements[i].TitleSize;
|
||||||
|
|
||||||
drawer.Clear(col, x, 0, size.Width, size.Height);
|
drawer.Clear(col, x, 0, size.Width, size.Height);
|
||||||
|
@ -2639,8 +2639,8 @@ static bool SpecialInputWidget_HandlesMouseDown(GuiElement* elem, Int32 x, Int32
|
|||||||
void SpecialInputWidget_UpdateCols(SpecialInputWidget* widget) {
|
void SpecialInputWidget_UpdateCols(SpecialInputWidget* widget) {
|
||||||
SpecialInputWidget_UpdateColString(widget);
|
SpecialInputWidget_UpdateColString(widget);
|
||||||
widget->Tabs[0].Contents = widget->ColString;
|
widget->Tabs[0].Contents = widget->ColString;
|
||||||
|
if (!widget->Active || widget->SelectedIndex != 0) return;
|
||||||
SpecialInputWidget_Redraw(widget);
|
SpecialInputWidget_Redraw(widget);
|
||||||
SpecialInputWidget_SetActive(widget, widget->Active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialInputWidget_SetActive(SpecialInputWidget* widget, bool active) {
|
void SpecialInputWidget_SetActive(SpecialInputWidget* widget, bool active) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user