Skip to content

Commit

Permalink
Updates artwork for input config, adds compass directions.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzulla committed Jul 2, 2018
1 parent 880064c commit 891c552
Show file tree
Hide file tree
Showing 40 changed files with 318 additions and 779 deletions.
166 changes: 41 additions & 125 deletions es-core/src/guis/GuiInputConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,126 +7,42 @@
#include "Log.h"
#include "Window.h"

// static const int inputCount = 10;
// static const char* inputName[inputCount] = { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select", "PageUp", "PageDown" };
// static const bool inputSkippable[inputCount] = { false, false, false, false, false, false, false, false, true, true };
// static const char* inputDispName[inputCount] = { "UP", "DOWN", "LEFT", "RIGHT", "A", "B", "START", "SELECT", "PAGE UP", "PAGE DOWN" };
// static const char* inputIcon[inputCount] = { ":/help/dpad_up.svg", ":/help/dpad_down.svg", ":/help/dpad_left.svg", ":/help/dpad_right.svg",
// ":/help/button_a.svg", ":/help/button_b.svg", ":/help/button_start.svg", ":/help/button_select.svg",
// ":/help/button_l.svg", ":/help/button_r.svg" };

static const int inputCount = 25;
static const char* inputName[inputCount] =
{
"Up",
"Down",
"Left",
"Right",
"Start",
"Select",
"A",
"B",
"X",
"Y",
"LeftShoulder",
"RightShoulder",
"LeftTrigger",
"RightTrigger",
"LeftThumb",
"RightThumb",
"LeftAnalogUp",
"LeftAnalogDown",
"LeftAnalogLeft",
"LeftAnalogRight",
"RightAnalogUp",
"RightAnalogDown",
"RightAnalogLeft",
"RightAnalogRight",
"HotKeyEnable"
};
static const bool inputSkippable[inputCount] =
struct InputConfigStructure
{
false,
false,
false,
false,
true,
true,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true
const char* name;
const bool skippable;
const char* dispName;
const char* icon;
};
static const char* inputDispName[inputCount] =
{
"D-PAD UP",
"D-PAD DOWN",
"D-PAD LEFT",
"D-PAD RIGHT",
"START",
"SELECT",
"A",
"B",
"X",
"Y",
"LEFT SHOULDER",
"RIGHT SHOULDER",
"LEFT TRIGGER",
"RIGHT TRIGGER",
"LEFT THUMB",
"RIGHT THUMB",
"LEFT ANALOG UP",
"LEFT ANALOG DOWN",
"LEFT ANALOG LEFT",
"LEFT ANALOG RIGHT",
"RIGHT ANALOG UP",
"RIGHT ANALOG DOWN",
"RIGHT ANALOG LEFT",
"RIGHT ANALOG RIGHT",
"HOTKEY ENABLE"
};
static const char* inputIcon[inputCount] =

static const int inputCount = 25;
static const InputConfigStructure GUI_INPUT_CONFIG_LIST[inputCount] =
{
":/help/dpad_up.svg",
":/help/dpad_down.svg",
":/help/dpad_left.svg",
":/help/dpad_right.svg",
":/help/button_start.svg",
":/help/button_select.svg",
":/help/button_a.svg",
":/help/button_b.svg",
":/help/button_x.svg",
":/help/button_y.svg",
":/help/button_l.svg",
":/help/button_r.svg",
":/help/button_l.svg",
":/help/button_r.svg",
":/help/analog_thumb.svg",
":/help/analog_thumb.svg",
":/help/analog_up.svg",
":/help/analog_down.svg",
":/help/analog_left.svg",
":/help/analog_right.svg",
":/help/analog_up.svg",
":/help/analog_down.svg",
":/help/analog_left.svg",
":/help/analog_right.svg",
":/help/button_hotkey.svg"
{ "Up", false, "D-PAD UP", ":/help/dpad_up.svg" },
{ "Down", false, "D-PAD DOWN", ":/help/dpad_down.svg" },
{ "Left", false, "D-PAD LEFT", ":/help/dpad_left.svg" },
{ "Right", false, "D-PAD RIGHT", ":/help/dpad_right.svg" },
{ "Start", true, "START", ":/help/button_start.svg" },
{ "Select", true, "SELECT", ":/help/button_select.svg" },
{ "A", false, "BUTTON A / EAST", ":/help/buttons_east.svg" },
{ "B", true, "BUTTON B / SOUTH", ":/help/buttons_south.svg" },
{ "X", true, "BUTTON X / NORTH", ":/help/buttons_north.svg" },
{ "Y", true, "BUTTON Y / WEST", ":/help/buttons_west.svg" },
{ "LeftShoulder", true, "LEFT SHOULDER", ":/help/button_l.svg" },
{ "RightShoulder", true, "RIGHT SHOULDER", ":/help/button_r.svg" },
{ "LeftTrigger", true, "LEFT TRIGGER", ":/help/button_lt.svg" },
{ "RightTrigger", true, "RIGHT TRIGGER", ":/help/button_rt.svg" },
{ "LeftThumb", true, "LEFT THUMB", ":/help/analog_thumb.svg" },
{ "RightThumb", true, "RIGHT THUMB", ":/help/analog_thumb.svg" },
{ "LeftAnalogUp", true, "LEFT ANALOG UP", ":/help/analog_up.svg" },
{ "LeftAnalogDown", true, "LEFT ANALOG DOWN", ":/help/analog_down.svg" },
{ "LeftAnalogLeft", true, "LEFT ANALOG LEFT", ":/help/analog_left.svg" },
{ "LeftAnalogRight", true, "LEFT ANALOG RIGHT", ":/help/analog_right.svg" },
{ "RightAnalogUp", true, "RIGHT ANALOG UP", ":/help/analog_up.svg" },
{ "RightAnalogDown", true, "RIGHT ANALOG DOWN", ":/help/analog_down.svg" },
{ "RightAnalogLeft", true, "RIGHT ANALOG LEFT", ":/help/analog_left.svg" },
{ "RightAnalogRight", true, "RIGHT ANALOG RIGHT", ":/help/analog_right.svg" },
{ "HotKeyEnable", true, "HOTKEY ENABLE", ":/help/button_hotkey.svg" }
};

