UI updates

This commit is contained in:
nullifiedcat 2018-07-30 10:23:31 +03:00
parent a48d1cf88d
commit 96576bc6ca
21 changed files with 304 additions and 41 deletions

View File

@ -2,20 +2,10 @@
<Include path="color-picker.xml"/>
<Include path="window-settings.xml"/>
<Include path="player-list-row.xml"/>
<!--<Include path="player-list-window.xml"/>-->
<Include path="player-list-window.xml"/>
<Window width="content" height="content" x="400" y="400" name="All Variables">
<ScrollableList id="special-variables" x="0" y="0" width="400" height="600"/>
</Window>
<Window x="400" y="300" width="content" min-width="100" height="content" name="IQ meter">
<Text>300+</Text>
</Window>
<Window x="300" y="300" width="content" height="content" name="Main Window">
<Box width="content" height="content" padding="12 6 6 6" name="Group 1">
<List width="200">
<AutoVariable width="fill" target="aimbot.enable" label="Enable Aimbot" tooltip="Click to enable aimbot"/>
<AutoVariable width="fill" target="esp.enable" label="Enable ESP" tooltip="Click to enable ESP"/>
<AutoVariable width="fill" target="bunnyhop.enable" label="Enable Bunnyhop" tooltip="Click to enable bunnyhop"/>
</List>
</Box>
</Window>
</menu>
<Include path="nullified-ui.xml"/>
</menu>

146
data/menu/nullified-ui.xml Normal file
View File

