From 017e2f314f9664bb17f932e70564655533840232 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sun, 23 Sep 2018 19:14:38 +0200 Subject: [PATCH 01/10] add key 'w' to show winner(s) from voting Add key 'w' to display winner(s) from [BHNT voting app](https://github.com/robotnyc/nodejs-vote-by-mac). Pressing 'w' will initiate the HTTP GET request in the background and only on success will the results be shown on the matelight. Uses `ofLoadURLAsync` to perform HTTP GET to retrieve the JSON list of winners For example, ["1"] or ["1", "10"] if there's a tie. --- src/ofApp.cpp | 83 +++++++++++++++++++++++++++++++++++---------------- src/ofApp.h | 6 ++-- 2 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/ofApp.cpp b/src/ofApp.cpp index 3b6e818..ae719f6 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -1,6 +1,8 @@ #include #include +#include #include +#include #include "ofApp.h" //-------------------------------------------------------------- @@ -30,6 +32,7 @@ void ofApp::setup(){ gui.add(paused.setup("Pause (p/space)", true)); gui.add(minutes.setup("Minutes", 5, 1, 120)); gui.add(showApplause.setup("Show applause (a)", false)); + gui.add(showWinners.setup("Show winners (w)", false)); gui.add(showMatelightPreview.setup("Show ML preview", false)); @@ -44,6 +47,7 @@ void ofApp::setup(){ udpConnection.Connect("10.0.1.39", 1337); udpConnection.SetNonBlocking(true); + ofRegisterURLNotification(this); } void ofApp::resetButtonPressed() { @@ -55,38 +59,38 @@ void ofApp::resetButtonPressed() { //-------------------------------------------------------------- void ofApp::update(){ - if (!showApplause) { - updateTimeLeft(); - } - else { - paused = true; + std::string s1; + + updateTimeLeft(); + + if (showWinners) { + s1 = winners; + } else { + // update time left display + int minutes = millisecondsLeft / 1000 / 60; + int seconds = (millisecondsLeft - (minutes * 60 * 1000)) / 1000; + int millis = millisecondsLeft - (minutes * 1000 * 60) - (seconds * 1000); + + std::stringstream ss; + ss << setfill('0') << setw(2) << seconds; + std::stringstream ms; + ms << setfill('0') << setw(3) << millis; + + s1 = ofToString(minutes) + ":" + ofToString(ss.str()); + std::string s2 = s1 + "." + ofToString(ms.str()); + + strncpy(timeLeftStr, s2.c_str(), sizeof(timeLeftStr)); + // update the local time + std::time_t t = std::time(NULL); + std::strftime(localTimeStr, sizeof(localTimeStr), "%H:%M:%S", std::localtime(&t)); } - // update time left display - int minutes = millisecondsLeft / 1000 / 60; - int seconds = (millisecondsLeft - (minutes * 60 * 1000)) / 1000; - int millis = millisecondsLeft - (minutes * 1000 * 60) - (seconds * 1000); - - std::stringstream ss; - ss << setfill('0') << setw(2) << seconds; - std::stringstream ms; - ms << setfill('0') << setw(3) << millis; - - std::string s1 = ofToString(minutes) + ":" + ofToString(ss.str()); - std::string s2 = s1 + "." + ofToString(ms.str()); - - - strncpy(timeLeftStr, s2.c_str(), sizeof(timeLeftStr)); - // update the local time - std::time_t t = std::time(NULL); - std::strftime(localTimeStr, sizeof(localTimeStr), "%H:%M:%S", std::localtime(&t)); - updateMatelight(s1); } //-------------------------------------------------------------- void ofApp::updateTimeLeft(){ - if (showApplause) { + if (showApplause || showWinners) { return; } if (paused) { @@ -145,6 +149,25 @@ void ofApp::updateMatelight(std::string text) { udpConnection.Send(message, 1924); } +void ofApp::urlResponse(ofHttpResponse & response) { + if (response.status == 200 && response.request.name == "async_req") { + std::string s = response.data.getText(); + std::regex regex("[0-9]+"); + winners.clear(); + for (std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), regex); i != std::sregex_iterator(); ++i) { + std::smatch match = *i; + winners += match.str() + " "; + } + // if there are no winners this will show a blank screen + // allowing the game master to retry getting the winners + showWinners = true; + } else { + ofRemoveAllURLRequests(); + ofStopURLLoader(); + // cerr << response.status << " " << response.error << endl; + } +} + //-------------------------------------------------------------- void ofApp::drawStringMono(ofTrueTypeFont* font, std::string text, float x, float y, float w) { for (int i = 0 ; i < text.length(); i++) { @@ -215,6 +238,7 @@ void ofApp::draw(){ void ofApp::exit() { resetButton.removeListener(this,&ofApp::resetButtonPressed); + ofUnregisterURLNotification(this); } //-------------------------------------------------------------- @@ -225,11 +249,20 @@ void ofApp::keyPressed(int key){ } if (key == 'a') { showApplause = !showApplause; + paused = true; } if (key == 'r') { resetButtonPressed(); return; } + if (key == 'w') { + // if not shown, async HTTP GET winners + if (!showWinners) + ofLoadURLAsync("http://localhost:8080/winners", "async_req"); // FIXME need static IP for bhnt-vote + // if shown, hide + showWinners = false; + return; + } if (key == 'p' || key == ' ') { paused = !paused; diff --git a/src/ofApp.h b/src/ofApp.h index 2ac2a41..ade961b 100644 --- a/src/ofApp.h +++ b/src/ofApp.h @@ -29,6 +29,7 @@ class ofApp : public ofBaseApp{ void updateTimeLeft(); void updateMatelight(std::string minutes); + void urlResponse(ofHttpResponse & response); void drawStringMono(ofTrueTypeFont* font, std::string text, float x, float y, float w); void drawApplause(); void drawCountDown(); @@ -50,21 +51,20 @@ class ofApp : public ofBaseApp{ ofPixels matelightPixels; ofPixels matelightSmall; ofImage matelightPreview; - ofxUDPManager udpConnection; bool isMenuHidden; bool isTimerRunning; ofxToggle showApplause; + ofxToggle showWinners; int applauseTextColor; int applauseBackgroundColor; // buffers for variable strings on the display char localTimeStr[100]; char timeLeftStr[100]; // application state - int millisecondsTotal; int millisecondsLeft; int lastTime; - + std::string winners; }; From 5bb8044339914ffd0458a0d111e2e46734bc32b6 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sat, 27 Apr 2019 14:39:29 +0200 Subject: [PATCH 02/10] get votes from default HTTP port since server will most likely be listening there since it makes it easier for people to connect and vote. --- src/ofApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ofApp.cpp b/src/ofApp.cpp index ae719f6..27c82ca 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -258,7 +258,7 @@ void ofApp::keyPressed(int key){ if (key == 'w') { // if not shown, async HTTP GET winners if (!showWinners) - ofLoadURLAsync("http://localhost:8080/winners", "async_req"); // FIXME need static IP for bhnt-vote + ofLoadURLAsync("http://localhost:80/winners", "async_req"); // FIXME need static IP for bhnt-vote // if shown, hide showWinners = false; return; From e6f012c298f8a85562ae06cf0dafb60e2ba4d6d3 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sat, 27 Apr 2019 15:29:46 +0200 Subject: [PATCH 03/10] build: use all available CPU cores to speed up build time --- Dockerfile | 2 +- build.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28ef297..3c02501 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN wget --no-check-certificate http://openframeworks.cc/versions/v${OF_VERSION} mkdir -p /opt/openFrameworks && \ tar -xzvf of_v${OF_VERSION}_linux64_release.tar.gz -C /opt/openFrameworks --strip-components 1 && \ /opt/openFrameworks/scripts/linux/ubuntu/install_dependencies.sh -y && \ - /opt/openFrameworks/scripts/linux/compileOF.sh -j3 + /opt/openFrameworks/scripts/linux/compileOF.sh -j`nproc` # Add user that matches host user ARG BUILD_UID=1000 diff --git a/build.sh b/build.sh index a7b362d..5425cc4 100755 --- a/build.sh +++ b/build.sh @@ -14,5 +14,4 @@ if ! grep -c docker /proc/1/cgroup > /dev/null; then exit $? fi -make - +make -j`nproc` From 7fe91a99f8fd9e30efef9bec47c7d204d7e2716f Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sat, 27 Apr 2019 15:30:26 +0200 Subject: [PATCH 04/10] docs: document option to get interactive shell --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 45d62fe..4307552 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Needs http://openframeworks.cc/ to compile. ## Host Build with Docker +Pass the `--shell` argument to get an interactive shell inside the build container. + * `./build.sh` ### Runtime Dependencies From 6b8f7ec8d515ab667a9f95a24a6ed0ce51ccdc62 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sat, 27 Apr 2019 15:40:08 +0200 Subject: [PATCH 05/10] input: make menu case insensitive. believe it or not, we thought they keyboard was broken when infact we simply had caps lock enabled :man_facepalming: --- src/ofApp.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/ofApp.cpp b/src/ofApp.cpp index 27c82ca..5c0191b 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -243,33 +243,40 @@ void ofApp::exit() //-------------------------------------------------------------- void ofApp::keyPressed(int key){ - if (key == 'h') { + switch (key) { + case 'h': + case 'H': isMenuHidden = !isMenuHidden; - return; - } - if (key == 'a') { + break; + case 'a': + case 'A': showApplause = !showApplause; paused = true; - } - if (key == 'r') { + break; + case 'r': + case 'R': resetButtonPressed(); - return; - } - if (key == 'w') { + break; + case 'w': + case 'W': // if not shown, async HTTP GET winners if (!showWinners) - ofLoadURLAsync("http://localhost:80/winners", "async_req"); // FIXME need static IP for bhnt-vote + ofLoadURLAsync("http://localhost:80/winners", "async_req"); // if shown, hide showWinners = false; - return; - } - - if (key == 'p' || key == ' ') { + break; + case 'p': + case 'P': + case ' ': paused = !paused; - } - - if (key == 'q') { + break; + case 'q': + case 'Q': ofExit(); + break; + default: + /* do nothing with unknown keys */ + break; } } From 2d3c203fffe025ae79a3cc3e8ee02ec235c02dee Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sat, 27 Apr 2019 15:45:07 +0200 Subject: [PATCH 06/10] input: disable the quit on ESC key. accidentally pressing this is quite easy when passing the keyboard around and requires a reboot of the rpi to get the app running again. --- src/ofApp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ofApp.cpp b/src/ofApp.cpp index 5c0191b..9b2b953 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -15,6 +15,8 @@ void ofApp::setup(){ #endif ofSetVerticalSync(true); resetButton.addListener(this,&ofApp::resetButtonPressed); + + ofSetEscapeQuitsApp(false); matelightFont.loadFont("OSP-DIN.ttf", 68, true, true, true); signsFont.loadFont("OSP-DIN.ttf", 100, true, true, true ); From b49b8763112e8a1434c8c8b0a31166a3d85c9256 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sun, 28 Apr 2019 17:31:59 +0200 Subject: [PATCH 07/10] docker: always remove container even when dropping into a shell --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5425cc4..9ac2fac 100755 --- a/build.sh +++ b/build.sh @@ -7,7 +7,7 @@ if ! grep -c docker /proc/1/cgroup > /dev/null; then image_tag="$(basename $PWD | sed 's/_/-/g' | cut -c 1-40 | tr '[:upper:]' '[:lower:]'):$(git rev-parse --short HEAD)" docker build --build-arg BUILD_UID=$(id -u) --build-arg BUILD_GID=$(id -g) --tag local/$image_tag . if [[ $1 == "--shell" ]]; then - docker run --name $(basename $PWD) -it -v $PWD:/home/docker/$(basename $PWD) local/$image_tag bash + docker run --name $(basename $PWD) -it --rm -v $PWD:/home/docker/$(basename $PWD) local/$image_tag bash else docker run --name $(basename $PWD) --rm -v $PWD:/home/docker/$(basename $PWD) local/$image_tag $0 $* fi From ff3aa53bc66c5429148c7328ae92716515c7c417 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Sun, 28 Apr 2019 22:54:59 +0200 Subject: [PATCH 08/10] build: add armv6 target --- Dockerfile | 27 ++++++++++++++++----------- README.md | 8 ++++---- build.sh | 12 +++++++++--- cross.env | 15 +++++++++++++++ 4 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 cross.env diff --git a/Dockerfile b/Dockerfile index 3c02501..2817a32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:16.04 ENV TERM=xterm-256color -ENV OF_VERSION "0.9.8" +ENV OF_VERSION "0.10.1-patched" ENV OF_ROOT "/opt/openFrameworks" ARG DEBIAN_FRONTEND=noninteractive @@ -14,15 +14,22 @@ RUN apt-get update; \ lsb-release \ libmpg123-dev \ gstreamer1.0 \ - gstreamer1.0-plugins-ugly + gstreamer1.0-plugins-ugly \ + ccache \ + vim \ + unzip \ + rsync \ + git \ + ca-certificates -# Install OpenFrameworks -# based off https://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/ -RUN wget --no-check-certificate http://openframeworks.cc/versions/v${OF_VERSION}/of_v${OF_VERSION}_linux64_release.tar.gz && \ - mkdir -p /opt/openFrameworks && \ - tar -xzvf of_v${OF_VERSION}_linux64_release.tar.gz -C /opt/openFrameworks --strip-components 1 && \ +# Install openFrameworks for linux64 and linuxarmv6l +RUN git clone https://github.com/lucasrangit/openFrameworks.git --branch ${OF_VERSION} --single-branch /opt/openFrameworks && \ + /opt/openFrameworks/scripts/linux/download_libs.sh && \ /opt/openFrameworks/scripts/linux/ubuntu/install_dependencies.sh -y && \ - /opt/openFrameworks/scripts/linux/compileOF.sh -j`nproc` + /opt/openFrameworks/scripts/linux/compileOF.sh -j`nproc` && \ + /opt/openFrameworks/scripts/linux/download_libs.sh --platform linuxarmv6l && \ + /opt/openFrameworks/scripts/ci/linuxarmv6l/install.sh && \ + TARGET=linuxarmv6l /opt/openFrameworks/scripts/ci/linuxarmv6l/build.sh # Add user that matches host user ARG BUILD_UID=1000 @@ -33,9 +40,7 @@ RUN (test $(getent group $BUILD_GID) || addgroup -gid $BUILD_GID docker) && \ echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/docker # Build needs write access to /opt/openFrameworks/addons/obj for some reason -RUN mkdir /opt/openFrameworks/addons/obj && \ - chown docker. /opt/openFrameworks/addons/obj +RUN chown docker. /opt/openFrameworks/addons/obj USER $BUILD_UID WORKDIR /home/docker/hackandtell-raspberry - diff --git a/README.md b/README.md index 4307552..3f80eee 100644 --- a/README.md +++ b/README.md @@ -13,17 +13,17 @@ Needs http://openframeworks.cc/ to compile. make && make run # or use XCode or other IDE to compile -## Host Build with Docker +## Build -Pass the `--shell` argument to get an interactive shell inside the build container. +* Pass the `--shell` argument to get an interactive shell inside the build container. +* Pass the `armv6` argument to build for the armv6 (e.g. Raspberry Pi). * `./build.sh` ### Runtime Dependencies -* Ubuntu: `sudo apt install libfreeimage3` +* Ubuntu 16.04: `sudo apt install libfreeimage3 libglfw3 liburiparser1` ### Run * `bin/hackandtell-raspberry` - diff --git a/build.sh b/build.sh index 9ac2fac..6b8d83e 100755 --- a/build.sh +++ b/build.sh @@ -6,12 +6,18 @@ set -o xtrace if ! grep -c docker /proc/1/cgroup > /dev/null; then image_tag="$(basename $PWD | sed 's/_/-/g' | cut -c 1-40 | tr '[:upper:]' '[:lower:]'):$(git rev-parse --short HEAD)" docker build --build-arg BUILD_UID=$(id -u) --build-arg BUILD_GID=$(id -g) --tag local/$image_tag . - if [[ $1 == "--shell" ]]; then + if [[ ${1} == "--shell" ]]; then docker run --name $(basename $PWD) -it --rm -v $PWD:/home/docker/$(basename $PWD) local/$image_tag bash else - docker run --name $(basename $PWD) --rm -v $PWD:/home/docker/$(basename $PWD) local/$image_tag $0 $* + docker run --name $(basename $PWD) --rm -v $PWD:/home/docker/$(basename $PWD) local/$image_tag "$0" "$*" fi exit $? fi -make -j`nproc` +rm bin/hackandtell-raspberry + +if [[ ${1} == "armv6" ]]; then + source cross.env +fi + +make -j`nproc` \ No newline at end of file diff --git a/cross.env b/cross.env new file mode 100644 index 0000000..8978c59 --- /dev/null +++ b/cross.env @@ -0,0 +1,15 @@ +export TARGET=linuxarmv6l +export GCC_PREFIX=arm-linux-gnueabihf +export GST_VERSION=1.0 +export RPI_ROOT=${OF_ROOT}/scripts/ci/$TARGET/raspbian +export TOOLCHAIN_ROOT=${OF_ROOT}/scripts/ci/$TARGET/rpi_toolchain +export PLATFORM_OS=Linux +export PLATFORM_ARCH=armv6l +export PKG_CONFIG_LIBDIR=${RPI_ROOT}/usr/lib/pkgconfig:${RPI_ROOT}/usr/lib/${GCC_PREFIX}/pkgconfig:${RPI_ROOT}/usr/share/pkgconfig +export CXX="ccache ${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-g++" +export CC="ccache ${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-gcc" +export AR=${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-ar +export LD=${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-ld + +# match the flags used the build OF or it will require a recompile +export CXXFLAGS="${CXXFLAGS} -ftrack-macro-expansion=0" From b32ca23163589bf0e98e4661c5995f11c321482d Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Mon, 29 Apr 2019 16:38:05 +0200 Subject: [PATCH 09/10] build: add -f so remove does not fail when file does not exist --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 6b8d83e..6cb813f 100755 --- a/build.sh +++ b/build.sh @@ -14,10 +14,10 @@ if ! grep -c docker /proc/1/cgroup > /dev/null; then exit $? fi -rm bin/hackandtell-raspberry +rm -f bin/hackandtell-raspberry if [[ ${1} == "armv6" ]]; then source cross.env fi -make -j`nproc` \ No newline at end of file +make -j`nproc` From cf1b70c2412b38aab18ac9903e9aeaa387b9f0e7 Mon Sep 17 00:00:00 2001 From: Lucas Rangit MAGASWERAN Date: Mon, 29 Apr 2019 17:10:17 +0200 Subject: [PATCH 10/10] add command to show running vote count in hex (to make it less obvious how many votes are in). in the event of an HTTP error, winner and count is cleared. pressing 'r' resets the counts and aborts any pending updates. --- src/ofApp.cpp | 53 ++++++++++++++++++++++++++++++++++++++++----------- src/ofApp.h | 3 +++ 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/ofApp.cpp b/src/ofApp.cpp index 9b2b953..8799900 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "ofApp.h" //-------------------------------------------------------------- @@ -35,9 +36,10 @@ void ofApp::setup(){ gui.add(minutes.setup("Minutes", 5, 1, 120)); gui.add(showApplause.setup("Show applause (a)", false)); gui.add(showWinners.setup("Show winners (w)", false)); + gui.add(showCount.setup("Show vote count (v)", false)); gui.add(showMatelightPreview.setup("Show ML preview", false)); - + millisecondsTotal = minutes; millisecondsLeft = minutes * 60 * 1000; @@ -56,6 +58,11 @@ void ofApp::resetButtonPressed() { paused = true; showApplause = false; millisecondsLeft = minutes * 60 * 1000; + ofRemoveAllURLRequests(); + ofStopURLLoader(); + showWinners = false; + showCount = false; + queueGetCount = false; } @@ -67,6 +74,14 @@ void ofApp::update(){ if (showWinners) { s1 = winners; + showCount = false; + } else if (showCount) { + s1 = count; + // queue another if the last update was successful + if (queueGetCount) { + queueGetCount = false; + ofLoadURLAsync("http://localhost:80/count", "async_req"); + } } else { // update time left display int minutes = millisecondsLeft / 1000 / 60; @@ -154,19 +169,29 @@ void ofApp::updateMatelight(std::string text) { void ofApp::urlResponse(ofHttpResponse & response) { if (response.status == 200 && response.request.name == "async_req") { std::string s = response.data.getText(); - std::regex regex("[0-9]+"); - winners.clear(); - for (std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), regex); i != std::sregex_iterator(); ++i) { - std::smatch match = *i; - winners += match.str() + " "; + if (response.request.url.find("winners") != std::string::npos) { + std::regex regex("[0-9]+"); + winners.clear(); + for (std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), regex); i != std::sregex_iterator(); ++i) { + std::smatch match = *i; + winners += match.str() + " "; + } + // if there are no winners this will show a blank screen + // allowing the game master to retry getting the winners + showWinners = true; + } else if (response.request.url.find("count") != std::string::npos) { + cerr << "Count: " << s << endl; + std::stringstream stream; + stream << "0x" << setfill('0') << setw(2) << std::hex << std::stoi(s); + count = stream.str(); + // queue an update on success + queueGetCount = true; } - // if there are no winners this will show a blank screen - // allowing the game master to retry getting the winners - showWinners = true; } else { - ofRemoveAllURLRequests(); - ofStopURLLoader(); // cerr << response.status << " " << response.error << endl; + // if an error occurs, clear the results in case they are no longer valid + count.clear(); + winners.clear(); } } @@ -259,6 +284,12 @@ void ofApp::keyPressed(int key){ case 'R': resetButtonPressed(); break; + case 'v': + case 'V': + showCount = !showCount; + if (!showCount) + ofLoadURLAsync("http://localhost:80/count", "async_req"); + break; case 'w': case 'W': // if not shown, async HTTP GET winners diff --git a/src/ofApp.h b/src/ofApp.h index ade961b..b8006b6 100644 --- a/src/ofApp.h +++ b/src/ofApp.h @@ -56,6 +56,7 @@ class ofApp : public ofBaseApp{ bool isMenuHidden; bool isTimerRunning; ofxToggle showApplause; + ofxToggle showCount; ofxToggle showWinners; int applauseTextColor; int applauseBackgroundColor; @@ -67,4 +68,6 @@ class ofApp : public ofBaseApp{ int millisecondsLeft; int lastTime; std::string winners; + std::string count; + ofxToggle queueGetCount; };