1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

overlays/osk: Add more buttons to native dialog and other improvements

- Adds all the major buttons to native dialog input options
- Adds more button options for the native osk
- Brighten osk cell backgrounds a bit to improve visibility
This commit is contained in:
kd-11 2019-01-30 12:50:29 +03:00 committed by kd-11
parent 9ed9d7e947
commit c434e0ce27
4 changed files with 107 additions and 50 deletions

View File

@ -479,10 +479,16 @@ namespace rsx
{
fade_top = 1,
fade_bottom,
select,
start,
cross,
circle,
triangle,
square,
L1,
R1,
L2,
R2,
save,
new_entry
};
@ -495,10 +501,16 @@ namespace rsx
{
texture_resource_files.push_back("fade_top.png");
texture_resource_files.push_back("fade_bottom.png");
texture_resource_files.push_back("select.png");
texture_resource_files.push_back("start.png");
texture_resource_files.push_back("cross.png");
texture_resource_files.push_back("circle.png");
texture_resource_files.push_back("triangle.png");
texture_resource_files.push_back("square.png");
texture_resource_files.push_back("L1.png");
texture_resource_files.push_back("R1.png");
texture_resource_files.push_back("L2.png");
texture_resource_files.push_back("R2.png");
texture_resource_files.push_back("save.png");
texture_resource_files.push_back("new.png");
}

View File

@ -105,23 +105,35 @@ namespace rsx
_cell.pos += grid_origin;
}
m_btn_shift.set_pos(frame_x + 50, frame_y + frame_h + 10);
m_btn_shift.set_size(140, 30);
m_btn_shift.set_text("Shift");
m_btn_shift.set_text_vertical_adjust(5);
m_btn_accept.set_pos(frame_x + 200, frame_y + frame_h + 10);
m_btn_accept.set_size(140, 30);
m_btn_accept.set_text("Accept");
m_btn_accept.set_text_vertical_adjust(5);
m_btn_cancel.set_pos(frame_x + 350, frame_y + frame_h + 10);
m_btn_cancel.set_pos(frame_x, frame_y + frame_h + 10);
m_btn_cancel.set_size(140, 30);
m_btn_cancel.set_text("Cancel");
m_btn_cancel.set_text_vertical_adjust(5);
m_btn_shift.set_image_resource(resource_config::standard_image_resource::triangle);
m_btn_accept.set_image_resource(resource_config::standard_image_resource::square);
m_btn_space.set_pos(frame_x + 100, frame_y + frame_h + 10);
m_btn_space.set_size(100, 30);
m_btn_space.set_text("Space");
m_btn_space.set_text_vertical_adjust(5);
m_btn_delete.set_pos(frame_x + 200, frame_y + frame_h + 10);
m_btn_delete.set_size(100, 30);
m_btn_delete.set_text("Backspace");
m_btn_delete.set_text_vertical_adjust(5);
m_btn_shift.set_pos(frame_x + 320, frame_y + frame_h + 10);
m_btn_shift.set_size(80, 30);
m_btn_shift.set_text("Shift");
m_btn_shift.set_text_vertical_adjust(5);
m_btn_accept.set_pos(frame_x + 400, frame_y + frame_h + 10);
m_btn_accept.set_size(100, 30);
m_btn_accept.set_text("Accept");
m_btn_accept.set_text_vertical_adjust(5);
m_btn_shift.set_image_resource(resource_config::standard_image_resource::select);
m_btn_accept.set_image_resource(resource_config::standard_image_resource::start);
m_btn_space.set_image_resource(resource_config::standard_image_resource::triangle);
m_btn_delete.set_image_resource(resource_config::standard_image_resource::square);
if (g_cfg.sys.enter_button_assignment == enter_button_assign::circle)
{
@ -274,14 +286,24 @@ namespace rsx
}
break;
}
case pad_button::select:
{
on_shift("");
break;
}
case pad_button::start:
{
Close(true);
break;
}
case pad_button::triangle:
{
on_shift("Shift");
on_space("");
break;
}
case pad_button::square:
{
Close(true);
on_backspace("");
break;
}
case pad_button::cross:
@ -400,6 +422,8 @@ namespace rsx
m_cached_resource.add(m_btn_accept.get_compiled());
m_cached_resource.add(m_btn_cancel.get_compiled());
m_cached_resource.add(m_btn_shift.get_compiled());
m_cached_resource.add(m_btn_space.get_compiled());
m_cached_resource.add(m_btn_delete.get_compiled());
overlay_element tmp;
label m_label;
@ -488,9 +512,9 @@ namespace rsx
LOG_WARNING(RSX, "Native OSK dialog does not support multiline text!");
}
color4f default_bg = { 0.5f, 0.5f, 0.5f, 1.f };
color4f special_bg = { 0.5f, 0.5f, 0.8f, 1.f };
color4f special2_bg = { 0.8f, 0.8f, 0.5f, 1.f };
color4f default_bg = { 0.8f, 0.8f, 0.8f, 1.f };
color4f special_bg = { 0.2f, 0.7f, 0.7f, 1.f };
color4f special2_bg = { 0.93f, 0.91f, 0.67f, 1.f };
num_rows = 5;
num_columns = 10;

View File

@ -5,36 +5,36 @@
#include <locale>
#include <codecvt>
#if _MSC_VER >= 1900
// Stupid MSVC bug when T is set to char16_t
std::string utf16_to_utf8(const std::u16string& utf16_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t> convert;
auto p = reinterpret_cast<const int16_t *>(utf16_string.data());
return convert.to_bytes(p, p + utf16_string.size());
}
std::u16string utf8_to_utf16(const std::string& utf8_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t> convert;
auto ws = convert.from_bytes(utf8_string);
return reinterpret_cast<const char16_t*>(ws.c_str());
}
#else
std::string utf16_to_utf8(const std::u16string& utf16_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(utf16_string);
}
std::u16string utf8_to_utf16(const std::string& utf8_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.from_bytes(utf8_string);
}
#if _MSC_VER >= 1900
// Stupid MSVC bug when T is set to char16_t
std::string utf16_to_utf8(const std::u16string& utf16_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t> convert;
auto p = reinterpret_cast<const int16_t *>(utf16_string.data());
return convert.to_bytes(p, p + utf16_string.size());
}
std::u16string utf8_to_utf16(const std::string& utf8_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t> convert;
auto ws = convert.from_bytes(utf8_string);
return reinterpret_cast<const char16_t*>(ws.c_str());
}
#else
std::string utf16_to_utf8(const std::u16string& utf16_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(utf16_string);
}
std::u16string utf8_to_utf16(const std::string& utf8_string)
{
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.from_bytes(utf8_string);
}
#endif
namespace rsx
@ -49,7 +49,7 @@ namespace rsx
std::array<std::chrono::steady_clock::time_point, CELL_PAD_MAX_PORT_NUM> timestamp;
timestamp.fill(std::chrono::steady_clock::now());
std::array<std::array<bool, 8>, CELL_PAD_MAX_PORT_NUM> button_state;
std::array<std::array<bool, pad_button::pad_button_max_enum>, CELL_PAD_MAX_PORT_NUM> button_state;
for (auto& state : button_state)
{
state.fill(true);
@ -105,6 +105,12 @@ namespace rsx
case CELL_PAD_CTRL_UP:
button_id = pad_button::dpad_up;
break;
case CELL_PAD_CTRL_SELECT:
button_id = pad_button::select;
break;
case CELL_PAD_CTRL_START:
button_id = pad_button::start;
break;
}
}
else if (button.m_offset == CELL_PAD_BTN_OFFSET_DIGITAL2)
@ -123,6 +129,12 @@ namespace rsx
case CELL_PAD_CTRL_CROSS:
button_id = g_cfg.sys.enter_button_assignment == enter_button_assign::circle ? pad_button::circle : pad_button::cross;
break;
case CELL_PAD_CTRL_L1:
button_id = pad_button::L1;
break;
case CELL_PAD_CTRL_R1:
button_id = pad_button::R1;
break;
}
}

View File

@ -62,10 +62,16 @@ namespace rsx
dpad_down,
dpad_left,
dpad_right,
select,
start,
triangle,
circle,
square,
cross
cross,
L1,
R1,
pad_button_max_enum
};
Timer input_timer;
@ -401,6 +407,7 @@ namespace rsx
color4f backcolor{};
border_flags flags = default_cell;
bool selected = false;
bool enabled = false;
std::vector<std::string> outputs;
callback_t callback;
@ -422,6 +429,8 @@ namespace rsx
image_button m_btn_accept;
image_button m_btn_cancel;
image_button m_btn_shift;
image_button m_btn_space;
image_button m_btn_delete;
// Grid
u32 cell_size_x = 0;