-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add partial support for utf-16 and resolve #9
- Loading branch information
1 parent
63eee8b
commit 9816bff
Showing
13 changed files
with
421 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"xutility": "cpp", | ||
"*.rh": "cpp", | ||
"any": "cpp", | ||
"deque": "cpp" | ||
"deque": "cpp", | ||
"codecvt": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "hotkeys.h" | ||
|
||
Hotkey::Hotkey(ImGuiKey key1, ImGuiKey key2) { | ||
codes[0] = defaultCodes[0] = key1; | ||
|
||
if (key2 == ImGuiKey_None) { | ||
codes[1] = defaultCodes[1] = key1; | ||
} else { | ||
codes[1] = defaultCodes[1] = key2; | ||
} | ||
} | ||
|
||
bool Hotkey::Pressed(bool noDelay) { | ||
if (ImGui::GetTime() - lastUpdate < 2.0) return false; | ||
|
||
if (noDelay) { | ||
return ImGui::IsKeyDown(codes[0]) && ImGui::IsKeyDown(codes[1]); | ||
} else { | ||
if (ImGui::IsKeyDown(codes[0]) && ImGui::IsKeyDown(codes[1])) { | ||
wPressed = true; | ||
} else { | ||
if (wPressed) { | ||
wPressed = false; | ||
return current == ""; | ||
} | ||
} | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
#include <imgui/imgui.h> | ||
#include <imgui/imgui_internal.h> | ||
#include <string> | ||
|
||
class Hotkey { | ||
private: | ||
static inline std::string current; | ||
bool wPressed = false; | ||
ImGuiKey codes[2], defaultCodes[2]; | ||
double lastUpdate; | ||
|
||
public: | ||
Hotkey(ImGuiKey key1 = ImGuiKey_None, ImGuiKey key2 = ImGuiKey_None); | ||
|
||
bool Pressed(bool noDelay = false); | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.