FullscreenUI: Redo landing page and add help bar
This commit is contained in:
parent
d4d7a13fed
commit
bf4e8feb25
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
|
@ -1725,16 +1725,7 @@ void Achievements::ShowLoginNotification()
|
|||
|
||||
if (g_settings.achievements_notifications && FullscreenUI::Initialize())
|
||||
{
|
||||
std::string badge_path = GetUserBadgePath(user->username);
|
||||
if (!FileSystem::FileExists(badge_path.c_str()))
|
||||
{
|
||||
char url[512];
|
||||
const int res = rc_client_user_get_image_url(user, url, std::size(url));
|
||||
if (res == RC_OK)
|
||||
DownloadImage(url, badge_path);
|
||||
else
|
||||
ReportRCError(res, "rc_client_user_get_image_url() failed: ");
|
||||
}
|
||||
std::string badge_path = GetLoggedInUserBadgePath();
|
||||
|
||||
//: Summary for login notification.
|
||||
std::string title = user->display_name;
|
||||
|
@ -1746,6 +1737,37 @@ void Achievements::ShowLoginNotification()
|
|||
}
|
||||
}
|
||||
|
||||
const char* Achievements::GetLoggedInUserName()
|
||||
{
|
||||
const rc_client_user_t* user = rc_client_get_user_info(s_client);
|
||||
if (!user) [[unlikely]]
|
||||
return nullptr;
|
||||
|
||||
return user->username;
|
||||
}
|
||||
|
||||
std::string Achievements::GetLoggedInUserBadgePath()
|
||||
{
|
||||
std::string badge_path;
|
||||
|
||||
const rc_client_user_t* user = rc_client_get_user_info(s_client);
|
||||
if (!user) [[unlikely]]
|
||||
return badge_path;
|
||||
|
||||
badge_path = GetUserBadgePath(user->username);
|
||||
if (!FileSystem::FileExists(badge_path.c_str())) [[unlikely]]
|
||||
{
|
||||
char url[512];
|
||||
const int res = rc_client_user_get_image_url(user, url, std::size(url));
|
||||
if (res == RC_OK)
|
||||
DownloadImage(url, badge_path);
|
||||
else
|
||||
ReportRCError(res, "rc_client_user_get_image_url() failed: ");
|
||||
}
|
||||
|
||||
return badge_path;
|
||||
}
|
||||
|
||||
void Achievements::Logout()
|
||||
{
|
||||
if (IsActive())
|
||||
|
@ -2290,6 +2312,8 @@ void Achievements::DrawAchievementsWindow()
|
|||
ImGuiFullscreen::EndMenuButtons();
|
||||
}
|
||||
ImGuiFullscreen::EndFullscreenWindow();
|
||||
|
||||
FullscreenUI::SetStandardSelectionFooterText(true);
|
||||
}
|
||||
|
||||
void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
||||
|
@ -2705,6 +2729,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
}
|
||||
}
|
||||
ImGuiFullscreen::EndFullscreenWindow();
|
||||
FullscreenUI::SetStandardSelectionFooterText(true);
|
||||
|
||||
if (!is_leaderboard_open)
|
||||
{
|
||||
|
|
|
@ -119,6 +119,13 @@ const std::string& GetRichPresenceString();
|
|||
/// Should be called with the lock held.
|
||||
const std::string& GetGameTitle();
|
||||
|
||||
/// Returns the logged-in user name.
|
||||
const char* GetLoggedInUserName();
|
||||
|
||||
/// Returns the path to the user's profile avatar.
|
||||
/// Should be called with the lock held.
|
||||
std::string GetLoggedInUserBadgePath();
|
||||
|
||||
/// Clears all cached state used to render the UI.
|
||||
void ClearUIState();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,6 +34,7 @@ void OpenLeaderboardsWindow();
|
|||
bool IsLeaderboardsWindowOpen();
|
||||
void ReturnToMainWindow();
|
||||
void ReturnToPreviousWindow();
|
||||
void SetStandardSelectionFooterText(bool back_instead_of_cancel);
|
||||
#endif
|
||||
|
||||
void Shutdown();
|
||||
|
@ -45,5 +46,13 @@ void TimeToPrintableString(SmallStringBase* str, time_t t);
|
|||
|
||||
// Host UI triggers from Big Picture mode.
|
||||
namespace Host {
|
||||
/// Requests shut down and exit of the hosting application. This may not actually exit,
|
||||
/// if the user cancels the shutdown confirmation.
|
||||
void RequestExitApplication(bool allow_confirm);
|
||||
|
||||
/// Requests Big Picture mode to be shut down, returning to the desktop interface.
|
||||
void RequestExitBigPicture();
|
||||
|
||||
/// Requests the cover downloader be opened.
|
||||
void OnCoverDownloaderOpenRequested();
|
||||
} // namespace Host
|
||||
|
|
|
@ -94,10 +94,6 @@ void DisplayLoadingScreen(const char* message, int progress_min = -1, int progre
|
|||
/// Safely executes a function on the VM thread.
|
||||
void RunOnCPUThread(std::function<void()> function, bool block = false);
|
||||
|
||||
/// Requests shut down and exit of the hosting application. This may not actually exit,
|
||||
/// if the user cancels the shutdown confirmation.
|
||||
void RequestExit(bool allow_confirm);
|
||||
|
||||
/// Attempts to create the rendering device backend.
|
||||
bool CreateGPUDevice(RenderAPI api);
|
||||
|
||||
|
|
|
@ -696,8 +696,7 @@ void EmuThread::stopFullscreenUI()
|
|||
return;
|
||||
}
|
||||
|
||||
if (System::IsValid())
|
||||
shutdownSystem();
|
||||
setFullscreen(false, true);
|
||||
|
||||
if (m_run_fullscreen_ui)
|
||||
{
|
||||
|
@ -1864,11 +1863,16 @@ void Host::RequestSystemShutdown(bool allow_confirm, bool save_state)
|
|||
Q_ARG(bool, true), Q_ARG(bool, save_state));
|
||||
}
|
||||
|
||||
void Host::RequestExit(bool allow_confirm)
|
||||
void Host::RequestExitApplication(bool allow_confirm)
|
||||
{
|
||||
QMetaObject::invokeMethod(g_main_window, "requestExit", Qt::QueuedConnection, Q_ARG(bool, allow_confirm));
|
||||
}
|
||||
|
||||
void Host::RequestExitBigPicture()
|
||||
{
|
||||
g_emu_thread->stopFullscreenUI();
|
||||
}
|
||||
|
||||
std::optional<WindowInfo> Host::GetTopLevelWindowInfo()
|
||||
{
|
||||
std::optional<WindowInfo> ret;
|
||||
|
|
|
@ -299,7 +299,12 @@ void Host::RequestResizeHostDisplay(s32 width, s32 height)
|
|||
//
|
||||
}
|
||||
|
||||
void Host::RequestExit(bool save_state_if_running)
|
||||
void Host::RequestExitApplication(bool save_state_if_running)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
void Host::RequestExitBigPicture()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
|
@ -292,7 +292,12 @@ bool PNGFileLoader(RGBA8Image* image, const char* filename, std::FILE* fp)
|
|||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
return false;
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
png_set_read_fn(png_ptr, fp, [](png_structp png_ptr, png_bytep data_ptr, png_size_t size) {
|
||||
std::FILE* fp = static_cast<std::FILE*>(png_get_io_ptr(png_ptr));
|
||||
if (std::fread(data_ptr, size, 1, fp) != 1)
|
||||
png_error(png_ptr, "Read error");
|
||||
});
|
||||
|
||||
return PNGCommonLoader(image, png_ptr, info_ptr, new_data, row_pointers);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,10 @@ static std::deque<std::string> s_texture_load_queue;
|
|||
static std::deque<std::pair<std::string, RGBA8Image>> s_texture_upload_queue;
|
||||
static std::thread s_texture_load_thread;
|
||||
|
||||
static SmallString s_fullscreen_footer_text;
|
||||
static SmallString s_last_fullscreen_footer_text;
|
||||
static float s_fullscreen_text_change_time;
|
||||
|
||||
static bool s_choice_dialog_open = false;
|
||||
static bool s_choice_dialog_checkable = false;
|
||||
static std::string s_choice_dialog_title;
|
||||
|
@ -245,6 +249,9 @@ void ImGuiFullscreen::Shutdown()
|
|||
|
||||
s_notifications.clear();
|
||||
s_background_progress_dialogs.clear();
|
||||
s_fullscreen_footer_text.clear();
|
||||
s_last_fullscreen_footer_text.clear();
|
||||
s_fullscreen_text_change_time = 0.0f;
|
||||
CloseInputDialog();
|
||||
CloseMessageDialog();
|
||||
s_choice_dialog_open = false;
|
||||
|
@ -262,6 +269,11 @@ void ImGuiFullscreen::Shutdown()
|
|||
s_file_selector_current_directory = {};
|
||||
s_file_selector_filters.clear();
|
||||
s_file_selector_items.clear();
|
||||
s_message_dialog_open = false;
|
||||
s_message_dialog_title = {};
|
||||
s_message_dialog_message = {};
|
||||
s_message_dialog_buttons = {};
|
||||
s_message_dialog_callback = {};
|
||||
}
|
||||
|
||||
const std::shared_ptr<GPUTexture>& ImGuiFullscreen::GetPlaceholderTexture()
|
||||
|
@ -499,6 +511,8 @@ void ImGuiFullscreen::EndLayout()
|
|||
DrawInputDialog();
|
||||
DrawMessageDialog();
|
||||
|
||||
DrawFullscreenFooter();
|
||||
|
||||
const float notification_margin = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
const float notification_vertical_pos = GetNotificationVerticalPosition();
|
||||
|
@ -511,6 +525,8 @@ void ImGuiFullscreen::EndLayout()
|
|||
|
||||
PopResetLayout();
|
||||
|
||||
s_fullscreen_footer_text.clear();
|
||||
|
||||
s_rendered_menu_item_border = false;
|
||||
s_had_hovered_menu_item = std::exchange(s_has_hovered_menu_item, false);
|
||||
}
|
||||
|
@ -558,6 +574,10 @@ bool ImGuiFullscreen::ResetFocusHere()
|
|||
if (!s_focus_reset_queued)
|
||||
return false;
|
||||
|
||||
// don't take focus from dialogs
|
||||
if (ImGui::FindBlockingModal(ImGui::GetCurrentWindow()))
|
||||
return false;
|
||||
|
||||
s_focus_reset_queued = false;
|
||||
ImGui::SetWindowFocus();
|
||||
|
||||
|
@ -565,6 +585,20 @@ bool ImGuiFullscreen::ResetFocusHere()
|
|||
return (GImGui->NavInputSource == ImGuiInputSource_Keyboard || GImGui->NavInputSource == ImGuiInputSource_Gamepad);
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::IsFocusResetQueued()
|
||||
{
|
||||
return s_focus_reset_queued;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::ForceKeyNavEnabled()
|
||||
{
|
||||
ImGuiContext& g = *ImGui::GetCurrentContext();
|
||||
g.ActiveIdSource = (g.ActiveIdSource == ImGuiInputSource_Mouse) ? ImGuiInputSource_Keyboard : g.ActiveIdSource;
|
||||
g.NavInputSource = (g.NavInputSource == ImGuiInputSource_Mouse) ? ImGuiInputSource_Keyboard : g.ActiveIdSource;
|
||||
g.NavDisableHighlight = false;
|
||||
g.NavDisableMouseHover = true;
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::WantsToCloseMenu()
|
||||
{
|
||||
// Wait for the Close button to be released, THEN pressed
|
||||
|
@ -606,12 +640,12 @@ void ImGuiFullscreen::PopPrimaryColor()
|
|||
ImGui::PopStyleColor(5);
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::BeginFullscreenColumns(const char* title, float pos_y, bool expand_to_screen_width)
|
||||
bool ImGuiFullscreen::BeginFullscreenColumns(const char* title, float pos_y, bool expand_to_screen_width, bool footer)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(expand_to_screen_width ? 0.0f : g_layout_padding_left, pos_y));
|
||||
ImGui::SetNextWindowSize(
|
||||
ImVec2(expand_to_screen_width ? ImGui::GetIO().DisplaySize.x : LayoutScale(LAYOUT_SCREEN_WIDTH),
|
||||
ImGui::GetIO().DisplaySize.y - pos_y));
|
||||
ImGui::GetIO().DisplaySize.y - pos_y - (footer ? LayoutScale(LAYOUT_FOOTER_HEIGHT) : 0.0f)));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
|
@ -705,14 +739,103 @@ void ImGuiFullscreen::EndFullscreenWindow()
|
|||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::IsGamepadInputSource()
|
||||
{
|
||||
return (ImGui::GetCurrentContext()->NavInputSource == ImGuiInputSource_Gamepad);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::CreateFooterTextString(SmallStringBase& dest,
|
||||
std::span<const std::pair<const char*, std::string_view>> items)
|
||||
{
|
||||
dest.clear();
|
||||
for (const auto& [icon, text] : items)
|
||||
{
|
||||
if (!dest.empty())
|
||||
dest.append(" ");
|
||||
|
||||
dest.append(icon);
|
||||
dest.append(' ');
|
||||
dest.append(text);
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::SetFullscreenFooterText(std::string_view text)
|
||||
{
|
||||
s_fullscreen_footer_text.assign(text);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::SetFullscreenFooterText(std::span<const std::pair<const char*, std::string_view>> items)
|
||||
{
|
||||
CreateFooterTextString(s_fullscreen_footer_text, items);
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::DrawFullscreenFooter()
|
||||
{
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
if (s_fullscreen_footer_text.empty())
|
||||
{
|
||||
s_last_fullscreen_footer_text.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
const float padding = LayoutScale(LAYOUT_FOOTER_PADDING);
|
||||
const float height = LayoutScale(LAYOUT_FOOTER_HEIGHT);
|
||||
|
||||
ImDrawList* dl = ImGui::GetForegroundDrawList();
|
||||
dl->AddRectFilled(ImVec2(0.0f, io.DisplaySize.y - height), io.DisplaySize, ImGui::GetColorU32(UIPrimaryColor), 0.0f);
|
||||
|
||||
ImFont* const font = g_medium_font;
|
||||
const float max_width = io.DisplaySize.x - padding * 2.0f;
|
||||
|
||||
float prev_opacity = 0.0f;
|
||||
if (!s_last_fullscreen_footer_text.empty() && s_fullscreen_footer_text != s_last_fullscreen_footer_text)
|
||||
{
|
||||
if (s_fullscreen_text_change_time == 0.0f)
|
||||
s_fullscreen_text_change_time = 0.15f;
|
||||
else
|
||||
s_fullscreen_text_change_time = std::max(s_fullscreen_text_change_time - io.DeltaTime, 0.0f);
|
||||
|
||||
if (s_fullscreen_text_change_time == 0.0f)
|
||||
s_last_fullscreen_footer_text = s_fullscreen_footer_text;
|
||||
|
||||
prev_opacity = s_fullscreen_text_change_time * (1.0f / 0.15f);
|
||||
if (prev_opacity > 0.0f)
|
||||
{
|
||||
const ImVec2 text_size =
|
||||
font->CalcTextSizeA(font->FontSize, max_width, 0.0f, s_last_fullscreen_footer_text.c_str(),
|
||||
s_last_fullscreen_footer_text.end_ptr());
|
||||
dl->AddText(
|
||||
font, font->FontSize,
|
||||
ImVec2(io.DisplaySize.x - padding * 2.0f - text_size.x, io.DisplaySize.y - font->FontSize - padding),
|
||||
ImGui::GetColorU32(ImVec4(UIPrimaryTextColor.x, UIPrimaryTextColor.y, UIPrimaryTextColor.z, prev_opacity)),
|
||||
s_last_fullscreen_footer_text.c_str(), s_last_fullscreen_footer_text.end_ptr());
|
||||
}
|
||||
}
|
||||
else if (s_last_fullscreen_footer_text.empty())
|
||||
{
|
||||
s_last_fullscreen_footer_text = s_fullscreen_footer_text;
|
||||
}
|
||||
|
||||
if (prev_opacity < 1.0f)
|
||||
{
|
||||
const ImVec2 text_size = font->CalcTextSizeA(font->FontSize, max_width, 0.0f, s_fullscreen_footer_text.c_str(),
|
||||
s_fullscreen_footer_text.end_ptr());
|
||||
dl->AddText(
|
||||
font, font->FontSize,
|
||||
ImVec2(io.DisplaySize.x - padding * 2.0f - text_size.x, io.DisplaySize.y - font->FontSize - padding),
|
||||
ImGui::GetColorU32(ImVec4(UIPrimaryTextColor.x, UIPrimaryTextColor.y, UIPrimaryTextColor.z, 1.0f - prev_opacity)),
|
||||
s_fullscreen_footer_text.c_str(), s_fullscreen_footer_text.end_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::PrerenderMenuButtonBorder()
|
||||
{
|
||||
if (!s_had_hovered_menu_item)
|
||||
return;
|
||||
|
||||
// updating might finish the animation
|
||||
const ImVec2 min = s_menu_button_frame_min_animated.UpdateAndGetValue();
|
||||
const ImVec2 max = s_menu_button_frame_max_animated.UpdateAndGetValue();
|
||||
const ImVec2& min = s_menu_button_frame_min_animated.UpdateAndGetValue();
|
||||
const ImVec2& max = s_menu_button_frame_max_animated.UpdateAndGetValue();
|
||||
const ImU32 col = ImGui::GetColorU32(ImGuiCol_ButtonHovered);
|
||||
|
||||
const float t = static_cast<float>(std::min(std::abs(std::sin(ImGui::GetTime() * 0.75) * 1.1), 1.0));
|
||||
|
@ -874,7 +997,7 @@ void ImGuiFullscreen::DrawMenuButtonFrame(const ImVec2& p_min, const ImVec2& p_m
|
|||
MENU_BACKGROUND_ANIMATION_TIME);
|
||||
}
|
||||
if (frame_max.x != s_menu_button_frame_max_animated.GetEndValue().x ||
|
||||
frame_max.y != s_menu_button_frame_max_animated.GetEndValue().x)
|
||||
frame_max.y != s_menu_button_frame_max_animated.GetEndValue().y)
|
||||
{
|
||||
s_menu_button_frame_max_animated.Start(s_menu_button_frame_max_animated.GetCurrentValue(), frame_max,
|
||||
MENU_BACKGROUND_ANIMATION_TIME);
|
||||
|
@ -1794,6 +1917,100 @@ bool ImGuiFullscreen::NavTab(const char* title, bool is_active, bool enabled /*
|
|||
return pressed;
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::BeginHorizontalMenu(const char* name, const ImVec2& position, const ImVec2& size, u32 num_items)
|
||||
{
|
||||
s_menu_button_index = 0;
|
||||
|
||||
const float item_padding = LayoutScale(LAYOUT_HORIZONTAL_MENU_PADDING);
|
||||
const float item_width = LayoutScale(LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH);
|
||||
const float item_spacing = LayoutScale(30.0f);
|
||||
const float menu_width = static_cast<float>(num_items) * (item_width + item_spacing) - item_spacing;
|
||||
const float menu_height = LayoutScale(LAYOUT_HORIZONTAL_MENU_HEIGHT);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(item_padding, item_padding));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(item_spacing, 0.0f));
|
||||
|
||||
if (!BeginFullscreenWindow(position, size, name, UIBackgroundColor, 0.0f, 0.0f))
|
||||
return false;
|
||||
|
||||
ImGui::SetCursorPos(ImVec2((size.x - menu_width) * 0.5f, (size.y - menu_height) * 0.5f));
|
||||
|
||||
PrerenderMenuButtonBorder();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::EndHorizontalMenu()
|
||||
{
|
||||
ImGui::PopStyleVar(4);
|
||||
EndFullscreenWindow();
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::HorizontalMenuItem(GPUTexture* icon, const char* title, const char* description)
|
||||
{
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
|
||||
const ImVec2 pos = window->DC.CursorPos;
|
||||
const ImVec2 size = LayoutScale(LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH, LAYOUT_HORIZONTAL_MENU_HEIGHT);
|
||||
ImRect bb = ImRect(pos, pos + size);
|
||||
|
||||
const ImGuiID id = window->GetID(title);
|
||||
ImGui::ItemSize(size);
|
||||
if (!ImGui::ItemAdd(bb, id))
|
||||
return false;
|
||||
|
||||
bool held;
|
||||
bool hovered;
|
||||
const bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, 0);
|
||||
if (hovered)
|
||||
{
|
||||
const ImU32 col = ImGui::GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered, 1.0f);
|
||||
|
||||
const float t = static_cast<float>(std::min(std::abs(std::sin(ImGui::GetTime() * 0.75) * 1.1), 1.0));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImGui::GetColorU32(ImGuiCol_Border, t));
|
||||
|
||||
DrawMenuButtonFrame(bb.Min, bb.Max, col, true, 0.0f);
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
bb.Min += style.FramePadding;
|
||||
bb.Max -= style.FramePadding;
|
||||
|
||||
const float avail_width = bb.Max.x - bb.Min.x;
|
||||
const float icon_size = LayoutScale(150.0f);
|
||||
const ImVec2 icon_pos = bb.Min + ImVec2((avail_width - icon_size) * 0.5f, 0.0f);
|
||||
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
dl->AddImage(reinterpret_cast<ImTextureID>(icon), icon_pos, icon_pos + ImVec2(icon_size, icon_size));
|
||||
|
||||
ImFont* title_font = g_large_font;
|
||||
const ImVec2 title_size = title_font->CalcTextSizeA(title_font->FontSize, avail_width, 0.0f, title);
|
||||
const ImVec2 title_pos =
|
||||
ImVec2(bb.Min.x + (avail_width - title_size.x) * 0.5f, icon_pos.y + icon_size + LayoutScale(10.0f));
|
||||
const ImVec4 title_bb = ImVec4(title_pos.x, title_pos.y, title_pos.x + title_size.x, title_pos.y + title_size.y);
|
||||
|
||||
dl->AddText(title_font, title_font->FontSize, title_pos, ImGui::GetColorU32(ImGuiCol_Text), title, nullptr, 0.0f,
|
||||
&title_bb);
|
||||
|
||||
ImFont* desc_font = g_medium_font;
|
||||
const ImVec2 desc_size = desc_font->CalcTextSizeA(desc_font->FontSize, avail_width, avail_width, description);
|
||||
const ImVec2 desc_pos = ImVec2(bb.Min.x + (avail_width - desc_size.x) * 0.5f, title_bb.w + LayoutScale(10.0f));
|
||||
const ImVec4 desc_bb = ImVec4(desc_pos.x, desc_pos.y, desc_pos.x + desc_size.x, desc_pos.y + desc_size.y);
|
||||
|
||||
dl->AddText(desc_font, desc_font->FontSize, desc_pos, ImGui::GetColorU32(ImGuiCol_Text), description, nullptr,
|
||||
avail_width, &desc_bb);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
s_menu_button_index++;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
{
|
||||
s_file_selector_items.clear();
|
||||
|
@ -1869,7 +2086,7 @@ bool ImGuiFullscreen::IsFileSelectorOpen()
|
|||
return s_file_selector_open;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenFileSelector(const char* title, bool select_directory, FileSelectorCallback callback,
|
||||
void ImGuiFullscreen::OpenFileSelector(std::string_view title, bool select_directory, FileSelectorCallback callback,
|
||||
FileSelectorFilters filters, std::string initial_directory)
|
||||
{
|
||||
if (s_file_selector_open)
|
||||
|
@ -1884,6 +2101,7 @@ void ImGuiFullscreen::OpenFileSelector(const char* title, bool select_directory,
|
|||
if (initial_directory.empty() || !FileSystem::DirectoryExists(initial_directory.c_str()))
|
||||
initial_directory = FileSystem::GetWorkingDirectory();
|
||||
SetFileSelectorDirectory(std::move(initial_directory));
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::CloseFileSelector()
|
||||
|
@ -1931,6 +2149,7 @@ void ImGuiFullscreen::DrawFileSelector()
|
|||
ImGui::PushStyleColor(ImGuiCol_Text, UIBackgroundTextColor);
|
||||
|
||||
BeginMenuButtons();
|
||||
ResetFocusHere();
|
||||
|
||||
if (!s_file_selector_current_directory.empty())
|
||||
{
|
||||
|
@ -1965,6 +2184,9 @@ void ImGuiFullscreen::DrawFileSelector()
|
|||
ImGui::PopStyleVar(3);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (is_open)
|
||||
GetFileSelectorHelpText(s_fullscreen_footer_text);
|
||||
|
||||
if (selected)
|
||||
{
|
||||
if (selected->is_file)
|
||||
|
@ -1974,6 +2196,7 @@ void ImGuiFullscreen::DrawFileSelector()
|
|||
else
|
||||
{
|
||||
SetFileSelectorDirectory(std::move(selected->full_path));
|
||||
QueueResetFocus();
|
||||
}
|
||||
}
|
||||
else if (directory_selected)
|
||||
|
@ -1986,6 +2209,18 @@ void ImGuiFullscreen::DrawFileSelector()
|
|||
s_file_selector_callback(no_path);
|
||||
CloseFileSelector();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Backspace, false) || ImGui::IsKeyPressed(ImGuiKey_NavGamepadMenu, false))
|
||||
{
|
||||
if (!s_file_selector_items.empty() && s_file_selector_items.front().display_name == ICON_FA_FOLDER_OPEN
|
||||
" <Parent Directory>")
|
||||
{
|
||||
SetFileSelectorDirectory(std::move(s_file_selector_items.front().full_path));
|
||||
QueueResetFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::IsChoiceDialogOpen()
|
||||
|
@ -1993,7 +2228,7 @@ bool ImGuiFullscreen::IsChoiceDialogOpen()
|
|||
return s_choice_dialog_open;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenChoiceDialog(const char* title, bool checkable, ChoiceDialogOptions options,
|
||||
void ImGuiFullscreen::OpenChoiceDialog(std::string_view title, bool checkable, ChoiceDialogOptions options,
|
||||
ChoiceDialogCallback callback)
|
||||
{
|
||||
if (s_choice_dialog_open)
|
||||
|
@ -2004,6 +2239,7 @@ void ImGuiFullscreen::OpenChoiceDialog(const char* title, bool checkable, Choice
|
|||
s_choice_dialog_title = fmt::format("{}##choice_dialog", title);
|
||||
s_choice_dialog_options = std::move(options);
|
||||
s_choice_dialog_callback = std::move(callback);
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::CloseChoiceDialog()
|
||||
|
@ -2054,6 +2290,7 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
|||
ImGui::PushStyleColor(ImGuiCol_Text, UIBackgroundTextColor);
|
||||
|
||||
BeginMenuButtons();
|
||||
ResetFocusHere();
|
||||
|
||||
if (s_choice_dialog_checkable)
|
||||
{
|
||||
|
@ -2115,6 +2352,10 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
|||
s_choice_dialog_callback(-1, no_string, false);
|
||||
CloseChoiceDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
GetChoiceDialogHelpText(s_fullscreen_footer_text);
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGuiFullscreen::IsInputDialogOpen()
|
||||
|
@ -2131,6 +2372,7 @@ void ImGuiFullscreen::OpenInputStringDialog(std::string title, std::string messa
|
|||
s_input_dialog_caption = std::move(caption);
|
||||
s_input_dialog_ok_text = std::move(ok_button_text);
|
||||
s_input_dialog_callback = std::move(callback);
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::DrawInputDialog()
|
||||
|
@ -2157,6 +2399,7 @@ void ImGuiFullscreen::DrawInputDialog()
|
|||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_NoMove))
|
||||
{
|
||||
ResetFocusHere();
|
||||
ImGui::TextWrapped("%s", s_input_dialog_message.c_str());
|
||||
|
||||
BeginMenuButtons();
|
||||
|
@ -2202,6 +2445,8 @@ void ImGuiFullscreen::DrawInputDialog()
|
|||
}
|
||||
if (!is_open)
|
||||
CloseInputDialog();
|
||||
else
|
||||
GetInputDialogHelpText(s_fullscreen_footer_text);
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
@ -2239,6 +2484,7 @@ void ImGuiFullscreen::OpenConfirmMessageDialog(std::string title, std::string me
|
|||
s_message_dialog_callback = std::move(callback);
|
||||
s_message_dialog_buttons[0] = std::move(yes_button_text);
|
||||
s_message_dialog_buttons[1] = std::move(no_button_text);
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenInfoMessageDialog(std::string title, std::string message, InfoMessageDialogCallback callback,
|
||||
|
@ -2251,6 +2497,7 @@ void ImGuiFullscreen::OpenInfoMessageDialog(std::string title, std::string messa
|
|||
s_message_dialog_message = std::move(message);
|
||||
s_message_dialog_callback = std::move(callback);
|
||||
s_message_dialog_buttons[0] = std::move(button_text);
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::OpenMessageDialog(std::string title, std::string message, MessageDialogCallback callback,
|
||||
|
@ -2266,6 +2513,7 @@ void ImGuiFullscreen::OpenMessageDialog(std::string title, std::string message,
|
|||
s_message_dialog_buttons[0] = std::move(first_button_text);
|
||||
s_message_dialog_buttons[1] = std::move(second_button_text);
|
||||
s_message_dialog_buttons[2] = std::move(third_button_text);
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::CloseMessageDialog()
|
||||
|
@ -2278,6 +2526,7 @@ void ImGuiFullscreen::CloseMessageDialog()
|
|||
s_message_dialog_message = {};
|
||||
s_message_dialog_buttons = {};
|
||||
s_message_dialog_callback = {};
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::DrawMessageDialog()
|
||||
|
@ -2310,6 +2559,7 @@ void ImGuiFullscreen::DrawMessageDialog()
|
|||
if (ImGui::BeginPopupModal(win_id, &is_open, flags))
|
||||
{
|
||||
BeginMenuButtons();
|
||||
QueueResetFocus();
|
||||
|
||||
ImGui::TextWrapped("%s", s_message_dialog_message.c_str());
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(20.0f));
|
||||
|
@ -2352,6 +2602,10 @@ void ImGuiFullscreen::DrawMessageDialog()
|
|||
func(result.value_or(1) == 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetChoiceDialogHelpText(s_fullscreen_footer_text);
|
||||
}
|
||||
}
|
||||
|
||||
static float s_notification_vertical_position = 0.15f;
|
||||
|
@ -2719,7 +2973,7 @@ void ImGuiFullscreen::DrawToast()
|
|||
ImFont* message_font = g_medium_font;
|
||||
const float padding = LayoutScale(20.0f);
|
||||
const float total_padding = padding * 2.0f;
|
||||
const float margin = LayoutScale(20.0f);
|
||||
const float margin = LayoutScale(20.0f + (s_fullscreen_footer_text.empty() ? 0.0f : LAYOUT_FOOTER_HEIGHT));
|
||||
const float spacing = s_toast_title.empty() ? 0.0f : LayoutScale(10.0f);
|
||||
const ImVec2 display_size(ImGui::GetIO().DisplaySize);
|
||||
const ImVec2 title_size(s_toast_title.empty() ?
|
||||
|
@ -2743,7 +2997,7 @@ void ImGuiFullscreen::DrawToast()
|
|||
const float offset = (comb_size.x - title_size.x) * 0.5f;
|
||||
dl->AddText(title_font, title_font->FontSize, box_pos + ImVec2(offset + padding, padding),
|
||||
ImGui::GetColorU32(ModAlpha(UIPrimaryTextColor, alpha)), s_toast_title.c_str(),
|
||||
s_toast_title.c_str() + s_toast_title.length());
|
||||
s_toast_title.c_str() + s_toast_title.length(), max_width);
|
||||
}
|
||||
if (!s_toast_message.empty())
|
||||
{
|
||||
|
@ -2751,7 +3005,7 @@ void ImGuiFullscreen::DrawToast()
|
|||
dl->AddText(message_font, message_font->FontSize,
|
||||
box_pos + ImVec2(offset + padding, padding + spacing + title_size.y),
|
||||
ImGui::GetColorU32(ModAlpha(UIPrimaryTextColor, alpha)), s_toast_message.c_str(),
|
||||
s_toast_message.c_str() + s_toast_message.length());
|
||||
s_toast_message.c_str() + s_toast_message.length(), max_width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
|
@ -12,10 +12,14 @@
|
|||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class GPUTexture;
|
||||
class SmallStringBase;
|
||||
|
||||
namespace ImGuiFullscreen {
|
||||
#define HEX_TO_IMVEC4(hex, alpha) \
|
||||
|
@ -31,6 +35,11 @@ static constexpr float LAYOUT_MENU_BUTTON_HEIGHT = 50.0f;
|
|||
static constexpr float LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY = 26.0f;
|
||||
static constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.0f;
|
||||
static constexpr float LAYOUT_MENU_BUTTON_Y_PADDING = 10.0f;
|
||||
static constexpr float LAYOUT_FOOTER_PADDING = 10.0f;
|
||||
static constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.0f;
|
||||
static constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f;
|
||||
static constexpr float LAYOUT_HORIZONTAL_MENU_PADDING = 30.0f;
|
||||
static constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH = 250.0f;
|
||||
|
||||
extern ImFont* g_standard_font;
|
||||
extern ImFont* g_medium_font;
|
||||
|
@ -162,6 +171,9 @@ void PopResetLayout();
|
|||
|
||||
void QueueResetFocus();
|
||||
bool ResetFocusHere();
|
||||
bool IsFocusResetQueued();
|
||||
void ForceKeyNavEnabled();
|
||||
|
||||
bool WantsToCloseMenu();
|
||||
void ResetCloseMenuIfNeeded();
|
||||
|
||||
|
@ -170,7 +182,8 @@ void PopPrimaryColor();
|
|||
|
||||
void DrawWindowTitle(const char* title);
|
||||
|
||||
bool BeginFullscreenColumns(const char* title = nullptr, float pos_y = 0.0f, bool expand_to_screen_width = false);
|
||||
bool BeginFullscreenColumns(const char* title = nullptr, float pos_y = 0.0f, bool expand_to_screen_width = false,
|
||||
bool footer = false);
|
||||
void EndFullscreenColumns();
|
||||
|
||||
bool BeginFullscreenColumnWindow(float start, float end, const char* name,
|
||||
|
@ -185,6 +198,12 @@ bool BeginFullscreenWindow(const ImVec2& position, const ImVec2& size, const cha
|
|||
float padding = 0.0f, ImGuiWindowFlags flags = 0);
|
||||
void EndFullscreenWindow();
|
||||
|
||||
bool IsGamepadInputSource();
|
||||
void CreateFooterTextString(SmallStringBase& dest, std::span<const std::pair<const char*, std::string_view>> items);
|
||||
void SetFullscreenFooterText(std::string_view text);
|
||||
void SetFullscreenFooterText(std::span<const std::pair<const char*, std::string_view>> items);
|
||||
void DrawFullscreenFooter();
|
||||
|
||||
void PrerenderMenuButtonBorder();
|
||||
void BeginMenuButtons(u32 num_items = 0, float y_align = 0.0f, float x_padding = LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
float y_padding = LAYOUT_MENU_BUTTON_Y_PADDING, float item_height = LAYOUT_MENU_BUTTON_HEIGHT);
|
||||
|
@ -267,10 +286,14 @@ bool NavButton(const char* title, bool is_active, bool enabled = true, float wid
|
|||
bool NavTab(const char* title, bool is_active, bool enabled, float width, float height, const ImVec4& background,
|
||||
ImFont* font = g_large_font);
|
||||
|
||||
bool BeginHorizontalMenu(const char* name, const ImVec2& position, const ImVec2& size, u32 num_items);
|
||||
void EndHorizontalMenu();
|
||||
bool HorizontalMenuItem(GPUTexture* icon, const char* title, const char* description);
|
||||
|
||||
using FileSelectorCallback = std::function<void(const std::string& path)>;
|
||||
using FileSelectorFilters = std::vector<std::string>;
|
||||
bool IsFileSelectorOpen();
|
||||
void OpenFileSelector(const char* title, bool select_directory, FileSelectorCallback callback,
|
||||
void OpenFileSelector(std::string_view title, bool select_directory, FileSelectorCallback callback,
|
||||
FileSelectorFilters filters = FileSelectorFilters(),
|
||||
std::string initial_directory = std::string());
|
||||
void CloseFileSelector();
|
||||
|
@ -278,7 +301,8 @@ void CloseFileSelector();
|
|||
using ChoiceDialogCallback = std::function<void(s32 index, const std::string& title, bool checked)>;
|
||||
using ChoiceDialogOptions = std::vector<std::pair<std::string, bool>>;
|
||||
bool IsChoiceDialogOpen();
|
||||
void OpenChoiceDialog(const char* title, bool checkable, ChoiceDialogOptions options, ChoiceDialogCallback callback);
|
||||
void OpenChoiceDialog(std::string_view title, bool checkable, ChoiceDialogOptions options,
|
||||
ChoiceDialogCallback callback);
|
||||
void CloseChoiceDialog();
|
||||
|
||||
using InputStringDialogCallback = std::function<void(std::string text)>;
|
||||
|
@ -313,4 +337,9 @@ void ClearNotifications();
|
|||
|
||||
void ShowToast(std::string title, std::string message, float duration = 10.0f);
|
||||
void ClearToast();
|
||||
|
||||
// Message callbacks.
|
||||
void GetChoiceDialogHelpText(SmallStringBase& dest);
|
||||
void GetFileSelectorHelpText(SmallStringBase& dest);
|
||||
void GetInputDialogHelpText(SmallStringBase& dest);
|
||||
} // namespace ImGuiFullscreen
|
||||
|
|
|
@ -176,6 +176,7 @@ bool ImGuiManager::Initialize(float global_scale, bool show_osd_messages, Error*
|
|||
io.BackendFlags |= ImGuiBackendFlags_HasGamepad | ImGuiBackendFlags_RendererHasVtxOffset;
|
||||
io.BackendUsingLegacyKeyArrays = 0;
|
||||
io.BackendUsingLegacyNavInputArray = 0;
|
||||
io.KeyRepeatDelay = 0.5f;
|
||||
#ifndef __ANDROID__
|
||||
// Android has no keyboard, nor are we using ImGui for any actual user-interactable windows.
|
||||
io.ConfigFlags |=
|
||||
|
@ -562,22 +563,21 @@ bool ImGuiManager::AddIconFonts(float size)
|
|||
static constexpr ImWchar range_fa[] = {
|
||||
0xe086, 0xe086, 0xf002, 0xf002, 0xf005, 0xf005, 0xf007, 0xf007, 0xf00c, 0xf00e, 0xf011, 0xf011, 0xf013, 0xf013,
|
||||
0xf017, 0xf017, 0xf019, 0xf019, 0xf01c, 0xf01c, 0xf021, 0xf021, 0xf023, 0xf023, 0xf025, 0xf025, 0xf027, 0xf028,
|
||||
0xf02e, 0xf02e, 0xf030, 0xf030, 0xf03a, 0xf03a, 0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf059, 0xf059,
|
||||
0xf05e, 0xf05e, 0xf062, 0xf063, 0xf065, 0xf065, 0xf067, 0xf067, 0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078,
|
||||
0xf07b, 0xf07c, 0xf084, 0xf085, 0xf091, 0xf091, 0xf0a0, 0xf0a0, 0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c9,
|
||||
0xf0cb, 0xf0cb, 0xf0d0, 0xf0d0, 0xf0dc, 0xf0dc, 0xf0e2, 0xf0e2, 0xf0e7, 0xf0e7, 0xf0eb, 0xf0eb, 0xf0f1, 0xf0f1,
|
||||
0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe, 0xf110, 0xf110, 0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140, 0xf144, 0xf144,
|
||||
0xf14a, 0xf14a, 0xf15b, 0xf15b, 0xf15d, 0xf15d, 0xf188, 0xf188, 0xf191, 0xf192, 0xf1ab, 0xf1ab, 0xf1dd, 0xf1de,
|
||||
0xf1e6, 0xf1e6, 0xf1eb, 0xf1eb, 0xf1f8, 0xf1f8, 0xf1fc, 0xf1fc, 0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c,
|
||||
0xf279, 0xf279, 0xf2d0, 0xf2d0, 0xf2db, 0xf2db, 0xf2f2, 0xf2f2, 0xf2f5, 0xf2f5, 0xf3c1, 0xf3c1, 0xf3fd, 0xf3fd,
|
||||
0xf410, 0xf410, 0xf466, 0xf466, 0xf500, 0xf500, 0xf51f, 0xf51f, 0xf538, 0xf538, 0xf545, 0xf545, 0xf547, 0xf548,
|
||||
0xf552, 0xf552, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5aa, 0xf5aa, 0xf5e7, 0xf5e7, 0xf65d, 0xf65e, 0xf6a9, 0xf6a9,
|
||||
0xf6cf, 0xf6cf, 0xf794, 0xf794, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c,
|
||||
0xf8cc, 0xf8cc, 0x0, 0x0};
|
||||
0xf02e, 0xf02e, 0xf030, 0xf030, 0xf03a, 0xf03a, 0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf05e, 0xf05e,
|
||||
0xf062, 0xf063, 0xf067, 0xf067, 0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078, 0xf07b, 0xf07c, 0xf084, 0xf085,
|
||||
0xf091, 0xf091, 0xf0a0, 0xf0a0, 0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c9, 0xf0cb, 0xf0cb, 0xf0d0, 0xf0d0,
|
||||
0xf0dc, 0xf0dc, 0xf0e2, 0xf0e2, 0xf0e7, 0xf0e7, 0xf0eb, 0xf0eb, 0xf0f1, 0xf0f1, 0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe,
|
||||
0xf110, 0xf110, 0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140, 0xf14a, 0xf14a, 0xf15b, 0xf15b, 0xf15d, 0xf15d,
|
||||
0xf191, 0xf192, 0xf1ab, 0xf1ab, 0xf1dd, 0xf1de, 0xf1e6, 0xf1e6, 0xf1eb, 0xf1eb, 0xf1f8, 0xf1f8, 0xf1fc, 0xf1fc,
|
||||
0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c, 0xf279, 0xf279, 0xf2d0, 0xf2d0, 0xf2db, 0xf2db, 0xf2f2, 0xf2f2,
|
||||
0xf3c1, 0xf3c1, 0xf3fd, 0xf3fd, 0xf410, 0xf410, 0xf466, 0xf466, 0xf4ce, 0xf4ce, 0xf500, 0xf500, 0xf51f, 0xf51f,
|
||||
0xf538, 0xf538, 0xf545, 0xf545, 0xf547, 0xf548, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5aa, 0xf5aa, 0xf5e7, 0xf5e7,
|
||||
0xf65d, 0xf65e, 0xf6a9, 0xf6a9, 0xf6cf, 0xf6cf, 0xf794, 0xf794, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815,
|
||||
0xf818, 0xf818, 0xf84c, 0xf84c, 0xf8cc, 0xf8cc, 0x0, 0x0};
|
||||
static constexpr ImWchar range_pf[] = {
|
||||
0x2196, 0x2199, 0x219e, 0x21a1, 0x21b0, 0x21b3, 0x21ba, 0x21c3, 0x21c7, 0x21ca, 0x21d0, 0x21d4, 0x21dc, 0x21dd,
|
||||
0x21e0, 0x21e3, 0x21ed, 0x21ee, 0x21f7, 0x21f8, 0x21fa, 0x21fb, 0x227a, 0x227d, 0x235e, 0x235e, 0x2360, 0x2361,
|
||||
0x2364, 0x2366, 0x23b2, 0x23b4, 0x23f4, 0x23f7, 0x2427, 0x243a, 0x243c, 0x243c, 0x243e, 0x243e, 0x2460, 0x246b,
|
||||
0x21e0, 0x21e3, 0x21ed, 0x21ee, 0x21f7, 0x21f8, 0x21fa, 0x21fb, 0x227a, 0x227f, 0x2284, 0x2284, 0x235e, 0x235e,
|
||||
0x2360, 0x2361, 0x2364, 0x2366, 0x23b2, 0x23b4, 0x23f4, 0x23f7, 0x2427, 0x243a, 0x243c, 0x243e, 0x2460, 0x246b,
|
||||
0x24f5, 0x24fd, 0x24ff, 0x24ff, 0x278a, 0x278e, 0x27fc, 0x27fc, 0xe001, 0xe001, 0xff21, 0xff3a, 0x0, 0x0};
|
||||
|
||||
{
|
||||
|
@ -1006,14 +1006,14 @@ bool ImGuiManager::ProcessGenericInputEvent(GenericInputBinding key, float value
|
|||
ImGuiKey_GamepadL2, // R2
|
||||
};
|
||||
|
||||
if (!ImGui::GetCurrentContext() || !s_imgui_wants_keyboard.load(std::memory_order_acquire))
|
||||
if (!ImGui::GetCurrentContext())
|
||||
return false;
|
||||
|
||||
if (static_cast<u32>(key) >= std::size(key_map) || key_map[static_cast<u32>(key)] == ImGuiKey_None)
|
||||
return false;
|
||||
|
||||
ImGui::GetIO().AddKeyAnalogEvent(key_map[static_cast<u32>(key)], (value > 0.0f), value);
|
||||
return true;
|
||||
return s_imgui_wants_keyboard.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
void ImGuiManager::CreateSoftwareCursorTextures()
|
||||
|
|
Loading…
Reference in New Issue