summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aldl_pi.c6
-rw-r--r--sdldash.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/aldl_pi.c b/aldl_pi.c
index c4a5ea7..2a74809 100644
--- a/aldl_pi.c
+++ b/aldl_pi.c
@@ -52,6 +52,8 @@ void delayfn(int ms)
/* Main */
int main (int argc, char **argv)
{
+ int run = 1;
+
/* Set up RPi GPIO */
wiringPiSetup();
@@ -65,8 +67,8 @@ int main (int argc, char **argv)
if (init_dash())
return -1;
- while(1) {
- render_dash();
+ while(run) {
+ run = render_dash();
sleep(1);
}
diff --git a/sdldash.c b/sdldash.c
index 1f4ed69..3d5036b 100644
--- a/sdldash.c
+++ b/sdldash.c
@@ -146,6 +146,9 @@ int render_dash(void) {
SDL_Rect DestR;
char txtbuf[64];
+ if (SDL_QuitRequested())
+ return 0;
+
/* Clear with black */
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer);
@@ -219,5 +222,6 @@ done:
if (drawn_tex[i])
SDL_DestroyTexture(drawn_tex[i]);
}
- return 0;
+
+ return 1;
}