Misc: Use lightgun controller icon

This commit is contained in:
Stenzek 2024-08-25 13:57:05 +10:00
parent e019758ef8
commit 1d892cb212
No known key found for this signature in database
13 changed files with 29 additions and 35 deletions

View file

@ -63,7 +63,7 @@
//#define IMGUI_USE_BGRA_PACKED_COLOR //#define IMGUI_USE_BGRA_PACKED_COLOR
//---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) //---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
//#define IMGUI_USE_WCHAR32 #define IMGUI_USE_WCHAR32
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
@ -105,7 +105,7 @@
operator MyVec4() const { return MyVec4(x,y,z,w); } operator MyVec4() const { return MyVec4(x,y,z,w); }
*/ */
//---- ...Or use Dear ImGui's own very basic math operators. //---- ...Or use Dear ImGui's own very basic math operators.
//#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).

View file

@ -55,11 +55,11 @@ def get_pairs(tokens):
for token in tokens: for token in tokens:
u8_bytes = u8_encodings[token] u8_bytes = u8_encodings[token]
u8 = str(u8_bytes, "utf-8") u8 = str(u8_bytes, "utf-8")
u16 = u8.encode("utf-16le") u32 = u8.encode("utf-32le")
if len(u16) > 2: if len(u32) > 4:
raise ValueError("{} {} too long".format(u8_bytes, token)) raise ValueError("{} {} too long".format(u8_bytes, token))
codepoint = int.from_bytes(u16, byteorder="little", signed=False) codepoint = int.from_bytes(u32, byteorder="little", signed=False)
codepoints.append(codepoint) codepoints.append(codepoint)
codepoints.sort() codepoints.sort()
codepoints.append(0) # null terminator codepoints.append(0) # null terminator

View file

@ -1,10 +1,8 @@
// SPDX-FileCopyrightText: 2019-2024 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) // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0)
// TODO: Don't poll when booting the game, e.g. Crash Warped freaks out. // TODO: Don't poll when booting the game, e.g. Crash Warped freaks out.
#define IMGUI_DEFINE_MATH_OPERATORS
#include "achievements.h" #include "achievements.h"
#include "achievements_private.h" #include "achievements_private.h"
#include "bios.h" #include "bios.h"

View file

@ -1,5 +1,5 @@
// 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) // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0)
#pragma once #pragma once

View file

@ -1,8 +1,6 @@
// SPDX-FileCopyrightText: 2019-2024 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) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#define IMGUI_DEFINE_MATH_OPERATORS
#include "fullscreen_ui.h" #include "fullscreen_ui.h"
#include "achievements.h" #include "achievements.h"
#include "bios.h" #include "bios.h"

View file

@ -304,7 +304,7 @@ static const SettingInfo s_settings[] = {
"%.0f%%", nullptr, 100.0f}}; "%.0f%%", nullptr, 100.0f}};
const Controller::ControllerInfo GunCon::INFO = { const Controller::ControllerInfo GunCon::INFO = {
ControllerType::GunCon, "GunCon", TRANSLATE_NOOP("ControllerType", "GunCon"), nullptr, ControllerType::GunCon, "GunCon", TRANSLATE_NOOP("ControllerType", "GunCon"), ICON_PF_LIGHT_GUN,
s_binding_info, s_settings, Controller::VibrationCapabilities::NoVibration}; s_binding_info, s_settings, Controller::VibrationCapabilities::NoVibration};
void GunCon::LoadSettings(SettingsInterface& si, const char* section, bool initial) void GunCon::LoadSettings(SettingsInterface& si, const char* section, bool initial)

View file

@ -1,8 +1,6 @@
// SPDX-FileCopyrightText: 2019-2024 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) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_overlays.h" #include "imgui_overlays.h"
#include "cdrom.h" #include "cdrom.h"
#include "controller.h" #include "controller.h"

View file

@ -391,7 +391,7 @@ static const SettingInfo s_settings[] = {
const Controller::ControllerInfo Justifier::INFO = {ControllerType::Justifier, const Controller::ControllerInfo Justifier::INFO = {ControllerType::Justifier,
"Justifier", "Justifier",
TRANSLATE_NOOP("ControllerType", "Justifier"), TRANSLATE_NOOP("ControllerType", "Justifier"),
nullptr, ICON_PF_LIGHT_GUN,
s_binding_info, s_binding_info,
s_settings, s_settings,
Controller::VibrationCapabilities::NoVibration}; Controller::VibrationCapabilities::NoVibration};

View file

@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com> and contributors. // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com> and contributors.
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0)
#include "mainwindow.h" #include "mainwindow.h"
#include "qthost.h" #include "qthost.h"

View file

@ -1,12 +1,8 @@
// 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) // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0)
#pragma once #pragma once
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include "common/easing.h" #include "common/easing.h"
#include "imgui.h" #include "imgui.h"

View file

@ -1,8 +1,6 @@
// SPDX-FileCopyrightText: 2019-2024 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) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_fullscreen.h" #include "imgui_fullscreen.h"
#include "gpu_device.h" #include "gpu_device.h"
#include "image.h" #include "image.h"

View file

