mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 01:38:37 +12:00
overlays/osk: Add linear fade-in/out effect to OSK
This commit is contained in:
parent
ecf00be155
commit
3f34a0196c
2 changed files with 38 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "overlays.h"
|
||||
#include "Emu/RSX/RSXThread.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
|
@ -7,16 +8,25 @@ namespace rsx
|
|||
{
|
||||
void osk_dialog::Close(bool ok)
|
||||
{
|
||||
if (on_osk_close)
|
||||
{
|
||||
Emu.CallAfter([this, ok]()
|
||||
{
|
||||
on_osk_close(ok ? CELL_MSGDIALOG_BUTTON_OK : CELL_MSGDIALOG_BUTTON_ESCAPE);
|
||||
});
|
||||
}
|
||||
fade_animation.current = color4f(1.f);
|
||||
fade_animation.end = color4f(0.f);
|
||||
fade_animation.duration = 0.5f;
|
||||
|
||||
m_visible = false;
|
||||
close();
|
||||
fade_animation.on_finish = [this, ok]
|
||||
{
|
||||
if (on_osk_close)
|
||||
{
|
||||
Emu.CallAfter([this, ok]()
|
||||
{
|
||||
on_osk_close(ok ? CELL_MSGDIALOG_BUTTON_OK : CELL_MSGDIALOG_BUTTON_ESCAPE);
|
||||
});
|
||||
}
|
||||
|
||||
m_visible = false;
|
||||
close();
|
||||
};
|
||||
|
||||
fade_animation.active = true;
|
||||
}
|
||||
|
||||
void osk_dialog::initialize_layout(const std::vector<grid_entry_ctor>& layout, const std::string& title, const std::string& initial_text)
|
||||
|
@ -172,6 +182,11 @@ namespace rsx
|
|||
m_update = true;
|
||||
exit = false;
|
||||
|
||||
fade_animation.current = color4f(0.f);
|
||||
fade_animation.end = color4f(1.f);
|
||||
fade_animation.duration = 0.5f;
|
||||
fade_animation.active = true;
|
||||
|
||||
thread_ctrl::spawn("osk input thread", [this]
|
||||
{
|
||||
if (auto error = run_input_loop())
|
||||
|
@ -469,6 +484,15 @@ namespace rsx
|
|||
}
|
||||
}
|
||||
|
||||
void osk_dialog::update()
|
||||
{
|
||||
if (fade_animation.active)
|
||||
{
|
||||
fade_animation.update(rsx::get_current_renderer()->vblank_count);
|
||||
m_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
compiled_resource osk_dialog::get_compiled()
|
||||
{
|
||||
if (!m_visible)
|
||||
|
@ -565,6 +589,7 @@ namespace rsx
|
|||
m_update = false;
|
||||
}
|
||||
|
||||
fade_animation.apply(m_cached_resource);
|
||||
return m_cached_resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -394,6 +394,9 @@ namespace rsx
|
|||
|
||||
std::vector<cell> m_grid;
|
||||
|
||||
// Fade in/out
|
||||
animation_color_interpolate fade_animation;
|
||||
|
||||
bool m_visible = false;
|
||||
bool m_update = true;
|
||||
compiled_resource m_cached_resource;
|
||||
|
@ -408,6 +411,7 @@ namespace rsx
|
|||
void Close(bool ok) override;
|
||||
|
||||
void initialize_layout(const std::vector<grid_entry_ctor>& layout, const std::string& title, const std::string& initial_text);
|
||||
void update() override;
|
||||
|
||||
void on_button_pressed(pad_button button_press) override;
|
||||
void on_text_changed();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue