Small UI tweaks.

Replaced arrow text with an image.
Better frame.png (thanks Nils!).
This commit is contained in:
Aloshi 2014-03-04 16:48:33 -06:00
parent e97dd8ff36
commit 8928ce49ec
14 changed files with 367 additions and 1763 deletions

View file

@ -307,6 +307,7 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_up_down_png.cpp ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_up_down_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_left_right_png.cpp ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_left_right_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp ${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/sq_bracket_png.cpp
) )
SOURCE_GROUP(resources FILES ResourceUtil.cpp) SOURCE_GROUP(resources FILES ResourceUtil.cpp)

View file

@ -2,7 +2,7 @@
#include "Resources.h" #include "Resources.h"
const size_t res2hNrOfFiles = 16; const size_t res2hNrOfFiles = 17;
const Res2hEntry res2hFiles[res2hNrOfFiles] = { const Res2hEntry res2hFiles[res2hNrOfFiles] = {
{":/button.png", button_png_size, button_png_data}, {":/button.png", button_png_size, button_png_data},
{":/ES_logo_16.png", ES_logo_16_png_size, ES_logo_16_png_data}, {":/ES_logo_16.png", ES_logo_16_png_size, ES_logo_16_png_data},
@ -10,6 +10,7 @@ const Res2hEntry res2hFiles[res2hNrOfFiles] = {
{":/frame.png", frame_png_size, frame_png_data}, {":/frame.png", frame_png_size, frame_png_data},
{":/opensans_hebrew_condensed_regular.ttf", opensans_hebrew_condensed_regular_ttf_size, opensans_hebrew_condensed_regular_ttf_data}, {":/opensans_hebrew_condensed_regular.ttf", opensans_hebrew_condensed_regular_ttf_size, opensans_hebrew_condensed_regular_ttf_data},
{":/scroll_gradient.png", scroll_gradient_png_size, scroll_gradient_png_data}, {":/scroll_gradient.png", scroll_gradient_png_size, scroll_gradient_png_data},
{":/sq_bracket.png", sq_bracket_png_size, sq_bracket_png_data},
{":/star_filled.png", star_filled_png_size, star_filled_png_data}, {":/star_filled.png", star_filled_png_size, star_filled_png_data},
{":/star_unfilled.png", star_unfilled_png_size, star_unfilled_png_data}, {":/star_unfilled.png", star_unfilled_png_size, star_unfilled_png_data},
{":/textbox.png", textbox_png_size, textbox_png_data}, {":/textbox.png", textbox_png_size, textbox_png_data},
@ -29,16 +30,17 @@ res2hMapType::value_type mapTemp[] = {
std::make_pair(":/frame.png", res2hFiles[3]), std::make_pair(":/frame.png", res2hFiles[3]),
std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[4]), std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[4]),
std::make_pair(":/scroll_gradient.png", res2hFiles[5]), std::make_pair(":/scroll_gradient.png", res2hFiles[5]),
std::make_pair(":/star_filled.png", res2hFiles[6]), std::make_pair(":/sq_bracket.png", res2hFiles[6]),
std::make_pair(":/star_unfilled.png", res2hFiles[7]), std::make_pair(":/star_filled.png", res2hFiles[7]),
std::make_pair(":/textbox.png", res2hFiles[8]), std::make_pair(":/star_unfilled.png", res2hFiles[8]),
std::make_pair(":/textbox_glow.png", res2hFiles[9]), std::make_pair(":/textbox.png", res2hFiles[9]),
std::make_pair(":/help/a.png", res2hFiles[10]), std::make_pair(":/textbox_glow.png", res2hFiles[10]),
std::make_pair(":/help/b.png", res2hFiles[11]), std::make_pair(":/help/a.png", res2hFiles[11]),
std::make_pair(":/help/dpad.png", res2hFiles[12]), std::make_pair(":/help/b.png", res2hFiles[12]),
std::make_pair(":/help/left_right.png", res2hFiles[13]), std::make_pair(":/help/dpad.png", res2hFiles[13]),
std::make_pair(":/help/menu.png", res2hFiles[14]), std::make_pair(":/help/left_right.png", res2hFiles[14]),
std::make_pair(":/help/up_down.png", res2hFiles[15]) std::make_pair(":/help/menu.png", res2hFiles[15]),
std::make_pair(":/help/up_down.png", res2hFiles[16])
}; };
res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]); res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]);

View file

@ -23,6 +23,9 @@ extern const unsigned char opensans_hebrew_condensed_regular_ttf_data[];
extern const size_t scroll_gradient_png_size; extern const size_t scroll_gradient_png_size;
extern const unsigned char scroll_gradient_png_data[]; extern const unsigned char scroll_gradient_png_data[];
extern const size_t sq_bracket_png_size;
extern const unsigned char sq_bracket_png_data[];
extern const size_t star_filled_png_size; extern const size_t star_filled_png_size;
extern const unsigned char star_filled_png_data[]; extern const unsigned char star_filled_png_data[];

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,136 @@
//this file was auto-generated from "sq_bracket.png" by res2h
#include "../Resources.h"
const size_t sq_bracket_png_size = 1286;
const unsigned char sq_bracket_png_data[1286] = {
0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,
0x00,0x0d,0x49,0x48,0x44,0x52,0x00,0x00,0x00,0x0d,
0x00,0x00,0x00,0x16,0x08,0x06,0x00,0x00,0x00,0x1b,
0xfa,0x16,0x24,0x00,0x00,0x00,0x19,0x74,0x45,0x58,
0x74,0x53,0x6f,0x66,0x74,0x77,0x61,0x72,0x65,0x00,
0x41,0x64,0x6f,0x62,0x65,0x20,0x49,0x6d,0x61,0x67,
0x65,0x52,0x65,0x61,0x64,0x79,0x71,0xc9,0x65,0x3c,
0x00,0x00,0x03,0x66,0x69,0x54,0x58,0x74,0x58,0x4d,
0x4c,0x3a,0x63,0x6f,0x6d,0x2e,0x61,0x64,0x6f,0x62,
0x65,0x2e,0x78,0x6d,0x70,0x00,0x00,0x00,0x00,0x00,
0x3c,0x3f,0x78,0x70,0x61,0x63,0x6b,0x65,0x74,0x20,
0x62,0x65,0x67,0x69,0x6e,0x3d,0x22,0xef,0xbb,0xbf,
0x22,0x20,0x69,0x64,0x3d,0x22,0x57,0x35,0x4d,0x30,
0x4d,0x70,0x43,0x65,0x68,0x69,0x48,0x7a,0x72,0x65,
0x53,0x7a,0x4e,0x54,0x63,0x7a,0x6b,0x63,0x39,0x64,
0x22,0x3f,0x3e,0x20,0x3c,0x78,0x3a,0x78,0x6d,0x70,
0x6d,0x65,0x74,0x61,0x20,0x78,0x6d,0x6c,0x6e,0x73,
0x3a,0x78,0x3d,0x22,0x61,0x64,0x6f,0x62,0x65,0x3a,
0x6e,0x73,0x3a,0x6d,0x65,0x74,0x61,0x2f,0x22,0x20,
0x78,0x3a,0x78,0x6d,0x70,0x74,0x6b,0x3d,0x22,0x41,
0x64,0x6f,0x62,0x65,0x20,0x58,0x4d,0x50,0x20,0x43,
0x6f,0x72,0x65,0x20,0x35,0x2e,0x33,0x2d,0x63,0x30,
0x31,0x31,0x20,0x36,0x36,0x2e,0x31,0x34,0x35,0x36,
0x36,0x31,0x2c,0x20,0x32,0x30,0x31,0x32,0x2f,0x30,
0x32,0x2f,0x30,0x36,0x2d,0x31,0x34,0x3a,0x35,0x36,
0x3a,0x32,0x37,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x22,0x3e,0x20,0x3c,0x72,0x64,0x66,0x3a,0x52,
0x44,0x46,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x72,
0x64,0x66,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,
0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e,0x6f,0x72,
0x67,0x2f,0x31,0x39,0x39,0x39,0x2f,0x30,0x32,0x2f,
0x32,0x32,0x2d,0x72,0x64,0x66,0x2d,0x73,0x79,0x6e,
0x74,0x61,0x78,0x2d,0x6e,0x73,0x23,0x22,0x3e,0x20,
0x3c,0x72,0x64,0x66,0x3a,0x44,0x65,0x73,0x63,0x72,
0x69,0x70,0x74,0x69,0x6f,0x6e,0x20,0x72,0x64,0x66,
0x3a,0x61,0x62,0x6f,0x75,0x74,0x3d,0x22,0x22,0x20,
0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x78,0x6d,0x70,0x4d,
0x4d,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,
0x6e,0x73,0x2e,0x61,0x64,0x6f,0x62,0x65,0x2e,0x63,
0x6f,0x6d,0x2f,0x78,0x61,0x70,0x2f,0x31,0x2e,0x30,
0x2f,0x6d,0x6d,0x2f,0x22,0x20,0x78,0x6d,0x6c,0x6e,
0x73,0x3a,0x73,0x74,0x52,0x65,0x66,0x3d,0x22,0x68,
0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6e,0x73,0x2e,0x61,
0x64,0x6f,0x62,0x65,0x2e,0x63,0x6f,0x6d,0x2f,0x78,
0x61,0x70,0x2f,0x31,0x2e,0x30,0x2f,0x73,0x54,0x79,
0x70,0x65,0x2f,0x52,0x65,0x73,0x6f,0x75,0x72,0x63,
0x65,0x52,0x65,0x66,0x23,0x22,0x20,0x78,0x6d,0x6c,
0x6e,0x73,0x3a,0x78,0x6d,0x70,0x3d,0x22,0x68,0x74,
0x74,0x70,0x3a,0x2f,0x2f,0x6e,0x73,0x2e,0x61,0x64,
0x6f,0x62,0x65,0x2e,0x63,0x6f,0x6d,0x2f,0x78,0x61,
0x70,0x2f,0x31,0x2e,0x30,0x2f,0x22,0x20,0x78,0x6d,
0x70,0x4d,0x4d,0x3a,0x4f,0x72,0x69,0x67,0x69,0x6e,
0x61,0x6c,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,
0x49,0x44,0x3d,0x22,0x78,0x6d,0x70,0x2e,0x64,0x69,
0x64,0x3a,0x43,0x46,0x31,0x35,0x46,0x36,0x32,0x43,
0x43,0x35,0x41,0x33,0x45,0x33,0x31,0x31,0x39,0x41,
0x37,0x44,0x44,0x30,0x32,0x30,0x39,0x34,0x44,0x35,
0x31,0x30,0x45,0x31,0x22,0x20,0x78,0x6d,0x70,0x4d,
0x4d,0x3a,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,
0x49,0x44,0x3d,0x22,0x78,0x6d,0x70,0x2e,0x64,0x69,
0x64,0x3a,0x32,0x34,0x42,0x43,0x42,0x38,0x35,0x44,
0x41,0x33,0x44,0x44,0x31,0x31,0x45,0x33,0x41,0x41,
0x44,0x41,0x42,0x39,0x42,0x30,0x39,0x34,0x38,0x33,
0x38,0x30,0x46,0x31,0x22,0x20,0x78,0x6d,0x70,0x4d,
0x4d,0x3a,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,
0x49,0x44,0x3d,0x22,0x78,0x6d,0x70,0x2e,0x69,0x69,
0x64,0x3a,0x32,0x34,0x42,0x43,0x42,0x38,0x35,0x43,
0x41,0x33,0x44,0x44,0x31,0x31,0x45,0x33,0x41,0x41,
0x44,0x41,0x42,0x39,0x42,0x30,0x39,0x34,0x38,0x33,
0x38,0x30,0x46,0x31,0x22,0x20,0x78,0x6d,0x70,0x3a,
0x43,0x72,0x65,0x61,0x74,0x6f,0x72,0x54,0x6f,0x6f,
0x6c,0x3d,0x22,0x41,0x64,0x6f,0x62,0x65,0x20,0x50,
0x68,0x6f,0x74,0x6f,0x73,0x68,0x6f,0x70,0x20,0x43,
0x53,0x36,0x20,0x28,0x57,0x69,0x6e,0x64,0x6f,0x77,
0x73,0x29,0x22,0x3e,0x20,0x3c,0x78,0x6d,0x70,0x4d,
0x4d,0x3a,0x44,0x65,0x72,0x69,0x76,0x65,0x64,0x46,
0x72,0x6f,0x6d,0x20,0x73,0x74,0x52,0x65,0x66,0x3a,
0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,
0x3d,0x22,0x78,0x6d,0x70,0x2e,0x69,0x69,0x64,0x3a,
0x43,0x46,0x31,0x35,0x46,0x36,0x32,0x43,0x43,0x35,
0x41,0x33,0x45,0x33,0x31,0x31,0x39,0x41,0x37,0x44,
0x44,0x30,0x32,0x30,0x39,0x34,0x44,0x35,0x31,0x30,
0x45,0x31,0x22,0x20,0x73,0x74,0x52,0x65,0x66,0x3a,
0x64,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x49,0x44,
0x3d,0x22,0x78,0x6d,0x70,0x2e,0x64,0x69,0x64,0x3a,
0x43,0x46,0x31,0x35,0x46,0x36,0x32,0x43,0x43,0x35,
0x41,0x33,0x45,0x33,0x31,0x31,0x39,0x41,0x37,0x44,
0x44,0x30,0x32,0x30,0x39,0x34,0x44,0x35,0x31,0x30,
0x45,0x31,0x22,0x2f,0x3e,0x20,0x3c,0x2f,0x72,0x64,
0x66,0x3a,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,
0x69,0x6f,0x6e,0x3e,0x20,0x3c,0x2f,0x72,0x64,0x66,
0x3a,0x52,0x44,0x46,0x3e,0x20,0x3c,0x2f,0x78,0x3a,
0x78,0x6d,0x70,0x6d,0x65,0x74,0x61,0x3e,0x20,0x3c,
0x3f,0x78,0x70,0x61,0x63,0x6b,0x65,0x74,0x20,0x65,
0x6e,0x64,0x3d,0x22,0x72,0x22,0x3f,0x3e,0xd4,0x38,
0xd4,0x9d,0x00,0x00,0x01,0x36,0x49,0x44,0x41,0x54,
0x78,0xda,0x94,0xd3,0xbf,0x2b,0x45,0x61,0x1c,0xc7,
0xf1,0xe7,0x5c,0x87,0x9b,0x6b,0x30,0x58,0x0c,0xfe,
0x04,0xd3,0x1d,0x4d,0x52,0x0c,0xc4,0x20,0xa5,0x58,
0x6e,0x06,0x45,0x8c,0x9c,0x41,0x37,0x94,0x45,0x46,
0x37,0x49,0x06,0xbf,0x16,0x4a,0x24,0x19,0x28,0x2c,
0x77,0x35,0xdd,0xc5,0x7f,0x60,0x31,0x18,0x10,0xf2,
0xe3,0xfd,0xa9,0xef,0xa9,0xdb,0xad,0x73,0xce,0xe3,
0x5b,0xaf,0x4e,0x9d,0x73,0x3e,0xcf,0x79,0x9e,0xe7,
0xfb,0x9c,0x20,0x8a,0xa2,0x2e,0xe7,0xdc,0x3e,0x66,
0xf1,0xe8,0x3c,0x2a,0x87,0x55,0xf4,0xe1,0x1e,0xdd,
0xbe,0xa1,0x79,0xdc,0xa0,0xd3,0x82,0x45,0x9f,0xd0,
0x1b,0x86,0x71,0x81,0x0e,0xdc,0xa2,0x27,0x2b,0xa4,
0xfa,0xc0,0x18,0x8e,0xd1,0x8e,0x6b,0x9b,0x72,0x6a,
0x48,0xf5,0x85,0x49,0xec,0xa1,0x0d,0x97,0x18,0xcc,
0x0a,0xa9,0xbe,0x31,0x85,0x2d,0xb4,0xe2,0x0c,0xa3,
0x59,0x21,0xd5,0x2f,0xe6,0xb0,0x81,0x16,0x9c,0xd8,
0x0c,0x52,0x43,0x71,0x70,0xd1,0xda,0xd1,0x84,0x03,
0x4c,0x67,0x85,0xe2,0x5a,0xb1,0x70,0x80,0x6d,0x2c,
0xe9,0x66,0xe8,0xd1,0x4b,0x4d,0xf3,0x15,0x15,0xac,
0x69,0xad,0x39,0xf7,0xff,0x0a,0x7c,0x42,0x0b,0xf6,
0x15,0x55,0x59,0x53,0x0c,0x3d,0xd6,0xb4,0x8c,0x1f,
0xcc,0x60,0x27,0x6d,0x4d,0x5a,0xf8,0xba,0x7d,0x45,
0xbd,0x2b,0xe1,0x28,0x7e,0x18,0x26,0x04,0x2a,0xf6,
0xab,0x7c,0x62,0x02,0xa7,0xf5,0x2f,0x34,0x86,0xd4,
0x93,0x5d,0x1b,0xf9,0xdd,0xce,0xe3,0x55,0xe3,0xa8,
0xf5,0xa1,0x66,0x1c,0x62,0xdc,0xb6,0x78,0xc4,0x4e,
0xbc,0x4b,0x0a,0xe5,0xed,0xb8,0xe8,0xc5,0x17,0x0c,
0xa1,0x9a,0xb4,0x3b,0x0a,0x15,0x70,0x8e,0x7e,0x3c,
0x63,0x00,0x0f,0x69,0x5b,0xaa,0xd0,0xa6,0x05,0x9e,
0xec,0x5a,0xf3,0xf9,0x73,0xd5,0x87,0x3b,0xf4,0xfa,
0x04,0x54,0x7f,0x02,0x0c,0x00,0x5f,0x4a,0x3a,0x5d,
0xf2,0x7e,0xec,0x5c,0x00,0x00,0x00,0x00,0x49,0x45,
0x4e,0x44,0xae,0x42,0x60,0x82
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -8,6 +8,7 @@
#include <iomanip> #include <iomanip>
#include "views/ViewController.h" #include "views/ViewController.h"
#include "components/HelpComponent.h" #include "components/HelpComponent.h"
#include "components/ImageComponent.h"
Window::Window() : mNormalizeNextUpdate(false), mFrameTimeElapsed(0), mFrameCountElapsed(0), mAverageDeltaTime(10), Window::Window() : mNormalizeNextUpdate(false), mFrameTimeElapsed(0), mFrameCountElapsed(0), mAverageDeltaTime(10),
mAllowSleep(true) mAllowSleep(true)
@ -15,12 +16,17 @@ Window::Window() : mNormalizeNextUpdate(false), mFrameTimeElapsed(0), mFrameCoun
mInputManager = new InputManager(this); mInputManager = new InputManager(this);
mViewController = new ViewController(this); mViewController = new ViewController(this);
mHelp = new HelpComponent(this); mHelp = new HelpComponent(this);
mBackgroundOverlay = new ImageComponent(this);
mBackgroundOverlay->setImage(":/scroll_gradient.png");
pushGui(mViewController); pushGui(mViewController);
} }
Window::~Window() Window::~Window()
{ {
delete mViewController; // this would get deleted down below, but just to be safe, delete it here delete mViewController; // this would get deleted down below, but just to be safe, delete it here
delete mBackgroundOverlay;
//delete all our GUIs //delete all our GUIs
while(peekGui()) while(peekGui())
@ -80,6 +86,8 @@ bool Window::init(unsigned int width, unsigned int height)
mDefaultFonts.push_back(Font::get(FONT_SIZE_LARGE)); mDefaultFonts.push_back(Font::get(FONT_SIZE_LARGE));
} }
mBackgroundOverlay->setResize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());
// update our help because font sizes probably changed // update our help because font sizes probably changed
if(peekGui()) if(peekGui())
setHelpPrompts(peekGui()->getHelpPrompts()); setHelpPrompts(peekGui()->getHelpPrompts());
@ -145,9 +153,14 @@ void Window::update(int deltaTime)
void Window::render() void Window::render()
{ {
Eigen::Affine3f transform = Eigen::Affine3f::Identity(); Eigen::Affine3f transform = Eigen::Affine3f::Identity();
const unsigned int drawBGAfter = mGuiStack.size() > 1 ? mGuiStack.size() - 2 : mGuiStack.size();
for(unsigned int i = 0; i < mGuiStack.size(); i++) for(unsigned int i = 0; i < mGuiStack.size(); i++)
{ {
mGuiStack.at(i)->render(transform); mGuiStack.at(i)->render(transform);
if(i == drawBGAfter)
mBackgroundOverlay->render(transform);
} }
mHelp->render(transform); mHelp->render(transform);

View file

@ -8,6 +8,7 @@
class ViewController; class ViewController;
class HelpComponent; class HelpComponent;
class ImageComponent;
class Window class Window
{ {
@ -42,6 +43,8 @@ private:
InputManager* mInputManager; InputManager* mInputManager;
ViewController* mViewController; ViewController* mViewController;
HelpComponent* mHelp; HelpComponent* mHelp;
ImageComponent* mBackgroundOverlay;
std::vector<GuiComponent*> mGuiStack; std::vector<GuiComponent*> mGuiStack;
std::vector< std::shared_ptr<Font> > mDefaultFonts; std::vector< std::shared_ptr<Font> > mDefaultFonts;

View file

@ -1,6 +1,6 @@
#include "ComponentList.h" #include "ComponentList.h"
#define TOTAL_HORIZONTAL_PADDING_PX 12 #define TOTAL_HORIZONTAL_PADDING_PX 20
ComponentList::ComponentList(Window* window) : IList<ComponentListRow, void*>(window, LIST_SCROLL_STYLE_SLOW, LIST_NEVER_LOOP) ComponentList::ComponentList(Window* window) : IList<ComponentListRow, void*>(window, LIST_SCROLL_STYLE_SLOW, LIST_NEVER_LOOP)
{ {
@ -126,19 +126,24 @@ void ComponentList::render(const Eigen::Affine3f& parentTrans)
// and 0xFFFFFF -> 0x777777 // and 0xFFFFFF -> 0x777777
// (1 - dst) + 0x77 // (1 - dst) + 0x77
Renderer::drawRect(0, (int)mSelectorBarOffset, (int)mSize.x(), (int)getRowHeight(mEntries.at(mCursor).data), 0xFFFFFFFF, const float selectedRowHeight = getRowHeight(mEntries.at(mCursor).data);
Renderer::drawRect(0, (int)mSelectorBarOffset, (int)mSize.x(), (int)selectedRowHeight, 0xFFFFFFFF,
GL_ONE_MINUS_DST_COLOR, GL_ZERO); GL_ONE_MINUS_DST_COLOR, GL_ZERO);
Renderer::drawRect(0, (int)mSelectorBarOffset, (int)mSize.x(), (int)getRowHeight(mEntries.at(mCursor).data), 0x777777FF, Renderer::drawRect(0, (int)mSelectorBarOffset, (int)mSize.x(), (int)selectedRowHeight, 0x777777FF,
GL_ONE, GL_ONE); GL_ONE, GL_ONE);
// hack to draw 2px dark on left/right of the bar
Renderer::drawRect(0, (int)mSelectorBarOffset, 2, (int)selectedRowHeight, 0x878787FF);
Renderer::drawRect((int)mSize.x() - 2, (int)mSelectorBarOffset, 2, (int)selectedRowHeight, 0x878787FF);
// draw separators // draw separators
float y = 0; float y = 0;
for(unsigned int i = 0; i < mEntries.size(); i++) for(unsigned int i = 0; i < mEntries.size(); i++)
{ {
Renderer::drawRect(0, (int)y, (int)mSize.x(), 1, 0xC6C7C688); Renderer::drawRect(0, (int)y, (int)mSize.x(), 1, 0xC6C7C6FF);
y += getRowHeight(mEntries.at(i).data); y += getRowHeight(mEntries.at(i).data);
} }
Renderer::drawRect(0, (int)y, (int)mSize.x(), 1, 0xC6C7C688); Renderer::drawRect(0, (int)y, (int)mSize.x(), 1, 0xC6C7C6FF);
Renderer::popClipRect(); Renderer::popClipRect();
} }

View file

@ -7,21 +7,25 @@ MenuComponent::MenuComponent(Window* window, const char* title) : GuiComponent(w
mTitle.setFont(Font::get(FONT_SIZE_LARGE)); mTitle.setFont(Font::get(FONT_SIZE_LARGE));
mTitle.setText(title); mTitle.setText(title);
mTitle.setColor(0x555555FF);
mTitle.setCentered(true); mTitle.setCentered(true);
addChild(&mBackground); addChild(&mBackground);
addChild(&mTitle); addChild(&mTitle);
addChild(&mList); addChild(&mList);
setSize(Renderer::getScreenWidth() * 0.6f, Renderer::getScreenHeight() * 0.8f); setSize(Renderer::getScreenWidth() * 0.5f, Renderer::getScreenHeight() * 0.75f);
} }
void MenuComponent::onSizeChanged() void MenuComponent::onSizeChanged()
{ {
mBackground.fitTo(mSize, Eigen::Vector3f::Zero(), Eigen::Vector2f(-2, -2)); mBackground.fitTo(mSize, Eigen::Vector3f::Zero(), Eigen::Vector2f(-32, -32));
const float titlePadding = mTitle.getFont()->getHeight() * 0.2f;
mTitle.setSize(mSize.x(), (float)mTitle.getFont()->getHeight()); mTitle.setSize(mSize.x(), (float)mTitle.getFont()->getHeight());
mTitle.setPosition(0, titlePadding / 2);
mList.setPosition(0, mTitle.getSize().y()); mList.setPosition(0, mTitle.getSize().y() + titlePadding);
mList.setSize(mSize.x(), mSize.y() - mTitle.getSize().y()); mList.setSize(mSize.x(), mSize.y() - mTitle.getSize().y() - titlePadding);
} }

View file

@ -8,7 +8,7 @@
#include <initializer_list> #include <initializer_list>
#include "../Settings.h" #include "../Settings.h"
GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "Main Menu") GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MENU")
{ {
setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());
mMenu.setPosition((mSize.x() - mMenu.getSize().x()) / 2, (mSize.y() - mMenu.getSize().y()) / 2); mMenu.setPosition((mSize.x() - mMenu.getSize().x()) / 2, (mSize.y() - mMenu.getSize().y()) / 2);
@ -58,15 +58,22 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "Main Men
void GuiMenu::addEntry(const char* name, unsigned int color, bool add_arrow, const std::function<void()>& func) void GuiMenu::addEntry(const char* name, unsigned int color, bool add_arrow, const std::function<void()>& func)
{ {
std::shared_ptr<Font> font = Font::get(FONT_SIZE_LARGE); std::shared_ptr<Font> font = Font::get(FONT_SIZE_MEDIUM);
// populate the list // populate the list
ComponentListRow row; ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(mWindow, name, font, color), true); row.addElement(std::make_shared<TextComponent>(mWindow, name, font, color), true);
if(add_arrow) if(add_arrow)
row.addElement(std::make_shared<TextComponent>(mWindow, ">", font, color), false); {
std::shared_ptr<ImageComponent> bracket = std::make_shared<ImageComponent>(mWindow);
bracket->setImage(":/sq_bracket.png");
if(bracket->getTextureSize().y() > font->getHeight())
bracket->setResize(0, (float)font->getHeight());
row.addElement(bracket, false);
}
row.makeAcceptInputHandler(func); row.makeAcceptInputHandler(func);
mMenu.addRow(row); mMenu.addRow(row);

View file

@ -7,7 +7,7 @@
#include "../scrapers/GamesDBScraper.h" #include "../scrapers/GamesDBScraper.h"
GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window), GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window),
mMenu(mWindow, "Settings") mMenu(mWindow, "SETTINGS")
{ {
setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());

View file

@ -210,7 +210,7 @@ void ViewController::render(const Eigen::Affine3f& parentTrans)
// fade out // fade out
if(mFadeOpacity) if(mFadeOpacity)
{ {
Renderer::setMatrix(Eigen::Affine3f::Identity()); Renderer::setMatrix(parentTrans);
Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x00000000 | (unsigned char)(mFadeOpacity * 255)); Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x00000000 | (unsigned char)(mFadeOpacity * 255));
} }
} }