@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: 2019-2024 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) // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0)
#include "imgui_manager.h" #include "imgui_manager.h"
#include "gpu_device.h" #include "gpu_device.h"
@ -26,6 +26,7 @@
#include <cmath> #include <cmath>
#include <deque> #include <deque>
#include <mutex> #include <mutex>
#include <type_traits>
#include <unordered_map> #include <unordered_map>
Log_SetChannel(ImGuiManager); Log_SetChannel(ImGuiManager);
@ -57,6 +58,8 @@ struct OSDMessage
} // namespace } // namespace
static_assert(std::is_same_v<WCharType, ImWchar>);
static void UpdateScale(); static void UpdateScale();
static void SetStyle(); static void SetStyle();
static void SetKeyMap(); static void SetKeyMap();
@ -76,7 +79,7 @@ static float s_global_prescale = 1.0f; // before window scale
static float s_global_scale = 1.0f; static float s_global_scale = 1.0f;
static std::string s_font_path; static std::string s_font_path;
static std::vector<ImWchar> s_font_range; static std::vector<WCharType> s_font_range;
static ImFont* s_standard_font; static ImFont* s_standard_font;
static ImFont* s_fixed_font; static ImFont* s_fixed_font;
@ -111,7 +114,7 @@ static bool s_scale_changed = false;
static std::array<ImGuiManager::SoftwareCursor, InputManager::MAX_SOFTWARE_CURSORS> s_software_cursors = {}; static std::array<ImGuiManager::SoftwareCursor, InputManager::MAX_SOFTWARE_CURSORS> s_software_cursors = {};
} // namespace ImGuiManager } // namespace ImGuiManager
void ImGuiManager::SetFontPathAndRange(std::string path, std::vector<u16> range) void ImGuiManager::SetFontPathAndRange(std::string path, std::vector<WCharType> range)
{ {
if (s_font_path == path && s_font_range == range) if (s_font_path == path && s_font_range == range)
return; return;
@ -552,11 +555,11 @@ bool ImGuiManager::AddIconFonts(float size)
0xf7a0, 0xf7a0, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c, 0xf8cc, 0xf8cc, 0xf7a0, 0xf7a0, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c, 0xf8cc, 0xf8cc,
0x0, 0x0}; 0x0, 0x0};
static constexpr ImWchar range_pf[] = { static constexpr ImWchar range_pf[] = {
0x2196, 0x2199, 0x219e, 0x21a1, 0x21b0, 0x21b3, 0x21ba, 0x21c3, 0x21c7, 0x21ca, 0x21d0, 0x21d4, 0x21dc, 0x2196, 0x2199, 0x219e, 0x21a1, 0x21b0, 0x21b3, 0x21ba, 0x21c3, 0x21c7, 0x21ca, 0x21d0, 0x21d4, 0x21dc,
0x21dd, 0x21e0, 0x21e3, 0x21ed, 0x21ee, 0x21f3, 0x21f3, 0x21f7, 0x21f8, 0x21fa, 0x21fb, 0x227a, 0x227f, 0x21dd, 0x21e0, 0x21e3, 0x21ed, 0x21ee, 0x21f7, 0x21f8, 0x21fa, 0x21fb, 0x227a, 0x227f, 0x2284, 0x2284,
0x2284, 0x2284, 0x235e, 0x235e, 0x2360, 0x2361, 0x2364, 0x2366, 0x23b2, 0x23b4, 0x23ce, 0x23ce, 0x23f4, 0x235e, 0x235e, 0x2360, 0x2361, 0x2364, 0x2366, 0x23b2, 0x23b4, 0x23ce, 0x23ce, 0x23f4, 0x23f7, 0x2427,
0x23f7, 0x2427, 0x243a, 0x243c, 0x243e, 0x2460, 0x246b, 0x24f5, 0x24fd, 0x24ff, 0x24ff, 0x2717, 0x2717, 0x243a, 0x243c, 0x243e, 0x2460, 0x246b, 0x24f5, 0x24fd, 0x24ff, 0x24ff, 0x2717, 0x2717, 0x278a, 0x278e,
0x278a, 0x278e, 0x27fc, 0x27fc, 0xe001, 0xe001, 0xff21, 0xff3a, 0x0, 0x0}; 0x27fc, 0x27fc, 0xe001, 0xe001, 0xff21, 0xff3a, 0x1f52b, 0x1f52b, 0x0, 0x0};
{ {
ImFontConfig cfg; ImFontConfig cfg;

View file

@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: 2019-2024 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) // SPDX-License-Identifier: (GPL-3.0 OR PolyForm-Strict-1.0.0)
#pragma once #pragma once
@ -15,8 +15,11 @@ union InputBindingKey;
enum class GenericInputBinding : u8; enum class GenericInputBinding : u8;
namespace ImGuiManager { namespace ImGuiManager {
using WCharType = u32;
/// Sets the path to the font to use. Empty string means to use the default. /// Sets the path to the font to use. Empty string means to use the default.
void SetFontPathAndRange(std::string path, std::vector<u16> range); void SetFontPathAndRange(std::string path, std::vector<WCharType> range);
/// Changes the global scale. /// Changes the global scale.
void SetGlobalScale(float global_scale); void SetGlobalScale(float global_scale);