summaryrefslogtreecommitdiff
path: root/src/code/m_pause.c
diff options
context:
space:
mode:
authorPrakxo <87568477+Prakxo@users.noreply.github.com>2023-08-12 17:55:42 +0100
committerGitHub <noreply@github.com>2023-08-12 09:55:42 -0700
commit8aa8fb893a2258a27e77b2872c189a93dc427a2e (patch)
treef374420ecdc12ec202ef01f41404d34fb9e22459 /src/code/m_pause.c
parentd9a77b4949e78c889d5cc2c7554cce4a9b12992c (diff)
m_pause OK (#47)
* m_pause OK * yeah now it's OK lol * refactor * refactor 2
Diffstat (limited to 'src/code/m_pause.c')
-rw-r--r--src/code/m_pause.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/code/m_pause.c b/src/code/m_pause.c
new file mode 100644
index 0000000..0b59856
--- /dev/null
+++ b/src/code/m_pause.c
@@ -0,0 +1,22 @@
+#include "m_pause.h"
+#include "m_controller.h"
+#include "libc/stdbool.h"
+
+void Pause_ct(Pause* pause) {
+ pause->timer = 0;
+ pause->enabled = 0;
+}
+
+s32 Pause_proc(Pause* pause, Input* input) {
+ if (CHECK_BTN_ALL(input->cur.button, R_TRIG) && CHECK_BTN_ALL(input->press.button, D_JPAD)) {
+ pause->enabled = !pause->enabled;
+ }
+
+ if ((!pause->enabled) || (CHECK_BTN_ALL(input->cur.button, Z_TRIG) &&
+ (CHECK_BTN_ALL(input->press.button, R_TRIG) ||
+ (CHECK_BTN_ALL(input->cur.button, R_TRIG) && (++pause->timer >= 9))))) {
+ pause->timer = 0;
+ return true;
+ }
+ return false;
+}