@ -0,0 +1,146 @@
<ElementGroup>
<Window x="100" y="200" name="A" width="300" height="300">
<AutoVariable target="aimbot.enable" label="Enable Aimbot"/>
</Window>
<Window x="100" y="300" name="Main Window" width="content" height="content">
<TabContainer width="600" height="400">
<Tab name="Aimbot">
<Box padding="6 6 6 6" width="content" height="content">
<List width="150">
<AutoVariable width="fill" target="aimbot.enable" label="Enable Aimbot"/>
<AutoVariable width="fill" target="aimbot.aimkey.button" label="Aimkey"/>
<LabeledObject width="fill" label="Aimkey mode">
<Select target="aimbot.aimkey.mode">
<Option name="Disable" value="0"/>
<Option name="Pressed" value="1"/>
<Option name="Not pressed" value="2"/>
<Option name="Toggle" value="3"/>
</Select>
</LabeledObject>
<AutoVariable width="fill" target="aimbot.autoshoot" label="Autoshoot"/>
</List>
</Box>
</Tab>
<Tab name="Anti-Aim">
<List width="150">
<AutoVariable width="fill" target="antiaim.enable" label="Enable"/>
</List>
</Tab>
<Tab name="AutoHeal">
<List width="150">
<AutoVariable width="fill" target="autoheal.enable" label="Enable"/>
<AutoVariable width="fill" target="autoheal.silent" label="Silent"/>
<AutoVariable width="fill" target="autoheal.uber.enable" label="Auto Uber"/>
<AutoVariable width="fill" target="autoheal.uber.share" label="Share Uber"/>
<AutoVariable width="fill" target="autoheal.uber.health-below-ratio" label="Uber on health" min="0" max="100"/>
</List>
</Tab>
<Tab name="Visuals">
<TabContainer width="fill" height="fill">
<Tab name="ESP">
<List width="150">
<AutoVariable width="fill" target="esp.enable" label="Enable"/>
<AutoVariable width="fill" target="esp.range" label="Max Range" min="0" max="4096"/>
</List>
<List width="150" x="160">
<LabeledObject width="fill" label="Arrows">
<Select target="esp.projectile.arrows">
<Option name="Disable" value="0"/>
<Option name="Enemy only" value="1"/>
<Option name="Crit only" value="2"/>
</Select>
</LabeledObject>
<LabeledObject width="fill" label="Pipes">
<Select target="esp.projectile.pipes">
<Option name="Disable" value="0"/>
<Option name="Enemy only" value="1"/>
<Option name="Crit only" value="2"/>
</Select>
</LabeledObject>
<LabeledObject width="fill" label="Rockets">
<Select target="esp.projectile.rockets">
<Option name="Disable" value="0"/>
<Option name="Enemy only" value="1"/>
<Option name="Crit only" value="2"/>
</Select>
</LabeledObject>
<LabeledObject width="fill" label="Stickies">
<Select target="esp.projectile.stickies">
<Option name="Disable" value="0"/>
<Option name="Enemy only" value="1"/>
<Option name="Crit only" value="2"/>
</Select>
</LabeledObject>
</List>
</Tab>
<Tab name="Glow">
<List width="150">
<AutoVariable width="fill" target="glow.enable" label="Enable"/>
<AutoVariable width="fill" target="glow.blur-scale" label="Blur Scale" min="0" max="10"/>
<AutoVariable width="fill" target="glow.health" label="Health"/>
<AutoVariable width="fill" target="glow.self" label="Glow Self"/>
<AutoVariable width="fill" target="glow.self-rainbow" label="Self Rainbow"/>
<AutoVariable width="fill" target="glow.white-weapons" label="White Weapons"/>
<LabeledObject width="fill" label="Solid when">
<Select target="glow.solid-when">
<Option name="Never" value="0"/>
<Option name="Always" value="1"/>
<Option name="Not visible" value="2"/>
</Select>
</LabeledObject>
<AutoVariable width="fill" target="glow.show.players" label="Players"/>
<AutoVariable width="fill" target="glow.show.teammates" label="Teammates"/>
<AutoVariable width="fill" target="glow.show.buildings" label="Buildings"/>
<AutoVariable width="fill" target="glow.show.teammate-buildings" label="Team Buildings"/>
<AutoVariable width="fill" target="glow.show.powerups" label="Powerups"/>
<AutoVariable width="fill" target="glow.show.stickies" label="Stickies"/>
<AutoVariable width="fill" target="glow.show.ammoboxes" label="Ammo Boxes"/>
<AutoVariable width="fill" target="glow.show.medkits" label="Health Packs"/>
</List>
</Tab>
<Tab name="Chams">
<List width="150">
<AutoVariable width="fill" target="chams.enable" label="Enable"/>
<AutoVariable width="fill" target="chams.legit" label="Legit"/>
<AutoVariable width="fill" target="chams.flat" label="Flat"/>
<AutoVariable width="fill" target="chams.disco" label="Disco"/>
<AutoVariable width="fill" target="chams.health" label="Health"/>
<AutoVariable width="fill" target="chams.recursive" label="Recursive"/>
<AutoVariable width="fill" target="chams.single-pass" label="Single pass"/>
<AutoVariable width="fill" target="chams.health" label="Health"/>
<AutoVariable width="fill" target="chams.self" label="Chams Self"/>
<AutoVariable width="fill" target="chams.self-rainbow" label="Self Rainbow"/>
<AutoVariable width="fill" target="chams.white-weapons" label="White Weapons"/>
<LabeledObject width="fill" label="Solid when">
<Select target="glow.solid-when">
<Option name="Never" value="0"/>
<Option name="Always" value="1"/>
<Option name="Not visible" value="2"/>
</Select>
</LabeledObject>
<AutoVariable width="fill" target="chams.show.players" label="Players"/>
<AutoVariable width="fill" target="chams.show.teammates" label="Teammates"/>
<AutoVariable width="fill" target="chams.show.buildings" label="Buildings"/>
<AutoVariable width="fill" target="chams.show.teammate-buildings" label="Team Buildings"/>
<AutoVariable width="fill" target="chams.show.powerups" label="Powerups"/>
<AutoVariable width="fill" target="chams.show.stickies" label="Stickies"/>
<AutoVariable width="fill" target="chams.show.ammoboxes" label="Ammo Boxes"/>
<AutoVariable width="fill" target="chams.show.medkits" label="Health Packs"/>
</List>
</Tab>
</TabContainer>
</Tab>
<Tab name="WIP">
<List width="150">
</List>
</Tab>
</TabContainer>
</Window>
<Window x="200" y="300" name="C" width="400" height="300">
</Window>
</ElementGroup>

2
external/libglez vendored

@ -1 +1 @@
Subproject commit 6edbc9e4a2025cdae22ff134e0be57fb8bd1e232
Subproject commit 1e03d3843fec67f313b285ec987ced90a17aba39

View File

@ -110,6 +110,10 @@ public:
{
std::string str(target);
opt = settings::Manager::instance().lookup(str);
if (opt)
{
zerokernel::special::SettingsManagerList::markVariable(target);
}
}
if constexpr (std::is_same<int, T>::value)

View File

