cleanup
This commit is contained in:
parent
680481afad
commit
14fdd4558e
1 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,9 @@ public class ClickTest : MonoBehaviour {
|
||||||
[SerializeField] private TMP_Text text;
|
[SerializeField] private TMP_Text text;
|
||||||
private int _presses;
|
private int _presses;
|
||||||
private bool _pressed;
|
private bool _pressed;
|
||||||
|
|
||||||
|
//VK_OEM_2 = 0xBF | cedilla
|
||||||
|
//https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
||||||
private const int Key = 0xBF;
|
private const int Key = 0xBF;
|
||||||
|
|
||||||
private void OnEnable() {
|
private void OnEnable() {
|
||||||
|
@ -14,12 +17,10 @@ public class ClickTest : MonoBehaviour {
|
||||||
|
|
||||||
private void Update() {
|
private void Update() {
|
||||||
if (_pressed && Win32API.GetAsyncKeyState(Key) == 0) {
|
if (_pressed && Win32API.GetAsyncKeyState(Key) == 0) {
|
||||||
Debug.Log("unpressed");
|
|
||||||
_pressed = false;
|
_pressed = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_pressed && Win32API.GetAsyncKeyState(Key) != 0) {
|
if (!_pressed && Win32API.GetAsyncKeyState(Key) != 0) {
|
||||||
Debug.Log("pressed");
|
|
||||||
_presses++;
|
_presses++;
|
||||||
text.text = _presses.ToString();
|
text.text = _presses.ToString();
|
||||||
_pressed = true;
|
_pressed = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue