From e9f32da98305cbf873ad93b93bb3b6af938d6656 Mon Sep 17 00:00:00 2001 From: opfez Date: Sun, 26 Sep 2021 19:54:27 +0200 Subject: [PATCH] add build script for nixos support --- Makefile | 1 - build.sh | 10 ++++++++++ main.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 build.sh diff --git a/Makefile b/Makefile index e69be41..956ac31 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -CC = clang CFLAGS = -Wall -Wextra -std=c99 -pedantic -O2 LIBS = -lSDL2 -lm diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..ebe13be --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +source /etc/os-release + +# Don't know how to just have SDL2 available on NixOS +if echo $ID | grep "nixos" 2>/dev/null >/dev/null; then + nix-shell -p SDL2 --run make +else + make +fi diff --git a/main.c b/main.c index b41044f..3c350c9 100644 --- a/main.c +++ b/main.c @@ -372,6 +372,8 @@ main(void) uint32_t buttons = SDL_GetMouseState(NULL, NULL); if (buttons & SDL_BUTTON(3)) break; + else if (buttons & SDL_BUTTON(1)) + screenshot(state.canvas); clear_canvas(state.canvas, BLACK);