@ -5,6 +5,7 @@
#pragma once
#include <menu/object/input/TextInput.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
namespace zerokernel
{
@ -67,6 +68,10 @@ public:
{
std::string str(target);
opt = settings::Manager::instance().lookup(str);
if (opt)
{
zerokernel::special::SettingsManagerList::markVariable(target);
}
}
if constexpr (std::is_same<int, T>::value)

View File

@ -20,6 +20,7 @@ public:
{
public:
settings::IVariable *variable{ nullptr };
std::string full_name{};
std::vector<std::pair<std::string, TreeNode>> nodes{};
TreeNode& operator[](const std::string& path);
};
@ -34,7 +35,17 @@ public:
void addCollapsible(std::string name, size_t depth);
void addVariable(std::string name, size_t depth, settings::IVariable *variable);
void addVariable(std::string name, size_t depth, settings::IVariable *variable, bool registered);
//
static void markVariable(std::string name);
static bool isVariableMarked(std::string name);
static void resetMarks();
//
TreeNode root{};
Container& list;

View File

@ -40,6 +40,8 @@ public:
void setDepth(int depth) override;
void markPresentInUi();
std::unique_ptr<BaseMenuObject> createCheckbox(settings::IVariable *variable);
std::unique_ptr<BaseMenuObject> createSpinner(settings::IVariable *variable);

View File

@ -39,6 +39,8 @@ public:
bool isHidden() override;
bool isFocused();
// Functions
void moveObjects();

View File

@ -18,6 +18,7 @@
#include <iostream>
#include <menu/menu/Menu.hpp>
#include <config.h>
#include <core/logging.hpp>
static void recursiveXmlResolveIncludes(const std::string& directory, tinyxml2::XMLElement *element)
{
@ -40,14 +41,29 @@ static void recursiveXmlResolveIncludes(const std::string& directory, tinyxml2::
{
printf("File loaded\n");
auto content = document.RootElement()->DeepClone(c->GetDocument());
auto next = content;
element->InsertAfterChild(c, content);
element->DeleteChild(c);
c = content->ToElement();
continue;
element->InsertAfterChild(c, content);
element->DeleteChild(c);
c = content->ToElement();
continue;
}
}
}
if (!strcmp("ElementGroup", c->Name()))
{
auto it = c->FirstChild();
auto prev = c;
while (it)
{
auto next = it->NextSibling();
element->InsertAfterChild(prev, it);
printf("GroupedElement: %s\n", it->ToElement()->Name());
it = next;
}
auto n = c->NextSiblingElement();
element->DeleteChild(c);
c = n;
continue;
}
recursiveXmlResolveIncludes(directory, c);
c = c->NextSiblingElement();
}
@ -169,6 +185,7 @@ void Menu::destroy()
void Menu::reset()
{
special::SettingsManagerList::resetMarks();
wm = std::make_unique<WindowManager>();
wm->init();
ready = true;

View File

@ -73,7 +73,7 @@ ObjectFactory::createObjectFromXml(const tinyxml2::XMLElement *element)
if (EXIT_SUCCESS == strcmp("int", type))
result = std::make_unique<Slider<int>>();
else if (EXIT_SUCCESS == strcmp("float", type))
result = std::make_unique<Slider<int>>();
result = std::make_unique<Slider<float>>();
}
}
else if (type == "StringInput")
@ -104,6 +104,8 @@ ObjectFactory::createAutoVariable(const tinyxml2::XMLElement *element)
return nullptr;
}
special::SettingsManagerList::markVariable(name);
std::unique_ptr<BaseMenuObject> control{ nullptr };
switch (var->getType())
@ -134,7 +136,11 @@ ObjectFactory::createAutoVariable(const tinyxml2::XMLElement *element)
if (!element->QueryIntAttribute("min", &min) && !element->QueryIntAttribute("max", &max))
{
// Make a slider
control = std::make_unique<Slider<int>>(*obj);
auto slider = std::make_unique<Slider<int>>(*obj);
slider->min = min;
slider->max = max;
element->QueryIntAttribute("step", &slider->step);
control = std::move(slider);
}
else
{
@ -156,7 +162,11 @@ ObjectFactory::createAutoVariable(const tinyxml2::XMLElement *element)
if (!element->QueryFloatAttribute("min", &min) && !element->QueryFloatAttribute("max", &max))
{
// Make a slider
control = std::make_unique<Slider<float>>(*obj);
auto slider = std::make_unique<Slider<float>>(*obj);
slider->min = min;
slider->max = max;
element->QueryFloatAttribute("step", &slider->step);
control = std::move(slider);
}
else
{

View File

@ -57,7 +57,16 @@ void zerokernel::ScrollableList::scrollUp()
{
if (start_index == 0)
return;
--start_index;
auto delta = 1;
if (SDL_GetModState() & KMOD_SHIFT)
delta = 4;
if (delta > start_index)
delta = start_index;
start_index -= delta;
updateScroll();
}
@ -66,7 +75,14 @@ void zerokernel::ScrollableList::scrollDown()
// FIXME
/*if (end_index >= objects.size() - 1)
return;*/
++start_index;
auto delta = 1;
if (SDL_GetModState() & KMOD_SHIFT)
delta = 4;
start_index += delta;
updateScroll();
}

View File

@ -3,6 +3,7 @@
*/
#include <menu/object/input/Checkbox.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
static settings::RVariable<int> checkbox_size{ "zk.style.checkbox.size", "12" };
static settings::RVariable<glez::rgba> color_border{ "zk.style.checkbox.color.border", "079797" };
@ -61,6 +62,10 @@ void zerokernel::Checkbox::loadFromXml(const tinyxml2::XMLElement *data)
{
std::string str(target);
auto opt = settings::Manager::instance().lookup(str);
option = dynamic_cast<settings::Variable<bool> *>(opt);
if (opt)
{
option = dynamic_cast<settings::Variable<bool> *>(opt);
zerokernel::special::SettingsManagerList::markVariable(target);
}
}
}

