Avoid the need to hard-reset the Dreamcast to exit the sample

This commit is contained in:
T_chan 2021-07-05 20:36:19 +00:00
parent e6fca6370f
commit 76500851eb

View File

@ -11,6 +11,10 @@
#include <stdlib.h>
#include <stdint.h>
#ifdef __DREAMCAST__
#include <kos.h>
#endif
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glkos.h"
@ -41,6 +45,23 @@ GLfloat TEXCOORD_ARRAY[4 * 2] = { 0, 0,
GLuint ARGB_ARRAY[4] = { 0xFFFF0000, 0xFF0000FF, 0xFF00FF00, 0xFFFFFF00 };
int check_start() {
#ifdef __DREAMCAST__
maple_device_t *cont;
cont_state_t *state;
cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER);
if(cont) {
state = (cont_state_t *)maple_dev_status(cont);
if(state)
return state->buttons & CONT_START;
}
#endif
return 0;
}
/* Multi-Texture Example using Open GL Vertex Buffer Submission. */
void RenderCallback(GLuint texID0, GLuint texID1) {
@ -119,6 +140,9 @@ int main(int argc, char **argv) {
GLuint texID1 = glTextureLoadPVR(IMAGE2_FILENAME, 0, 0);
while(1) {
if(check_start())
break;
/* Draw the "scene" */
RenderCallback(texID0, texID1);