Skip to content

Commit

Permalink
WIP 6
Browse files Browse the repository at this point in the history
  • Loading branch information
stepulak committed Oct 20, 2020
1 parent c6d724c commit a4d3df1
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@ Algorithms which can be found in this application:
- Line seed fill of generic polygons
- Pineda's algorithm for triangle rasterization (min-max mechanism)

After you start the application, read the information and pick one algorithm using keyboard key.

Algorithms are based on user interaction (mouse), they are animated and can be stepped (E, S keys).

Using the application should be at least a little bit intuitive, if you follow the text in the top-left corner of your application.

Exit application using `escape` key.

### Build

To build this application you need to have `g++` (or similar compiler) installed with C++17 support.
Furthermore you ought to have `SDL2` and `SDL2_image` libraries in your computer.

In Ubuntu, install `g++`, `libsdl2-dev` and `libsdl2-image-dev` packages.

Then run `./build.sh` script. If compilation ends with success, run the `./icr-algo` application.
File renamed without changes
43 changes: 42 additions & 1 deletion build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
#!/bin/bash

COMPILER = g++
COMPILER="g++"
CFLAGS="-std=c++17 -c"
LFLAGS="-lSDL2 -lSDL2_image"
DIRECTORY="src/"
CPP_FILES="*.cpp"
OBJ_FILES="*.o"
APP_NAME="icr-algo"

function build() {
pushd $DIRECTORY

for file in `ls $CPP_FILES`; do
echo "Compiling '$file'..."

$COMPILER $CFLAGS $file

if [[ $? -ne 0 ]]; then
echo "Compilation of '$file' failed..."
echo "Exiting..."
exit -1
fi
done

echo "Linking..."

$COMPILER `ls $OBJ_FILES` $LFLAGS -o $APP_NAME

popd

mv $DIRECTORY$APP_NAME .

echo "Building finished!"
}

function clean() {
echo "Cleaning..."

rm $DIRECTORY$OBJ_FILES
}

build
clean
2 changes: 1 addition & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <iostream>

namespace {
constexpr auto FONT_BITMAP_FILENAME = "bitmapfont.png";
constexpr auto FONT_BITMAP_FILENAME = "assets/bitmapfont.png";
constexpr auto FONT_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:.[],-";
constexpr auto FONT_CHAR_WIDTH = 16u;
constexpr auto WINDOW_WIDTH = 1280;
Expand Down

0 comments on commit a4d3df1

Please sign in to comment.