View File

@ -5,6 +5,7 @@
#include <menu/object/input/ColorSelector.hpp>
#include <menu/Menu.hpp>
#include <menu/object/container/ModalColorSelect.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
static settings::RVariable<int> default_width{ "zk.style.input.color.width", "36" };
static settings::RVariable<int> default_height{ "zk.style.input.color.height", "14" };
@ -59,7 +60,11 @@ void ColorSelector::loadFromXml(const tinyxml2::XMLElement *data)
{
std::string str(target);
auto opt = settings::Manager::instance().lookup(str);
variable = dynamic_cast<settings::Variable<glez::rgba> *>(opt);
if (opt)
{
variable = dynamic_cast<settings::Variable<glez::rgba> *>(opt);
zerokernel::special::SettingsManagerList::markVariable(target);
}
}
}

View File

@ -2,6 +2,7 @@
Created on 27.07.18.
*/
#include <menu/object/input/InputKey.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
static settings::RVariable<int> default_width{ "zk.style.input.key.width", "60" };
static settings::RVariable<int> default_height{ "zk.style.input.key.height", "14" };
@ -102,7 +103,11 @@ void zerokernel::InputKey::loadFromXml(const tinyxml2::XMLElement *data)
{
std::string str(target);
auto opt = settings::Manager::instance().lookup(str);
key = dynamic_cast<settings::Variable<settings::Key> *>(opt);
if (opt)
{
key = dynamic_cast<settings::Variable<settings::Key> *>(opt);
zerokernel::special::SettingsManagerList::markVariable(target);
}
}
}

View File

@ -5,6 +5,7 @@
#include <menu/object/input/Select.hpp>
#include <menu/Message.hpp>
#include <menu/Debug.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
static settings::RVariable<glez::rgba> color_border{ "zk.style.input.select.border", "079797" };
@ -99,7 +100,10 @@ void zerokernel::Select::loadFromXml(const tinyxml2::XMLElement *data)
printf("WARNING: Creating Select element: could not find settings '%s'\n", target);
}
else
{
zerokernel::special::SettingsManagerList::markVariable(target);
variable = var;
}
}
auto child = data->FirstChildElement(nullptr);

View File

@ -3,6 +3,7 @@
*/
#include <menu/object/input/StringInput.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
static settings::RVariable<int> default_width{ "zk.style.input.string.width", "60" };
static settings::RVariable<int> default_height{ "zk.style.input.string.height", "14" };
@ -44,7 +45,10 @@ void zerokernel::StringInput::loadFromXml(const tinyxml2::XMLElement *data)
const char *target{ nullptr };
if (tinyxml2::XML_SUCCESS == data->QueryStringAttribute("target", &target))
{
std::string str(target);
option = settings::Manager::instance().lookup(str);
option = settings::Manager::instance().lookup(target);
if (option)
{
zerokernel::special::SettingsManagerList::markVariable(target);
}
}
}

View File

