dev: add uc_pause() for C (not only C++)
This commit is contained in:
parent
97db58cd33
commit
d82da8811b
2 changed files with 44 additions and 0 deletions
17
include/utilsconsole_pause.h
Normal file
17
include/utilsconsole_pause.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* utilsconsole_pause.h
|
||||||
|
* by Zy
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* utilsconsole_pause.h (uc_pause() function)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTILSCONSOLE_PAUSE_H
|
||||||
|
# define UTILSCONSOLE_PAUSE_H
|
||||||
|
|
||||||
|
/// @brief Blocks the program until the user presses A.
|
||||||
|
/// @details Will also return if aptMainLoop() becomes false.
|
||||||
|
void uc_pause(void);
|
||||||
|
|
||||||
|
#endif
|
27
source/utilsconsole_pause.cpp
Normal file
27
source/utilsconsole_pause.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
* utilsconsole.cpp
|
||||||
|
* by Zy
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
#include "utilsconsole_pause.h"
|
||||||
|
#include <3ds.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void uc_pause(void) {
|
||||||
|
cout << "\e[0;2mPress (A) to continue...\e[0m" << endl;
|
||||||
|
while (aptMainLoop()) {
|
||||||
|
hidScanInput();
|
||||||
|
if (hidKeysDown() & KEY_A)
|
||||||
|
break;
|
||||||
|
gfxFlushBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue