mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 12:05:23 +00:00
overlays: add overlay_osk.h
This commit is contained in:
parent
33abcf74f2
commit
2341749485
6 changed files with 121 additions and 108 deletions
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/RSX/Overlays/overlays.h"
|
||||
#include "Emu/RSX/Overlays/overlay_osk.h"
|
||||
#include "Input/pad_thread.h"
|
||||
|
||||
#include "cellSysutil.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include "overlays.h"
|
||||
#include "overlay_osk.h"
|
||||
#include "Emu/RSX/RSXThread.h"
|
||||
|
||||
namespace rsx
|
||||
|
|
115
rpcs3/Emu/RSX/Overlays/overlay_osk.h
Normal file
115
rpcs3/Emu/RSX/Overlays/overlay_osk.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
#pragma once
|
||||
|
||||
#include "overlays.h"
|
||||
#include "Emu/Cell/Modules/cellOskDialog.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
namespace overlays
|
||||
{
|
||||
struct osk_dialog : public user_interface, public OskDialogBase
|
||||
{
|
||||
using callback_t = std::function<void(const std::u32string&)>;
|
||||
|
||||
enum border_flags
|
||||
{
|
||||
top = 1,
|
||||
bottom = 2,
|
||||
left = 4,
|
||||
right = 8,
|
||||
|
||||
start_cell = top | bottom | left,
|
||||
end_cell = top | bottom | right,
|
||||
middle_cell = top | bottom,
|
||||
default_cell = top | bottom | left | right
|
||||
};
|
||||
|
||||
enum button_flags
|
||||
{
|
||||
_default = 0,
|
||||
_return = 1,
|
||||
_space = 2
|
||||
};
|
||||
|
||||
struct cell
|
||||
{
|
||||
position2u pos;
|
||||
color4f backcolor{};
|
||||
border_flags flags = default_cell;
|
||||
bool selected = false;
|
||||
bool enabled = false;
|
||||
|
||||
std::vector<std::u32string> outputs;
|
||||
callback_t callback;
|
||||
};
|
||||
|
||||
struct grid_entry_ctor
|
||||
{
|
||||
std::vector<std::u32string> outputs;
|
||||
color4f color;
|
||||
u32 num_cell_hz;
|
||||
button_flags type_flags;
|
||||
callback_t callback;
|
||||
};
|
||||
|
||||
// Base UI
|
||||
overlay_element m_frame;
|
||||
overlay_element m_background;
|
||||
label m_title;
|
||||
edit_text m_preview;
|
||||
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;
|
||||
u32 cell_size_y = 0;
|
||||
u32 num_columns = 0;
|
||||
u32 num_rows = 0;
|
||||
u32 num_layers = 0;
|
||||
u32 selected_x = 0;
|
||||
u32 selected_y = 0;
|
||||
u32 selected_z = 0;
|
||||
|
||||
std::vector<cell> m_grid;
|
||||
|
||||
// Fade in/out
|
||||
animation_color_interpolate fade_animation;
|
||||
|
||||
bool m_update = true;
|
||||
compiled_resource m_cached_resource;
|
||||
|
||||
u32 flags = 0;
|
||||
u32 char_limit = UINT32_MAX;
|
||||
|
||||
osk_dialog() = default;
|
||||
~osk_dialog() override = default;
|
||||
|
||||
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 options) override = 0;
|
||||
void Close(bool ok) override;
|
||||
|
||||
void initialize_layout(const std::vector<grid_entry_ctor>& layout, const std::u32string& title, const std::u32string& initial_text);
|
||||
void update() override;
|
||||
|
||||
void on_button_pressed(pad_button button_press) override;
|
||||
void on_text_changed();
|
||||
|
||||
void on_default_callback(const std::u32string&);
|
||||
void on_shift(const std::u32string&);
|
||||
void on_space(const std::u32string&);
|
||||
void on_backspace(const std::u32string&);
|
||||
void on_enter(const std::u32string&);
|
||||
|
||||
compiled_resource get_compiled() override;
|
||||
};
|
||||
|
||||
struct osk_latin : osk_dialog
|
||||
{
|
||||
using osk_dialog::osk_dialog;
|
||||
|
||||
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 options) override;
|
||||
};
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@
|
|||
#include "Emu/Cell/ErrorCodes.h"
|
||||
#include "Emu/Cell/Modules/cellSaveData.h"
|
||||
#include "Emu/Cell/Modules/cellMsgDialog.h"
|
||||
#include "Emu/Cell/Modules/cellOskDialog.h"
|
||||
#include "Emu/Cell/Modules/sceNpTrophy.h"
|
||||
#include "Utilities/Timer.h"
|
||||
|
||||
|
@ -329,111 +328,6 @@ namespace rsx
|
|||
}
|
||||
};
|
||||
|
||||
struct osk_dialog : public user_interface, public OskDialogBase
|
||||
{
|
||||
using callback_t = std::function<void(const std::u32string&)>;
|
||||
|
||||
enum border_flags
|
||||
{
|
||||
top = 1,
|
||||
bottom = 2,
|
||||
left = 4,
|
||||
right = 8,
|
||||
|
||||
start_cell = top | bottom | left,
|
||||
end_cell = top | bottom | right,
|
||||
middle_cell = top | bottom,
|
||||
default_cell = top | bottom | left | right
|
||||
};
|
||||
|
||||
enum button_flags
|
||||
{
|
||||
_default = 0,
|
||||
_return = 1,
|
||||
_space = 2
|
||||
};
|
||||
|
||||
struct cell
|
||||
{
|
||||
position2u pos;
|
||||
color4f backcolor{};
|
||||
border_flags flags = default_cell;
|
||||
bool selected = false;
|
||||
bool enabled = false;
|
||||
|
||||
std::vector<std::u32string> outputs;
|
||||
callback_t callback;
|
||||
};
|
||||
|
||||
struct grid_entry_ctor
|
||||
{
|
||||
std::vector<std::u32string> outputs;
|
||||
color4f color;
|
||||
u32 num_cell_hz;
|
||||
button_flags type_flags;
|
||||
callback_t callback;
|
||||
};
|
||||
|
||||
// Base UI
|
||||
overlay_element m_frame;
|
||||
overlay_element m_background;
|
||||
label m_title;
|
||||
edit_text m_preview;
|
||||
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;
|
||||
u32 cell_size_y = 0;
|
||||
u32 num_columns = 0;
|
||||
u32 num_rows = 0;
|
||||
u32 num_layers = 0;
|
||||
u32 selected_x = 0;
|
||||
u32 selected_y = 0;
|
||||
u32 selected_z = 0;
|
||||
|
||||
std::vector<cell> m_grid;
|
||||
|
||||
// Fade in/out
|
||||
animation_color_interpolate fade_animation;
|
||||
|
||||
bool m_update = true;
|
||||
compiled_resource m_cached_resource;
|
||||
|
||||
u32 flags = 0;
|
||||
u32 char_limit = UINT32_MAX;
|
||||
|
||||
osk_dialog() = default;
|
||||
~osk_dialog() override = default;
|
||||
|
||||
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 options) override = 0;
|
||||
void Close(bool ok) override;
|
||||
|
||||
void initialize_layout(const std::vector<grid_entry_ctor>& layout, const std::u32string& title, const std::u32string& initial_text);
|
||||
void update() override;
|
||||
|
||||
void on_button_pressed(pad_button button_press) override;
|
||||
void on_text_changed();
|
||||
|
||||
void on_default_callback(const std::u32string&);
|
||||
void on_shift(const std::u32string&);
|
||||
void on_space(const std::u32string&);
|
||||
void on_backspace(const std::u32string&);
|
||||
void on_enter(const std::u32string&);
|
||||
|
||||
compiled_resource get_compiled() override;
|
||||
};
|
||||
|
||||
struct osk_latin : osk_dialog
|
||||
{
|
||||
using osk_dialog::osk_dialog;
|
||||
|
||||
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 options) override;
|
||||
};
|
||||
|
||||
struct save_dialog : public user_interface
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -422,6 +422,7 @@
|
|||
<ClInclude Include="Emu\Io\pad_config_types.h" />
|
||||
<ClInclude Include="Emu\RSX\Common\texture_cache_helpers.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_fonts.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_osk.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_perf_metrics.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_utils.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\Shaders\shader_loading_dialog.h" />
|
||||
|
|
|
@ -1714,5 +1714,8 @@
|
|||
<ClInclude Include="Emu\Io\pad_types.h">
|
||||
<Filter>Emu\Io</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_osk.h">
|
||||
<Filter>Emu\GPU\RSX\Overlays</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Add table
Reference in a new issue