@ -7,6 +7,8 @@
#include <sstream>
#include <menu/special/VariableListEntry.hpp>
#include <menu/special/TreeListCollapsible.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
zerokernel::special::SettingsManagerList::SettingsManagerList(
zerokernel::Container &list): list(list)
@ -35,6 +37,7 @@ void zerokernel::special::SettingsManagerList::construct()
{
node = &((*node)[n]);
}
node->full_name = v.first;
node->variable = v.second;
}
@ -50,8 +53,7 @@ void zerokernel::special::SettingsManagerList::recursiveWork(zerokernel::special
{
if (n.second.variable)
{
addVariable(n.first, depth, n.second.variable);
printf("depth %u: settings %s\n", depth, n.first.c_str());
addVariable(n.first, depth, n.second.variable, isVariableMarked(n.second.full_name));
}
if (!n.second.nodes.empty())
@ -99,12 +101,14 @@ zerokernel::special::SettingsManagerList::TreeNode::operator[](
}
void zerokernel::special::SettingsManagerList::addVariable(std::string name, size_t depth,
settings::IVariable *variable)
settings::IVariable *variable, bool registered)
{
auto entry = std::make_unique<VariableListEntry>();
entry->setText(name);
entry->setVariable(variable);
entry->setDepth(depth);
if (registered)
entry->markPresentInUi();
list.addObject(std::move(entry));
}
@ -114,4 +118,22 @@ void zerokernel::special::SettingsManagerList::addCollapsible(std::string name,
entry->setText(name);
entry->setDepth(depth);
list.addObject(std::move(entry));
}
}
static std::unordered_map<std::string, bool> marks{};
void zerokernel::special::SettingsManagerList::markVariable(std::string name)
{
marks[name] = true;
}
void zerokernel::special::SettingsManagerList::resetMarks()
{
marks.clear();
}
bool
zerokernel::special::SettingsManagerList::isVariableMarked(std::string name)
{
return marks.find(name) != marks.end();
}

View File

@ -5,6 +5,11 @@
#include <menu/object/input/ColorSelector.hpp>
#include <menu/object/input/InputKey.hpp>
#include <menu/object/input/Spinner.hpp>
#include <menu/menu/special/SettingsManagerList.hpp>
#include <menu/menu/special/VariableListEntry.hpp>
static settings::RVariable<glez::rgba> marked_color{ "zk.color.variable-list.color.registered", "ffff00" };
/*
Created on 26.07.18.
@ -198,3 +203,8 @@ void zerokernel::VariableListEntry::setDepth(int depth)
label.move(depth * 5 + 4, 0);
}
void zerokernel::VariableListEntry::markPresentInUi()
{
label.setColorText(&*marked_color);
}

View File

@ -21,7 +21,7 @@ void zerokernel::Task::render()
renderBackground(*color_hovered);
renderBorder(*color_border);
if (window.focused)
if (window.isFocused())
{
text.setColorText(&*color_focused);
}
@ -44,7 +44,7 @@ bool zerokernel::Task::onLeftMouseClick()
}
else
{
if (window.focused)
if (window.isFocused())
window.wmCloseWindow();
else
window.requestFocus();

View File

@ -43,7 +43,7 @@ void WMWindow::render()
if (isHidden())
return;
if (focused)
if (isFocused())
renderBackground(*color_background);
else
renderBackground(*color_background_inactive);
@ -177,7 +177,12 @@ void WMWindow::reorderElements()
bool WMWindow::isHidden()
{
return BaseMenuObject::isHidden() || Menu::instance->isInGame();
return BaseMenuObject::isHidden() || (Menu::instance->isInGame() && !should_render_in_game);
}
bool WMWindow::isFocused()
{
return focused && !Menu::instance->isInGame();
}
}

View File

@ -54,9 +54,9 @@ bool zerokernel::WindowHeader::handleSdlEvent(SDL_Event *event)
void zerokernel::WindowHeader::render()
{
renderBackground(window.focused ? *color_background_focused : *color_background);
renderBackground(window.isFocused() ? *color_background_focused : *color_background);
//glez::draw::line(bb.getBorderBox().left(), bb.getBorderBox().bottom() - 1, bb.getBorderBox().width, 0, window.focused ? *color_border_focused : *color_border, 1);
renderBorder(window.focused ? *color_border_focused : *color_border);
renderBorder(window.isFocused() ? *color_border_focused : *color_border);
Container::render();
}