From e1d5e0b5032f1a645d6e66bb14831ff658b39ebb Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Thu, 22 Sep 2022 19:44:53 +0200 Subject: [PATCH] Update the make script --- programs/make.sh | 24 +++++++++++++++++++++--- small3dlib.h | 10 +++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/programs/make.sh b/programs/make.sh index b0fdf6c..80fda17 100755 --- a/programs/make.sh +++ b/programs/make.sh @@ -1,5 +1,23 @@ -#!/bin/bash +#!/bin/sh -PROGRAM=testTerminal # change this to name of a program you want to compile :) +# Make script for small3dlib programs. +# by drummyfish +# released under CC0 1.0, public domain -clear; clear; g++ -x c -g -fmax-errors=5 -pedantic -O3 -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wno-unused-parameter -Wno-missing-field-initializers -o $PROGRAM $PROGRAM.c -lSDL2 2>&1 >/dev/null && ./$PROGRAM +if [ "$#" -ne 1 ]; then + echo "ERROR: expecting one argument, the name of program without extension (e.g. \"helloWorld\")" + exit 0 +fi + +link="" + +clear +clear + +flags="-x c -g -O3 -std=c99 -pedantic -Wall -Wextra -o $1 $1.c -lSDL2" +compiler=gcc +#compiler=clang + +echo "making:" ${compiler} ${flags} + +${compiler} ${flags} && ./$1 diff --git a/small3dlib.h b/small3dlib.h index fb3e446..a56337b 100644 --- a/small3dlib.h +++ b/small3dlib.h @@ -178,7 +178,7 @@ #define S3L_SIN_METHOD 0 #endif -/** Units of measurement in 3D space. There is S3L_F in one +/** Units of measurement in 3D space. There is S3L_FRACTIONS_PER_UNIT in one spatial unit. By dividing the unit into fractions we effectively achieve a fixed point arithmetic. The number of fractions is a constant that serves as 1.0 in floating point arithmetic (normalization etc.). */ @@ -190,10 +190,10 @@ typedef int32_t #endif S3L_Unit; - -/** How many fractions a spatial unit is split into. This is NOT SUPPOSED TO -BE REDEFINED, so rather don't do it (otherwise things may overflow etc.). */ - + +/** How many fractions a spatial unit is split into, i.e. this is the fixed +point scaling. This is NOT SUPPOSED TO BE REDEFINED, so rather don't do it +(otherwise things may overflow etc.). */ #define S3L_FRACTIONS_PER_UNIT 512 #define S3L_F S3L_FRACTIONS_PER_UNIT