Add README and build instructions to every example

This commit is contained in:
Captain4LK 2020-07-26 11:15:53 +02:00
parent ebfdc420a5
commit a82358325f
5 changed files with 39 additions and 2 deletions

View file

@ -7,3 +7,13 @@ This is a simple tool for simulating and visualising the electric fields and pot
This semi-small program has originally been written for my seminar paper and is released under the terms of the GNU General Public License v3.
In the program itself you can just press the information button (the one with an i) to acess a simple explanation of this program. It is however not currently finished. While most of the essential features are implemented, some other, big features like an editor are planned (and a button reserved) but not implemented yet.
## How to compile
If you are on linux and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too):
```
gcc -O3 -o resize *.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall #Compile to executable
chmod +x ./resize #Only needed on unix(-like) systems
```

View file

@ -0,0 +1,17 @@
# Performance
This example messures the performance of the rgb and palettized software renderer included in SoftLK. You can press r (rgb) and p(pal) to acess the two renderes and/or reset the timer.
On the top left you can see to numbers. The number on the left displays the average render time since the last reset, the right number shows how many sprites are beeing drawn. You can add more sprites by pressing/holding the space bar. In the top right corner the currently used renderer is beeing displayed.
![screenshot](../../screenshots/performance.png)
## How to compile
If you are on linux and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too):
```
gcc -O3 -o resize main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall #Compile to executable
chmod +x ./resize #Only needed on unix(-like) systems
```

View file

@ -2,6 +2,16 @@
This example demonstrates dynamic sized windows, layer scaling, moving and resizing. The image is drawn on a seperate layer, the window itself is resizeable with layer 1 being resized dynamicly. Hold the ctrl key and scroll the mouse wheel to scale the layer, hold the mouse wheel and move the mouse to move it.
## How to compile
If you are on linux and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too):
```
gcc -O3 -o resize main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall #Compile to executable
chmod +x ./resize #Only needed on unix(-like) systems
```
## Code Example
This code example creates a resizable window with one dynamic layer.

View file

@ -1,7 +1,7 @@
#!/bin/bash
cd "$(dirname "$0")"
gcc -O3 -o engine main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -ldl -Wall
gcc -O3 -o engine main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall
chmod +x engine
./engine
exit

View file

@ -1,7 +1,7 @@
#!/bin/bash
cd "$(dirname "$0")"
gcc -O3 -c ../src/*/*.c -lm -lSDL2 -ldl -lGL -Wall -Warray-bounds
gcc -O3 -c ../src/*.c -lm -lSDL2 -lGL -Wall
ar cr libSLK.a *.o
exit