Created
April 29, 2020 02:29
-
-
Save se5a/aa83958a981942e12121e5a36ea74fba to your computer and use it in GitHub Desktop.
Using BorderGroup and BorderListOptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int _bloSelectedIndex = -1; | |
void BorderListOptionsWiget() | |
{ | |
string[] items = new string[_listfoo.Count]; | |
for (int i = 0; i < _listfoo.Count; i++) | |
{ | |
items[i] = _listfoo[i].name; | |
} | |
BorderGroup.Begin("Border List Options: "); | |
BorderListOptions.Begin("blo", items, ref _bloSelectedIndex, 64); | |
if(_bloSelectedIndex >=0) | |
{ | |
if (ImGui.Button("^")) | |
{ | |
(string name, int count) item = _listfoo[_bloSelectedIndex]; | |
_listfoo.RemoveAt(_bloSelectedIndex); | |
_listfoo.Insert(_bloSelectedIndex - 1, item); | |
_bloSelectedIndex--; | |
} | |
ImGui.SameLine(); | |
if (ImGui.Button("v")) | |
{ | |
(string name, int count) item = _listfoo[_bloSelectedIndex]; | |
_listfoo.RemoveAt(_bloSelectedIndex); | |
_listfoo.Insert(_bloSelectedIndex + 1, item); | |
_bloSelectedIndex++; | |
} | |
ImGui.Text(_listfoo[_bloSelectedIndex].count.ToString()); | |
ImGui.SameLine(); | |
if (ImGui.Button("+")) | |
{ | |
_listfoo[_bloSelectedIndex] = (_listfoo[_bloSelectedIndex].name, _listfoo[_bloSelectedIndex].count + 1); | |
} | |
ImGui.SameLine(); | |
if (ImGui.Button("-")) | |
{ | |
_listfoo[_bloSelectedIndex] = (_listfoo[_bloSelectedIndex].name, _listfoo[_bloSelectedIndex].count - 1); | |
} | |
} | |
BorderListOptions.End(64); | |
BorderGroup.End(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment