Commit 671dbc62 authored by Aloshi's avatar Aloshi

New button style.

Started redoing GuiMsgBoxs to use the new style.
parent 1c3135b7
......@@ -294,6 +294,7 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/ES_logo_16_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/ES_logo_32_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/button_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/button_filled_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/frame_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/textbox_png.cpp
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/textbox_glow_png.cpp
......
......@@ -2,10 +2,11 @@
#include "Resources.h"
const size_t res2hNrOfFiles = 21;
const size_t res2hNrOfFiles = 22;
const Res2hEntry res2hFiles[res2hNrOfFiles] = {
{":/arrow.png", arrow_png_size, arrow_png_data},
{":/button.png", button_png_size, button_png_data},
{":/button_filled.png", button_filled_png_size, button_filled_png_data},
{":/checkbox_checked.png", checkbox_checked_png_size, checkbox_checked_png_data},
{":/checkbox_unchecked.png", checkbox_unchecked_png_size, checkbox_unchecked_png_data},
{":/ES_logo_16.png", ES_logo_16_png_size, ES_logo_16_png_data},
......@@ -30,25 +31,26 @@ const Res2hEntry res2hFiles[res2hNrOfFiles] = {
res2hMapType::value_type mapTemp[] = {
std::make_pair(":/arrow.png", res2hFiles[0]),
std::make_pair(":/button.png", res2hFiles[1]),
std::make_pair(":/checkbox_checked.png", res2hFiles[2]),
std::make_pair(":/checkbox_unchecked.png", res2hFiles[3]),
std::make_pair(":/ES_logo_16.png", res2hFiles[4]),
std::make_pair(":/ES_logo_32.png", res2hFiles[5]),
std::make_pair(":/frame.png", res2hFiles[6]),
std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[7]),
std::make_pair(":/scroll_gradient.png", res2hFiles[8]),
std::make_pair(":/slider_knob.png", res2hFiles[9]),
std::make_pair(":/sq_bracket.png", res2hFiles[10]),
std::make_pair(":/star_filled.png", res2hFiles[11]),
std::make_pair(":/star_unfilled.png", res2hFiles[12]),
std::make_pair(":/textbox.png", res2hFiles[13]),
std::make_pair(":/textbox_glow.png", res2hFiles[14]),
std::make_pair(":/help/a.png", res2hFiles[15]),
std::make_pair(":/help/b.png", res2hFiles[16]),
std::make_pair(":/help/dpad.png", res2hFiles[17]),
std::make_pair(":/help/left_right.png", res2hFiles[18]),
std::make_pair(":/help/menu.png", res2hFiles[19]),
std::make_pair(":/help/up_down.png", res2hFiles[20])
std::make_pair(":/button_filled.png", res2hFiles[2]),
std::make_pair(":/checkbox_checked.png", res2hFiles[3]),
std::make_pair(":/checkbox_unchecked.png", res2hFiles[4]),
std::make_pair(":/ES_logo_16.png", res2hFiles[5]),
std::make_pair(":/ES_logo_32.png", res2hFiles[6]),
std::make_pair(":/frame.png", res2hFiles[7]),
std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[8]),
std::make_pair(":/scroll_gradient.png", res2hFiles[9]),
std::make_pair(":/slider_knob.png", res2hFiles[10]),
std::make_pair(":/sq_bracket.png", res2hFiles[11]),
std::make_pair(":/star_filled.png", res2hFiles[12]),
std::make_pair(":/star_unfilled.png", res2hFiles[13]),
std::make_pair(":/textbox.png", res2hFiles[14]),
std::make_pair(":/textbox_glow.png", res2hFiles[15]),
std::make_pair(":/help/a.png", res2hFiles[16]),
std::make_pair(":/help/b.png", res2hFiles[17]),
std::make_pair(":/help/dpad.png", res2hFiles[18]),
std::make_pair(":/help/left_right.png", res2hFiles[19]),
std::make_pair(":/help/menu.png", res2hFiles[20]),
std::make_pair(":/help/up_down.png", res2hFiles[21])
};
res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]);
......@@ -11,6 +11,9 @@ extern const unsigned char arrow_png_data[];
extern const size_t button_png_size;
extern const unsigned char button_png_data[];
extern const size_t button_filled_png_size;
extern const unsigned char button_filled_png_data[];
extern const size_t checkbox_checked_png_size;
extern const unsigned char checkbox_checked_png_data[];
......
//this file was auto-generated from "button_filled.png" by res2h
#include "../Resources.h"
const size_t button_filled_png_size = 1168;
const unsigned char button_filled_png_data[1168] = {
0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,
0x00,0x0d,0x49,0x48,0x44,0x52,0x00,0x00,0x00,0x30,
0x00,0x00,0x00,0x30,0x08,0x06,0x00,0x00,0x00,0x57,
0x02,0xf9,0x87,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,0x68,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,0x37,0x34,0x30,0x31,0x37,0x39,0x35,0x39,
0x30,0x45,0x32,0x30,0x36,0x38,0x31,0x31,0x38,0x30,
0x38,0x33,0x43,0x37,0x45,0x33,0x31,0x45,0x41,0x35,
0x41,0x37,0x35,0x33,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,0x39,0x38,0x44,0x38,0x30,0x39,0x44,0x44,
0x39,0x44,0x38,0x37,0x31,0x31,0x45,0x33,0x41,0x39,
0x31,0x44,0x42,0x44,0x46,0x44,0x34,0x30,0x39,0x39,
0x32,0x45,0x45,0x33,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,0x39,0x38,0x44,0x38,0x30,0x39,0x44,0x43,
0x39,0x44,0x38,0x37,0x31,0x31,0x45,0x33,0x41,0x39,
0x31,0x44,0x42,0x44,0x46,0x44,0x34,0x30,0x39,0x39,
0x32,0x45,0x45,0x33,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,0x4d,0x61,0x63,0x69,0x6e,0x74,
0x6f,0x73,0x68,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,0x37,0x34,0x30,0x31,0x37,0x39,0x35,0x39,
0x30,0x45,0x32,0x30,0x36,0x38,0x31,0x31,0x38,0x30,
0x38,0x33,0x43,0x37,0x45,0x33,0x31,0x45,0x41,0x35,
0x41,0x37,0x35,0x33,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,0x37,0x34,0x30,0x31,0x37,0x39,0x35,0x39,
0x30,0x45,0x32,0x30,0x36,0x38,0x31,0x31,0x38,0x30,
0x38,0x33,0x43,0x37,0x45,0x33,0x31,0x45,0x41,0x35,
0x41,0x37,0x35,0x33,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,
0xfb,0x75,0xe4,0x6d,0x00,0x00,0x00,0xbe,0x49,0x44,
0x41,0x54,0x78,0xda,0xec,0xd3,0xc1,0x09,0xc2,0x40,
0x14,0x45,0xd1,0x71,0x10,0x6c,0x45,0x74,0x61,0x0f,
0xb6,0xe0,0x22,0x15,0x24,0x08,0x29,0x60,0x2a,0x11,
0x24,0x76,0x20,0xd8,0x8c,0x8b,0x60,0x2b,0x13,0x30,
0xf8,0x3e,0x4c,0x36,0xae,0x5c,0xce,0xc7,0xfb,0xe1,
0xee,0xdf,0x19,0x98,0x55,0x4a,0x29,0xe8,0xa2,0x3a,
0xab,0x4e,0x6d,0xd5,0x26,0xd4,0x79,0x59,0xbd,0xd4,
0xa0,0xae,0x6a,0x5e,0x97,0xf1,0x77,0x75,0x0a,0xf5,
0x9f,0x3d,0xec,0x41,0x5d,0xd4,0x51,0x35,0xb1,0xbc,
0xba,0x87,0xf1,0xdf,0x67,0x9b,0x5b,0x03,0xb4,0xc1,
0xef,0x75,0x06,0xd8,0x3b,0x06,0xec,0x62,0xc5,0x1f,
0xf6,0xa7,0x3f,0x11,0x83,0xf3,0x03,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xe0,0x1f,0x01,0xd9,0xf1,
0xfe,0x6c,0x80,0xd1,0x31,0x60,0x34,0xc0,0xe0,0x18,
0x30,0x2c,0x80,0x87,0xc3,0xf1,0xb6,0xf9,0x66,0x80,
0x59,0x35,0xaa,0x57,0x4f,0x35,0x55,0x3c,0x7a,0x2a,
0x1b,0xfb,0xb2,0xf9,0xfd,0x11,0x60,0x00,0xb7,0x75,
0x1a,0x41,0x6b,0xc2,0x11,0x6c,0x00,0x00,0x00,0x00,
0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
This diff is collapsed.
data/resources/button.png

3.89 KB | W: | H:

data/resources/button.png

1.2 KB | W: | H:

data/resources/button.png
data/resources/button.png
data/resources/button.png
data/resources/button.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -5,14 +5,14 @@
ButtonComponent::ButtonComponent(Window* window) : GuiComponent(window),
mBox(window, ":/button.png"),
mFocused(false),
mTextColorFocused(0x000000FF), mTextColorUnfocused(0x333333FF), mTextPulseTime(0)
mTextColorFocused(0xFFFFFFFF), mTextColorUnfocused(0x777777FF)
{
setSize(64, 48);
}
void ButtonComponent::onSizeChanged()
{
mBox.setSize(mSize);
mBox.fitTo(mSize, Eigen::Vector3f::Zero(), Eigen::Vector2f(-32, -32));
}
void ButtonComponent::setPressedFunc(std::function<void()> f)
......@@ -32,13 +32,11 @@ bool ButtonComponent::input(InputConfig* config, Input input)
return GuiComponent::input(config, input);
}
void ButtonComponent::setText(const std::string& text, const std::string& helpText, unsigned int focusedColor, unsigned int unfocusedColor)
void ButtonComponent::setText(const std::string& text, const std::string& helpText)
{
mText = text;
mHelpText = helpText;
mTextColorFocused = focusedColor;
mTextColorUnfocused = unfocusedColor;
std::shared_ptr<Font> f = getFont();
mTextCache = std::unique_ptr<TextCache>(f->buildTextCache(mText, 0, 0, getCurTextColor()));
......@@ -50,11 +48,13 @@ void ButtonComponent::setText(const std::string& text, const std::string& helpTe
void ButtonComponent::onFocusGained()
{
mFocused = true;
mBox.setImagePath(":/button_filled.png");
}
void ButtonComponent::onFocusLost()
{
mFocused = false;
mBox.setImagePath(":/button.png");
}
void ButtonComponent::render(const Eigen::Affine3f& parentTrans)
......
......@@ -15,7 +15,7 @@ public:
bool input(InputConfig* config, Input input) override;
void render(const Eigen::Affine3f& parentTrans) override;
void setText(const std::string& text, const std::string& helpText, unsigned int focusedTextColor, unsigned int unfocusedTextColor = 0x555555FF);
void setText(const std::string& text, const std::string& helpText);
void onSizeChanged() override;
void onFocusGained() override;
......@@ -30,8 +30,7 @@ private:
bool mFocused;
unsigned int mTextColorFocused;
unsigned int mTextColorUnfocused;
int mTextPulseTime;
unsigned int getCurTextColor() const;
std::string mText;
......
......@@ -29,7 +29,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
mHeader.setText(header);
//initialize buttons
mDeleteButton.setText("DELETE", "delete file", mDeleteFunc ? 0xFF0000FF : 0x555555FF);
mDeleteButton.setText("DELETE", "delete file");
if(mDeleteFunc)
{
std::function<void()> deleteFileAndSelf = [&] { mDeleteFunc(); delete this; };
......@@ -37,10 +37,10 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
mDeleteButton.setPressedFunc(pressedFunc);
}
mFetchButton.setText("FETCH", "download metadata", 0x00FF00FF);
mFetchButton.setText("FETCH", "download metadata");
mFetchButton.setPressedFunc(std::bind(&GuiMetaDataEd::fetch, this));
mSaveButton.setText("SAVE", "save", 0x0000FFFF);
mSaveButton.setText("SAVE", "save");
mSaveButton.setPressedFunc([&] { save(); delete this; });
//initialize metadata list
......
......@@ -6,6 +6,7 @@
GuiMsgBoxOk::GuiMsgBoxOk(Window* window, const std::string& text, std::function<void()> callback) : GuiComponent(window),
mCallback(callback),
mBackground(window),
mText(window),
mOkText(window)
{
......
......@@ -2,6 +2,7 @@
#include "../GuiComponent.h"
#include "../components/TextComponent.h"
#include "../components/NinePatchComponent.h"
#include <functional>
//A simple popup message box with callbacks for when the user dismisses it.
......@@ -17,6 +18,8 @@ public:
private:
std::function<void()> mCallback;
NinePatchComponent mBackground;
TextComponent mText;
TextComponent mOkText;
};
#include "GuiMsgBoxYesNo.h"
#include "../Renderer.h"
#define MSG_WIDTH 0.8f
#define MSG_PADDING ((1 - MSG_WIDTH) / 2)
GuiMsgBoxYesNo::GuiMsgBoxYesNo(Window* window, const std::string& text, std::function<void()> yesCallback, std::function<void()> noCallback) : GuiComponent(window),
mYesCallback(yesCallback),
mNoCallback(noCallback),
mBackground(window),
mText(window),
mInputText(window)
{
const float paddingX = 32;
const float paddingY = 16;
const float maxWidth = Renderer::getScreenWidth() * 0.7f;
float width = mText.getFont()->sizeText(text).x() + paddingX;
if(width > maxWidth)
width = maxWidth;
mText.setCentered(true);
mText.setColor(0x00BB00FF);
mText.setSize(Renderer::getScreenWidth() * MSG_WIDTH, 0);
mText.setColor(0x777777FF);
mText.setPosition(paddingX / 2, paddingY / 2);
mText.setSize(width - paddingX, 0);
mText.setText(text);
mInputText.setCentered(true);
mInputText.setColor(0x0044BBFF);
mInputText.setFont(Font::get(FONT_SIZE_SMALL));
mInputText.setSize(Renderer::getScreenWidth() * MSG_WIDTH, 0);
mInputText.setPosition(paddingX / 2, mText.getPosition().y() + mText.getSize().y());
mInputText.setSize(width - paddingX, 0);
mInputText.setText("[A - yes] [B - no]");
mText.setPosition(Renderer::getScreenWidth() * MSG_PADDING, (Renderer::getScreenHeight() - mText.getSize().y() - mInputText.getSize().y()) / 2);
mInputText.setPosition(Renderer::getScreenWidth() * MSG_PADDING, mText.getPosition().y() + mText.getSize().y());
setSize(width, mInputText.getPosition().y() + mInputText.getSize().y() + paddingY/2);
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, (Renderer::getScreenHeight() - mSize.y()) / 2);
mBackground.setImagePath(":/frame.png");
mBackground.fitTo(mSize, Eigen::Vector3f::Zero(), Eigen::Vector2f(-32, -32));
}
bool GuiMsgBoxYesNo::input(InputConfig* config, Input input)
......@@ -51,9 +63,15 @@ bool GuiMsgBoxYesNo::input(InputConfig* config, Input input)
void GuiMsgBoxYesNo::render(const Eigen::Affine3f& parentTrans)
{
float height = mText.getSize().y() + mInputText.getSize().y();
Renderer::setMatrix(parentTrans);
Renderer::drawRect(0, (int)((Renderer::getScreenHeight() - height) / 2), Renderer::getScreenWidth(), (int)height, 0x111111FF);
mText.render(parentTrans);
mInputText.render(parentTrans);
Eigen::Affine3f trans = parentTrans * getTransform();
mBackground.render(trans);
Renderer::setMatrix(trans);
Renderer::drawRect(0, (int)(mText.getPosition().y() + mText.getSize().y()), (int)mSize.x(), 1, 0xC6C7C6FF);
mText.render(trans);
mInputText.render(trans);
renderChildren(trans);
}
......@@ -2,6 +2,7 @@
#include "../GuiComponent.h"
#include "../components/TextComponent.h"
#include "../components/NinePatchComponent.h"
#include <functional>
//A simple "yes or no" popup box with callbacks for yes or no.
......@@ -12,11 +13,13 @@ public:
GuiMsgBoxYesNo(Window* window, const std::string& msg, std::function<void()> yesCallback = nullptr, std::function<void()> noCallback = nullptr);
bool input(InputConfig* config, Input input) override;
void render(const Eigen::Affine3f& parentTrans) override;
void render(const Eigen::Affine3f& trans) override;
private:
std::function<void()> mYesCallback, mNoCallback;
NinePatchComponent mBackground;
TextComponent mText;
TextComponent mInputText;
};
......@@ -42,14 +42,13 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), &mManualLabel, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mManualSwitch, true, ComponentGrid::AlignLeft);
mStartButton.setText("GO GO GO GO", "begin", 0x00FF00FF);
mStartButton.setText("GO GO GO GO", "begin");
mStartButton.setPressedFunc(std::bind(&GuiScraperStart::pressedStart, this));
mList.setEntry(Vector2i(0, 3), Vector2i(2, 1), &mStartButton, true, ComponentGrid::AlignCenter);
mList.setPosition(Renderer::getScreenWidth() / 2 - mList.getSize().x() / 2, Renderer::getScreenHeight() / 2 - mList.getSize().y() / 2);
mBox.setEdgeColor(0x333333FF);
mBox.fitTo(mList.getSize(), mList.getPosition(), Eigen::Vector2f(8, 8));
mBox.fitTo(mList.getSize(), mList.getPosition(), Eigen::Vector2f(-32, -32));
}
void GuiScraperStart::pressedStart()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment