FullscreenUI: Redo landing page and add help bar
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user