//MasterVolUp and MasterVolDown are also hooked up, but do not appear on this screen.
Expand Down Expand Up @@ -178,7 +94,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi

// icon
auto icon = std::make_shared<ImageComponent>(mWindow);
icon->setImage(inputIcon[i]);
icon->setImage(GUI_INPUT_CONFIG_LIST[i].icon);
icon->setColorShift(0x777777FF);
icon->setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 1.25f);
row.addElement(icon, false);
Expand All @@ -188,7 +104,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi
spacer->setSize(16, 0);
row.addElement(spacer, false);

auto text = std::make_shared<TextComponent>(mWindow, inputDispName[i], Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto text = std::make_shared<TextComponent>(mWindow, GUI_INPUT_CONFIG_LIST[i].dispName, Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
row.addElement(text, true);

auto mapping = std::make_shared<TextComponent>(mWindow, "-NOT DEFINED-", Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT), 0x999999FF, ALIGN_RIGHT);
Expand Down Expand Up @@ -251,7 +167,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi

// only show "HOLD TO SKIP" if this input is skippable
mList->setCursorChangedCallback([this](CursorState /*state*/) {
bool skippable = inputSkippable[mList->getCursorId()];
bool skippable = GUI_INPUT_CONFIG_LIST[mList->getCursorId()].skippable;
mSubtitle2->setOpacity(skippable * 255);
});

Expand Down Expand Up @@ -317,7 +233,7 @@ void GuiInputConfig::onSizeChanged()

void GuiInputConfig::update(int deltaTime)
{
if(mConfiguringRow && mHoldingInput && inputSkippable[mHeldInputId])
if(mConfiguringRow && mHoldingInput && GUI_INPUT_CONFIG_LIST[mHeldInputId].skippable)
{
int prevSec = mHeldTime / 1000;
mHeldTime += deltaTime;
Expand Down Expand Up @@ -395,7 +311,7 @@ bool GuiInputConfig::assign(Input input, int inputId)

// if this input is mapped to something other than "nothing" or the current row, error
// (if it's the same as what it was before, allow it)
if(mTargetConfig->getMappedTo(input).size() > 0 && !mTargetConfig->isMappedTo(inputName[inputId], input) && strcmp(inputName[inputId], "HotKeyEnable") != 0)
if(mTargetConfig->getMappedTo(input).size() > 0 && !mTargetConfig->isMappedTo(GUI_INPUT_CONFIG_LIST[inputId].name, input) && strcmp(GUI_INPUT_CONFIG_LIST[inputId].name, "HotKeyEnable") != 0)
{
error(mMappings.at(inputId), "Already mapped!");
return false;
Expand All @@ -404,14 +320,14 @@ bool GuiInputConfig::assign(Input input, int inputId)
setAssignedTo(mMappings.at(inputId), input);

input.configured = true;
mTargetConfig->mapInput(inputName[inputId], input);
mTargetConfig->mapInput(GUI_INPUT_CONFIG_LIST[inputId].name, input);

LOG(LogInfo) << " Mapping [" << input.string() << "] -> " << inputName[inputId];
LOG(LogInfo) << " Mapping [" << input.string() << "] -> " << GUI_INPUT_CONFIG_LIST[inputId].name;

return true;
}

void GuiInputConfig::clearAssignment(int inputId)
{
mTargetConfig->unmapInput(inputName[inputId]);
mTargetConfig->unmapInput(GUI_INPUT_CONFIG_LIST[inputId].name);
}
20 changes: 7 additions & 13 deletions resources/help/analog_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 7 additions & 15 deletions resources/help/analog_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 7 additions & 13 deletions resources/help/analog_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions resources/help/analog_stick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 891c552

Please sign in to comment.