Last active
September 23, 2021 14:54
-
-
Save voidproc/4e901a58ed2f7834140d7460fa4c7a84 to your computer and use it in GitHub Desktop.
OpenSiv3D v0.6.0 キーボードとマウスの押されているボタンをすべて表示
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
# include <Siv3D.hpp> // OpenSiv3D v0.6.0 | |
String commaSeparatedInputNames(const Array<Input>& inputs) | |
{ | |
return inputs.map([](const auto& x) { return x.name(); }) | |
.join(U", ", U"", U""); | |
} | |
void Main() | |
{ | |
Scene::SetBackground(ColorF{ 0.0, 0.05, 0.1 }); | |
Font font{ 32, Typeface::Bold }; | |
while (System::Update()) | |
{ | |
Array<String> inputNames; | |
if (const auto keyInputs = Keyboard::GetAllInputs(); not keyInputs.isEmpty()) | |
{ | |
inputNames.push_back(commaSeparatedInputNames(keyInputs)); | |
} | |
if (const auto mouseInputs = Mouse::GetAllInputs(); not mouseInputs.isEmpty()) | |
{ | |
inputNames.push_back(commaSeparatedInputNames(mouseInputs)); | |
} | |
font(inputNames.join(U", ", U"", U"")).drawAt(Scene::Center(), ColorF{0.95, 0.98, 1.00}); | |
} | |
} |
Author
voidproc
commented
Sep 23, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment