From f084f29e6182588cf5cd0f95d096d9dd99de6889 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Sat, 22 Mar 2014 17:37:40 -0500 Subject: [PATCH] Improved input config styling a little. --- src/guis/GuiDetectDevice.cpp | 22 +++++++++++++--------- src/guis/GuiInputConfig.cpp | 8 ++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/guis/GuiDetectDevice.cpp b/src/guis/GuiDetectDevice.cpp index 53451f84b..f2b96c5eb 100644 --- a/src/guis/GuiDetectDevice.cpp +++ b/src/guis/GuiDetectDevice.cpp @@ -8,6 +8,7 @@ #include #include #include "../views/ViewController.h" +#include "../Util.h" #define HOLD_TIME 1000 @@ -30,12 +31,12 @@ GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(w } mTitle = std::make_shared(mWindow, firstRun ? "WELCOME TO EMULATIONSTATION" : "SELECT A DEVICE", - Font::get(FONT_SIZE_MEDIUM), 0x666666FF, TextComponent::ALIGN_CENTER); + Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mTitle, Vector2i(0, 0), false, true); - std::string msg = (firstRun ? "First, we need to configure your input device!\n" : ""); - msg += "Hold a button on your input device to configure it.\n" - "Press F4 to quit at any time."; + std::string msg = (firstRun ? "FIRST, WE NEED TO CONFIGURE YOUR INPUT DEVICE!\n" : ""); + msg += "HOLD A BUTTON ON YOUR DEVICE TO CONFIGURE IT.\n" + "PRESS F4 TO QUIT AT ANY TIME."; mMsg = std::make_shared(mWindow, msg, Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mMsg, Vector2i(0, 1), false, true); @@ -43,13 +44,13 @@ GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(w int numDevices = mWindow->getInputManager()->getNumJoysticks(); if(numDevices > 0) - deviceInfo << numDevices << " joystick" << (numDevices > 1 ? "s" : "") << " detected."; + deviceInfo << "(" << numDevices << " JOYSTICK" << (numDevices > 1 ? "S" : "") << " DETECTED)"; else - deviceInfo << "No joysticks detected!"; - mDeviceInfo = std::make_shared(mWindow, deviceInfo.str(), Font::get(FONT_SIZE_SMALL), 0x888888FF, TextComponent::ALIGN_CENTER); + deviceInfo << "(NO JOYSTICKS DETECTED)"; + mDeviceInfo = std::make_shared(mWindow, deviceInfo.str(), Font::get(FONT_SIZE_SMALL), 0x999999FF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mDeviceInfo, Vector2i(0, 2), false, true); - mDeviceHeld = std::make_shared(mWindow, "", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER); + mDeviceHeld = std::make_shared(mWindow, "", Font::get(FONT_SIZE_MEDIUM), 0xFFFFFFFF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mDeviceHeld, Vector2i(0, 3), false, true); setSize(Renderer::getScreenWidth() * 0.6f, Renderer::getScreenHeight() * 0.5f); @@ -76,7 +77,7 @@ bool GuiDetectDevice::input(InputConfig* config, Input input) // started holding mHoldingConfig = config; mHoldTime = HOLD_TIME; - mDeviceHeld->setText(config->getDeviceName()); + mDeviceHeld->setText(strToUpper(config->getDeviceName())); }else if(!input.value && mHoldingConfig == config) { // cancel @@ -93,6 +94,9 @@ void GuiDetectDevice::update(int deltaTime) if(mHoldingConfig) { mHoldTime -= deltaTime; + const float t = (float)mHoldTime / HOLD_TIME; + unsigned int c = (unsigned char)(t * 255); + mDeviceHeld->setColor((c << 24) | (c << 16) | (c << 8) | 0xFF); if(mHoldTime <= 0) { // picked one! diff --git a/src/guis/GuiInputConfig.cpp b/src/guis/GuiInputConfig.cpp index 694e0d8a4..d7c106913 100644 --- a/src/guis/GuiInputConfig.cpp +++ b/src/guis/GuiInputConfig.cpp @@ -9,7 +9,7 @@ static const int inputCount = 10; static const char* inputName[inputCount] = { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select", "PageUp", "PageDown"}; -static const char* inputDispName[inputCount] = { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select", "Page Up", "Page Down"}; +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" }; @@ -23,7 +23,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 5)), mTargetConfig(target) { - LOG(LogInfo) << "Configuring device " << target->getDeviceId(); + LOG(LogInfo) << "Configuring device " << target->getDeviceId() << " (" << target->getDeviceName() << ")."; if(reconfigureAll) target->clear(); @@ -37,10 +37,10 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi mTitle = std::make_shared(mWindow, "PLEASE CONFIGURE INPUT FOR", Font::get(FONT_SIZE_SMALL), 0x555555FF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mTitle, Vector2i(0, 0), false, true); - mSubtitle1 = std::make_shared(mWindow, target->getDeviceName(), Font::get(FONT_SIZE_MEDIUM), 0x555555FF, TextComponent::ALIGN_CENTER); + mSubtitle1 = std::make_shared(mWindow, strToUpper(target->getDeviceName()), Font::get(FONT_SIZE_MEDIUM), 0x555555FF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mSubtitle1, Vector2i(0, 1), false, true); - mSubtitle2 = std::make_shared(mWindow, "(HOLD ANY BUTTON TO SKIP BUT NOT YET)", Font::get(FONT_SIZE_SMALL), 0x999999FF, TextComponent::ALIGN_CENTER); + mSubtitle2 = std::make_shared(mWindow, /*"(HOLD ANY BUTTON TO SKIP)"*/ "", Font::get(FONT_SIZE_SMALL), 0x999999FF, TextComponent::ALIGN_CENTER); mGrid.setEntry(mSubtitle2, Vector2i(0, 2), false, true); mList = std::make_shared(mWindow);