From a743fc84f22de4fe7a0927b7d36cb3f888c1256a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:31:59 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20[UX=20improvement?= =?UTF-8?q?]=20-=20Enhance=20SPEED=20CLICKER=20with=20colors=20and=20immed?= =?UTF-8?q?iate=20feedback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added ANSI color coding (Green for score, Red for Hard Mode, Blue for Normal Mode). - Implemented immediate UI updates on keypress for better tactile feedback. - Centralized UI rendering to ensure consistent state and clean terminal history. - Added bold styling to headers and final score summary. - Updated .Jules/palette.md with learnings. Co-authored-by: aidasofialily-cmd <247843425+aidasofialily-cmd@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ src/main.cpp | 23 +++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 01736b2..6f35fa5 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -6,3 +6,7 @@ ## 2026-01-09 - Terminal I/O and Blocking **Learning:** Standard terminal I/O is line-buffered by default. For real-time games, it's essential to use non-canonical mode (raw mode) to capture keypresses immediately. Also, internal journals should be kept clean if they are to be included in the repo. + +## 2026-02-05 - Immediate Tactile Feedback in CLI +**Learning:** In terminal-based games, users expect immediate visual feedback for their actions. Relying solely on a fixed-interval game loop for UI updates can make the application feel unresponsive or "laggy" if the loop interval is high. Centralizing rendering logic and triggering it immediately upon user input (key events) significantly improves the perceived responsiveness. +**Action:** Use an `updateUI` flag or a dedicated render function that can be called from both input handling and timer tick branches of the game loop. diff --git a/src/main.cpp b/src/main.cpp index a70e887..abd26a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,29 +13,32 @@ int main() { tcsetattr(STDIN_FILENO, TCSANOW, &newt); int score = 0; bool hardMode = false; char input; - std::cout << "==========================\n SPEED CLICKER\n==========================\n" - << "Controls:\n [h] Toggle Hard Mode (10x Speed!)\n [q] Quit Game\n [Any key] Click!\n\n"; + std::cout << "\033[1m==========================\n SPEED CLICKER\n==========================\033[0m\n" + << "Controls:\n [\033[1;33mh\033[0m] Toggle Hard Mode\n [\033[1;31mq\033[0m] Quit\n [Any key] Click!\n\n"; struct pollfd fds[1] = {{STDIN_FILENO, POLLIN, 0}}; auto last_tick = std::chrono::steady_clock::now(); while (true) { int timeout = hardMode ? 100 : 1000; + bool updateUI = false; if (poll(fds, 1, 0) > 0) { if (read(STDIN_FILENO, &input, 1) <= 0 || input == 'q') break; - if (input == 'h') { - hardMode = !hardMode; - std::cout << (hardMode ? "\n[HARD MODE] Speed x10!\n" : "\n[NORMAL MODE]\n"); - } else score++; + if (input == 'h') hardMode = !hardMode; + else score++; + updateUI = true; } auto now = std::chrono::steady_clock::now(); - auto elapsed = std::chrono::duration_cast(now - last_tick).count(); - if (elapsed >= timeout) { + if (std::chrono::duration_cast(now - last_tick).count() >= timeout) { score++; last_tick = now; - std::cout << "Score: " << score << (hardMode ? " [FAST] " : " [NORMAL] ") << "\r" << std::flush; + updateUI = true; + } + if (updateUI) { + std::cout << "\rScore: \033[1;32m" << score << "\033[0m " + << (hardMode ? "\033[1;31m[FAST]\033[0m" : "\033[1;34m[NORMAL]\033[0m") << " " << std::flush; } std::this_thread::sleep_for(std::chrono::milliseconds(10)); } tcsetattr(STDIN_FILENO, TCSANOW, &oldt); - std::cout << "\nFinal Score: " << score << "\nThanks for playing!\n"; + std::cout << "\n\n\033[1mFinal Score: \033[1;32m" << score << "\033[0m\nThanks for playing!\n"; return 0; } From 5538473408230515626f0ce7538321ec97a7f547 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:35:03 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20[UX=20improvement?= =?UTF-8?q?]=20-=20Colors,=20responsive=20feedback,=20and=20CI=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enhanced SPEED CLICKER with ANSI colors (Green/Red/Blue/Yellow) and bold text. - Implemented immediate tactile feedback by updating the UI on every keypress. - Fixed broken CI by replacing the Rust workflow with a proper C++ build workflow using `make`. - Updated .Jules/palette.md with UX and terminal feedback learnings. Co-authored-by: aidasofialily-cmd <247843425+aidasofialily-cmd@users.noreply.github.com> --- .github/workflows/{rust.yml => build.yml} | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) rename .github/workflows/{rust.yml => build.yml} (58%) diff --git a/.github/workflows/rust.yml b/.github/workflows/build.yml similarity index 58% rename from .github/workflows/rust.yml rename to .github/workflows/build.yml index 9fd45e0..fb7ff15 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Rust +name: Build and Test on: push: @@ -6,17 +6,13 @@ on: pull_request: branches: [ "main" ] -env: - CARGO_TERM_COLOR: always - jobs: build: - runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + run: make + - name: Run Smoke Test + run: ./game <<<'q' | grep "Thanks for playing!"