diff --git a/samples/blend_test/main.c b/samples/blend_test/main.c index 191bbe9..cd47cc6 100644 --- a/samples/blend_test/main.c +++ b/samples/blend_test/main.c @@ -4,6 +4,10 @@ * output and incorrect depth testing */ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -42,6 +46,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} void DrawQuad(const float* colour) { glBegin(GL_QUADS); @@ -98,6 +119,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/depth_funcs/main.c b/samples/depth_funcs/main.c index fe90f35..ec80e79 100644 --- a/samples/depth_funcs/main.c +++ b/samples/depth_funcs/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -34,6 +38,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} void DrawSquare(float width, float r, float g, float b, float z) { width /= 2; @@ -113,6 +134,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/depth_funcs_alpha_testing/main.c b/samples/depth_funcs_alpha_testing/main.c index c0e7e81..17fc005 100644 --- a/samples/depth_funcs_alpha_testing/main.c +++ b/samples/depth_funcs_alpha_testing/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -94,6 +98,24 @@ void DrawGLScene() glKosSwapBuffers(); } +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; +} + int main(int argc, char **argv) { glKosInit(); @@ -104,6 +126,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); DrawGLScene(); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/depth_funcs_ortho/main.c b/samples/depth_funcs_ortho/main.c index 837ede0..ccd88c6 100644 --- a/samples/depth_funcs_ortho/main.c +++ b/samples/depth_funcs_ortho/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -48,6 +52,24 @@ void DrawSquare(float width, float r, float g, float b, float z) { glEnd(); // done with the polygon } +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; +} + /* The main drawing function. */ void DrawGLScene() { @@ -77,6 +99,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/lerabot01/main.c b/samples/lerabot01/main.c index 6d63f2c..831b537 100644 --- a/samples/lerabot01/main.c +++ b/samples/lerabot01/main.c @@ -3,6 +3,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -199,6 +203,24 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} + void DrawTexturedQuad(int tex, float x, float y, float z) { GLfloat texW = 10; @@ -303,6 +325,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/lerabot_blend_test/main.c b/samples/lerabot_blend_test/main.c index 24722ef..fdc21d1 100644 --- a/samples/lerabot_blend_test/main.c +++ b/samples/lerabot_blend_test/main.c @@ -4,6 +4,10 @@ * output and incorrect depth testing */ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -42,6 +46,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} void DrawQuad(const float* colour) { glBegin(GL_QUADS); @@ -99,6 +120,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/lights/main.c b/samples/lights/main.c index 23dd6ec..72b56dd 100644 --- a/samples/lights/main.c +++ b/samples/lights/main.c @@ -2,6 +2,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glext.h" @@ -213,6 +217,24 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} + void DrawCube(float x, float z) { static float pos = 0.0f; const static float radius = 30.0f; @@ -307,6 +329,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/mipmap/main.c b/samples/mipmap/main.c index 43f5197..fcefd2a 100644 --- a/samples/mipmap/main.c +++ b/samples/mipmap/main.c @@ -2,6 +2,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glext.h" @@ -175,6 +179,24 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} + void DrawQuad() { glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left Of The Texture and Quad @@ -238,6 +260,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/multitexture_arrays/main.c b/samples/multitexture_arrays/main.c index 0923c6d..f104467 100644 --- a/samples/multitexture_arrays/main.c +++ b/samples/multitexture_arrays/main.c @@ -11,6 +11,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#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); diff --git a/samples/nehe02/main.c b/samples/nehe02/main.c index ae6a0d0..1b2e3e0 100644 --- a/samples/nehe02/main.c +++ b/samples/nehe02/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -34,6 +38,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -116,6 +137,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe02de/main.c b/samples/nehe02de/main.c index f84775c..1aca26b 100644 --- a/samples/nehe02de/main.c +++ b/samples/nehe02de/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -36,6 +40,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -87,6 +108,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe02va/main.c b/samples/nehe02va/main.c index ebaf30a..a89d104 100644 --- a/samples/nehe02va/main.c +++ b/samples/nehe02va/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -36,6 +40,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -79,6 +100,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe03/main.c b/samples/nehe03/main.c index a4e7c35..193af39 100644 --- a/samples/nehe03/main.c +++ b/samples/nehe03/main.c @@ -1,3 +1,6 @@ +#ifdef __DREAMCAST__ +#include +#endif #include "GL/gl.h" #include "GL/glu.h" @@ -35,6 +38,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -77,6 +97,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe04/main.c b/samples/nehe04/main.c index a84e94e..1715268 100644 --- a/samples/nehe04/main.c +++ b/samples/nehe04/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -37,6 +41,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -87,6 +108,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe05/main.c b/samples/nehe05/main.c index 6bffe61..cc1499d 100644 --- a/samples/nehe05/main.c +++ b/samples/nehe05/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -37,6 +41,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -140,6 +161,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe06/main.c b/samples/nehe06/main.c index 475f58e..8580e37 100644 --- a/samples/nehe06/main.c +++ b/samples/nehe06/main.c @@ -3,6 +3,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glext.h" @@ -178,6 +182,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -249,6 +270,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe06_4444twid/main.c b/samples/nehe06_4444twid/main.c index d5f05b7..dc3715b 100644 --- a/samples/nehe06_4444twid/main.c +++ b/samples/nehe06_4444twid/main.c @@ -2,6 +2,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -194,6 +198,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -265,6 +286,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/nehe06_vq/main.c b/samples/nehe06_vq/main.c index cf1e416..80451c2 100644 --- a/samples/nehe06_vq/main.c +++ b/samples/nehe06_vq/main.c @@ -1,6 +1,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -200,6 +204,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -271,6 +292,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/ortho2d/main.c b/samples/ortho2d/main.c index 99354c7..296fefa 100644 --- a/samples/ortho2d/main.c +++ b/samples/ortho2d/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -35,6 +39,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -60,6 +81,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/paletted/main.c b/samples/paletted/main.c index 1e13df3..f41b8c9 100644 --- a/samples/paletted/main.c +++ b/samples/paletted/main.c @@ -3,6 +3,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glext.h" #include "GL/glu.h" @@ -163,6 +167,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -234,6 +255,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/paletted_pcx/main.c b/samples/paletted_pcx/main.c index bb8a0e0..fac5f0f 100644 --- a/samples/paletted_pcx/main.c +++ b/samples/paletted_pcx/main.c @@ -4,6 +4,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glext.h" @@ -233,6 +237,24 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} + void DrawPolygon() { glBegin(GL_QUADS); // begin drawing a cube @@ -343,6 +365,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/polygon_offset/main.c b/samples/polygon_offset/main.c index a00278d..a67cfe9 100644 --- a/samples/polygon_offset/main.c +++ b/samples/polygon_offset/main.c @@ -1,4 +1,3 @@ - typedef enum { false, @@ -99,7 +98,7 @@ void drawPolygon() glEnd(); } int frames = 0; -void check_input() +int check_input() { #ifdef __DREAMCAST__ maple_device_t *cont; @@ -113,9 +112,12 @@ void check_input() if (state) { + if (state->buttons & CONT_START) + return 0; + if (frames <= 0) { - if (state->buttons & CONT_START) + if (state->buttons & CONT_A) { offset = !offset; frames = 60; @@ -124,6 +126,8 @@ void check_input() } } #endif + + return 1; } /* The main drawing function. */ @@ -211,7 +215,8 @@ int main(int argc, char **argv) while (1) { - check_input(); + if(!check_input()) + break; DrawGLScene(); xrot += 0.1f; yrot += 0.25f; diff --git a/samples/scissor/main.c b/samples/scissor/main.c index f5802d4..0e1af92 100644 --- a/samples/scissor/main.c +++ b/samples/scissor/main.c @@ -1,3 +1,7 @@ +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -38,6 +42,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -119,6 +140,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/terrain/main.c b/samples/terrain/main.c index 3ab9163..d7f7545 100644 --- a/samples/terrain/main.c +++ b/samples/terrain/main.c @@ -1,6 +1,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -91,6 +95,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} /* The main drawing function. */ void DrawGLScene() @@ -135,6 +156,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/zclip/main.c b/samples/zclip/main.c index 2da470b..a1349ff 100644 --- a/samples/zclip/main.c +++ b/samples/zclip/main.c @@ -3,6 +3,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glext.h" @@ -171,6 +175,23 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} void RenderTower(counter) { counter = counter % 3; @@ -314,6 +335,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/zclip_triangle/main.c b/samples/zclip_triangle/main.c index 0400f0b..17f4887 100644 --- a/samples/zclip_triangle/main.c +++ b/samples/zclip_triangle/main.c @@ -2,6 +2,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -41,6 +45,24 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} + /* The main drawing function. */ void DrawGLScene() { @@ -96,6 +118,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); } diff --git a/samples/zclip_trianglestrip/main.c b/samples/zclip_trianglestrip/main.c index 332ec3e..4bea868 100644 --- a/samples/zclip_trianglestrip/main.c +++ b/samples/zclip_trianglestrip/main.c @@ -2,6 +2,10 @@ #include #include +#ifdef __DREAMCAST__ +#include +#endif + #include "GL/gl.h" #include "GL/glu.h" #include "GL/glkos.h" @@ -41,6 +45,24 @@ void ReSizeGLScene(int Width, int Height) glMatrixMode(GL_MODELVIEW); } +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; +} + /* The main drawing function. */ void DrawGLScene() { @@ -105,6 +127,9 @@ int main(int argc, char **argv) ReSizeGLScene(640, 480); while(1) { + if(check_start()) + break; + DrawGLScene(); }