Compare commits

..

No commits in common. "main" and "v0.0.1" have entirely different histories.
main ... v0.0.1

129 changed files with 60 additions and 9550 deletions

View file

@ -1,8 +1,10 @@
---
# We'll use defaults from the LLVM style, but with 4 columns indentation.
BasedOnStyle: LLVM
IndentWidth: 4
---
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left
---

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
build
.vscode
/.vs

View file

@ -1,41 +0,0 @@
# ParadiSO - eine minimale 2D-Grafikengine
**ParadiSO** wurde als stark abgespeckte 2D-Version meiner `pixwerx`-Engine konzipiert. _ParadiSO_ verfolgt einen minimalistischen Ansatz für 2D-Grafik zu Bildungszwecken. Es verwendet modernes C++ und ein datengetriebenes Design, jedoch keine ECS (Entity Component System).
## Bildungszwecke
Einige Argumente für seinen Bildungsaspekt:
- Kombination verschiedener Konzepte und Paradigmen zur Erstellung ausdrucksstarker, aber knappen Codes
- Stark von Rust-Code inspiriert
- Für den mathematischen Code wird eine sofortige Auswertung verwendet (keine Expression-Templates), jedoch mit der Verwendung von `constexpr`, um eventuelle Performance-Overheads auszugleichen und optimale Vektorisierung zu erreichen.
- Versteckt alte `C`-APIs hinter einer modernisierten Fassade
- Es lehnt sich stark an die STL und ihre Algorithmen an
## Minimalistisch
Da diese Engine einige Muster und Designkonzepte zeigen soll, versucht sie, unnötigen Ballast zu vermeiden.
## Abhängigkeiten
ParadiSO wird mit den notwendigen Komponenten geliefert. Diese sollte jedoch hier erwähnt werden:
- [GLFW 3.3.8](https://github.com/glfw/glfw)
- [GLAD](https://github.com/Dav1dde/glad)
- [STB image](https://github.com/nothings/stb)
## Toolchains
ParadiSO kann auf verschiedenen Plattformen gebaut werden
- Windows (Visual Studio Build Tools 2022)
- MacOS (clang 14 or later)
- Linux (clang 14 or later, gcc 13.2.1)
Andere Kombinationen sind möglich aber nicht getestet.
## Beiträge
- [Tim Götzelmann](https://code.technotecture.net/Timeplex) Windows Build
- [Robin Rottstädt](https://code.technotecture.net/robin_rottstaedt) Flappy Bird Clone, Bitmap Loader
- [brxxh](https://code.technotecture.net/brxxh) Flappy Bird Clone

View file

@ -1,16 +1,16 @@
# ParadiSO - a minimal 2D graphics engine
# ParadisSO - a minimal 2D graphics engine
**ParadiSO** was conceived as a heavily stripped down 2D version of my `pixwerx` engine. _ParadiSO_ mimics a minimalistic approach to 2D graphics for educational purposes. It uses modern C++ and a data-driven design, but no ECS.
**ParadiSO** was conceived as a heavily stripped down 2D version of my `pixwerx` engine. *ParadiSO* mimics a minimalistic approach to 2D graphics for educational purposes. It uses modern C++ and a data-driven design, but no ECS.
## Educational
Some arguments for its educational side:
- mix and match of various concepts and paradigms to write expressive but concise code
- heavily inspired by Rust code
- math code is eager evaluation but `constexpr` to compensate overheads
- hides old-style `C` APIs behind a renovated facade
- it leans heavily on the STL and its algorithms
* mix and match of various concepts and paradigms to write expressive but concise code
* heavily inspired by Rust code
* math code is eager evaluation but `constexpr` to compensate overheads
* hides old-style `C` APIs behind a renovated facade
* it leans heavily on the STL and its algorithms
## Minimal
@ -20,22 +20,6 @@ Because this engine should show some patterns and design concepts it tries to av
ParadiSO comes with batteries included. However, it should be mentioned here:
- [GLFW 3.3.8](https://github.com/glfw/glfw)
- [GLAD](https://github.com/Dav1dde/glad)
- [STB image](https://github.com/nothings/stb)
* [GLFW 3.3.8](https://github.com/glfw/glfw)
* [GLAD](https://github.com/Dav1dde/glad)
## Toolchains
ParadiSO is being developed to work on all major desktop systems.
- Windows (Visual Studio Build Tools 2022)
- MacOS (clang 14 or later)
- Linux (clang 14 or later, gcc 13.2.1)
Other combinations might work but are untested.
## Contributors
- [Tim Götzelmann](https://code.technotecture.net/Timeplex) Windows Build
- [Robin Rottstädt](https://code.technotecture.net/robin_rottstaedt) Flappy Bird Clone, Bitmap Loader
- [brxxh](https://code.technotecture.net/brxxh) Flappy Bird Clone

View file

@ -1,50 +0,0 @@
# Todo
Here some ideas for improving this tiny engine:
## Rendering
- [ ] replace the OpenGL renderer with a Vulkan backend
- [ ] add animatable sprites (access to UV mapping and tiling)
- [ ] add a SDF based renderer (parametric tiles and font rendering)
## Game Support
- [ ] audio!
- [ ] some minimal animation system with tweening with different f-curves
## System Level
- [ ] add a `Asset` handler to load cache and manage assets
- [ ] introspection of file system if we load assset
## Design
- [ ] replace some of the 'unkown source' assets
## Build / Dev Support
- [ ] add a test rig either with Snitch or Catch2
- [ ] write some reasonable testcases
- [ ] add CPU and GPU benchmarks to address various issues
# Issues
```sh
Performance counter stats for 'bin/paradiso_pong':
555,35 msec task-clock:u # 0,042 CPUs utilized
0 context-switches:u # 0,000 /sec
0 cpu-migrations:u # 0,000 /sec
4.072 page-faults:u # 7,332 K/sec
319.484.735 cycles:u # 0,575 GHz
358.165.995 instructions:u # 1,12 insn per cycle
86.037.942 branches:u # 154,926 M/sec
2.469.068 branch-misses:u # 2,87% of all branches
13,092775373 seconds time elapsed
0,311565000 seconds user
0,247491000 seconds sys
```
above run with `perf stat bin/paradiso_pong` shows some really bad performance issues.

View file

@ -1,3 +1,2 @@
add_subdirectory(simple)
add_subdirectory(pong)
add_subdirectory(quickwings)

View file

@ -1,7 +1,7 @@
/**
* paradiso - Paradigmen der Softwareentwicklung
*
* (c) Copyright 2023-2024 Hartmut Seichter
* (c) Copyright 2023 Hartmut Seichter
*
*/
@ -16,6 +16,7 @@
#include <unordered_map>
#include <iomanip>
#include <iostream>
struct PongStage {
@ -85,7 +86,7 @@ struct PongPaddle {
velocity_horizontal *= whoopiness;
sprite.pivot.x() += velocity_horizontal;
sprite.pivot.x() = std::clamp(sprite.pivot.x(), -0.5f, 0.5f);
std::clamp(sprite.pivot.x(), -0.5f, 0.5f);
// update shader uniforms
shader.set_uniform("pivot", sprite.pivot);
@ -150,7 +151,7 @@ struct PongBall {
void draw(const paradiso::Shader& shader) {
sprite.pivot.x() = std::clamp(sprite.pivot.x(), -0.5f, 0.5f);
std::clamp(sprite.pivot.x(), -0.5f, 0.5f);
// update shader uniforms
shader.set_uniform("pivot", sprite.pivot);
@ -165,9 +166,6 @@ struct PongBall {
paradiso::Renderer renderer{};
constexpr void push(const auto& impulse) noexcept { velocity += impulse; }
constexpr void whoop(const auto& whoopiness) noexcept { velocity *= whoopiness; }
};
auto main() -> int {
@ -236,19 +234,6 @@ auto main() -> int {
ball.sprite.pivot.x() = 0.0f;
ball.sprite.pivot.y() = 0.9f;
}
// speed adjust
if (w.keyboard_input().top().key == 'N') {
std::cout << "Speed Up!\n";
ball.push(paradiso::Vector2<float>::make(0.f,0.01f));
} else if (w.keyboard_input().top().key == 'M') {
ball.push(paradiso::Vector2<float>::make(0.f,-0.01f));
std::cout << "Speed Lower!\n";
}
}
ball.interact(stage);

View file

@ -1,20 +0,0 @@
set(quickwings_srcs quickwings.cpp)
set(quickwings_assets
assets/background-day.png
assets/base.png
assets/pipe-green.png
assets/yellowbird-downflap.png
assets/yellowbird-midflap.png
assets/yellowbird-upflap.png
)
set_source_files_properties(${quickwings_assets} PROPERTIES HEADER_FILE_ONLY TRUE)
add_executable(quickwings ${quickwings_srcs} ${quickwings_assets})
target_link_libraries(quickwings paradiso_core)
add_custom_command(TARGET quickwings POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/assets/ $<TARGET_FILE_DIR:quickwings>/assets)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View file

@ -1,14 +0,0 @@
<TextureAtlas imagePath="sheet.png">
<SubTexture name="planeBlue1.png" x="0" y="73" width="88" height="73"/>
<SubTexture name="planeBlue2.png" x="0" y="0" width="88" height="73"/>
<SubTexture name="planeBlue3.png" x="0" y="365" width="88" height="73"/>
<SubTexture name="planeGreen1.png" x="88" y="219" width="88" height="73"/>
<SubTexture name="planeGreen2.png" x="88" y="146" width="88" height="73"/>
<SubTexture name="planeGreen3.png" x="88" y="73" width="88" height="73"/>
<SubTexture name="planeRed1.png" x="88" y="0" width="88" height="73"/>
<SubTexture name="planeRed2.png" x="0" y="438" width="88" height="73"/>
<SubTexture name="planeRed3.png" x="88" y="292" width="88" height="73"/>
<SubTexture name="planeYellow1.png" x="0" y="292" width="88" height="73"/>
<SubTexture name="planeYellow2.png" x="0" y="219" width="88" height="73"/>
<SubTexture name="planeYellow3.png" x="0" y="146" width="88" height="73"/>
</TextureAtlas>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

View file

@ -1,81 +0,0 @@
<TextureAtlas imagePath="sheet.png">
<SubTexture name="UIbg.png" x="0" y="986" width="264" height="264"/>
<SubTexture name="background.png" x="0" y="355" width="800" height="480"/>
<SubTexture name="buttonLarge.png" x="0" y="1250" width="196" height="70"/>
<SubTexture name="buttonSmall.png" x="0" y="1320" width="136" height="80"/>
<SubTexture name="groundDirt.png" x="0" y="0" width="808" height="71"/>
<SubTexture name="groundGrass.png" x="0" y="142" width="808" height="71"/>
<SubTexture name="groundIce.png" x="0" y="71" width="808" height="71"/>
<SubTexture name="groundRock.png" x="0" y="284" width="808" height="71"/>
<SubTexture name="groundSnow.png" x="0" y="213" width="808" height="71"/>
<SubTexture name="letterA.png" x="412" y="835" width="61" height="64"/>
<SubTexture name="letterB.png" x="487" y="1537" width="50" height="66"/>
<SubTexture name="letterC.png" x="460" y="977" width="52" height="66"/>
<SubTexture name="letterD.png" x="432" y="1613" width="54" height="66"/>
<SubTexture name="letterE.png" x="511" y="1965" width="45" height="64"/>
<SubTexture name="letterF.png" x="512" y="963" width="44" height="64"/>
<SubTexture name="letterG.png" x="460" y="1107" width="52" height="66"/>
<SubTexture name="letterH.png" x="473" y="835" width="51" height="64"/>
<SubTexture name="letterI.png" x="524" y="835" width="22" height="64"/>
<SubTexture name="letterJ.png" x="512" y="1027" width="42" height="66"/>
<SubTexture name="letterK.png" x="432" y="1821" width="53" height="64"/>
<SubTexture name="letterL.png" x="512" y="899" width="44" height="64"/>
<SubTexture name="letterM.png" x="392" y="1967" width="66" height="64"/>
<SubTexture name="letterN.png" x="432" y="1679" width="53" height="64"/>
<SubTexture name="letterO.png" x="418" y="1284" width="60" height="66"/>
<SubTexture name="letterP.png" x="489" y="1427" width="48" height="65"/>
<SubTexture name="letterQ.png" x="418" y="1205" width="60" height="79"/>
<SubTexture name="letterR.png" x="478" y="1249" width="51" height="65"/>
<SubTexture name="letterS.png" x="511" y="1899" width="46" height="66"/>
<SubTexture name="letterT.png" x="460" y="1043" width="52" height="64"/>
<SubTexture name="letterU.png" x="485" y="1757" width="51" height="66"/>
<SubTexture name="letterV.png" x="400" y="913" width="61" height="64"/>
<SubTexture name="letterW.png" x="136" y="1320" width="76" height="64"/>
<SubTexture name="letterX.png" x="418" y="1409" width="58" height="64"/>
<SubTexture name="letterY.png" x="432" y="1473" width="57" height="64"/>
<SubTexture name="letterZ.png" x="486" y="1613" width="50" height="64"/>
<SubTexture name="medalBronze.png" x="0" y="1400" width="114" height="119"/>
<SubTexture name="medalGold.png" x="0" y="1519" width="114" height="119"/>
<SubTexture name="medalSilver.png" x="0" y="1638" width="114" height="119"/>
<SubTexture name="number0.png" x="432" y="1743" width="53" height="78"/>
<SubTexture name="number1.png" x="512" y="1093" width="37" height="76"/>
<SubTexture name="number2.png" x="477" y="1350" width="51" height="77"/>
<SubTexture name="number3.png" x="485" y="1679" width="51" height="78"/>
<SubTexture name="number4.png" x="432" y="1537" width="55" height="76"/>
<SubTexture name="number5.png" x="485" y="1823" width="50" height="76"/>
<SubTexture name="number6.png" x="432" y="1885" width="53" height="77"/>
<SubTexture name="number7.png" x="478" y="1173" width="51" height="76"/>
<SubTexture name="number8.png" x="461" y="899" width="51" height="78"/>
<SubTexture name="number9.png" x="458" y="1962" width="53" height="77"/>
<SubTexture name="planeBlue1.png" x="330" y="1371" width="88" height="73"/>
<SubTexture name="planeBlue2.png" x="372" y="1132" width="88" height="73"/>
<SubTexture name="planeBlue3.png" x="222" y="1562" width="88" height="73"/>
<SubTexture name="planeGreen1.png" x="114" y="1639" width="88" height="73"/>
<SubTexture name="planeGreen2.png" x="216" y="1951" width="88" height="73"/>
<SubTexture name="planeGreen3.png" x="222" y="1489" width="88" height="73"/>
<SubTexture name="planeRed1.png" x="216" y="1878" width="88" height="73"/>
<SubTexture name="planeRed2.png" x="372" y="1059" width="88" height="73"/>
<SubTexture name="planeRed3.png" x="372" y="986" width="88" height="73"/>
<SubTexture name="planeYellow1.png" x="304" y="1967" width="88" height="73"/>
<SubTexture name="planeYellow2.png" x="330" y="1298" width="88" height="73"/>
<SubTexture name="planeYellow3.png" x="330" y="1225" width="88" height="73"/>
<SubTexture name="puffLarge.png" x="114" y="1712" width="42" height="35"/>
<SubTexture name="puffSmall.png" x="196" y="1250" width="25" height="21"/>
<SubTexture name="rock.png" x="114" y="1400" width="108" height="239"/>
<SubTexture name="rockDown.png" x="324" y="1489" width="108" height="239"/>
<SubTexture name="rockGrass.png" x="0" y="1757" width="108" height="239"/>
<SubTexture name="rockGrassDown.png" x="264" y="986" width="108" height="239"/>
<SubTexture name="rockIce.png" x="216" y="1639" width="108" height="239"/>
<SubTexture name="rockIceDown.png" x="222" y="1250" width="108" height="239"/>
<SubTexture name="rockSnow.png" x="324" y="1728" width="108" height="239"/>
<SubTexture name="rockSnowDown.png" x="108" y="1757" width="108" height="239"/>
<SubTexture name="starBronze.png" x="170" y="1996" width="39" height="37"/>
<SubTexture name="starGold.png" x="369" y="1444" width="39" height="37"/>
<SubTexture name="starSilver.png" x="330" y="1444" width="39" height="37"/>
<SubTexture name="tap.png" x="156" y="1712" width="40" height="40"/>
<SubTexture name="tapLeft.png" x="0" y="1996" width="85" height="42"/>
<SubTexture name="tapRight.png" x="85" y="1996" width="85" height="42"/>
<SubTexture name="tapTick.png" x="418" y="1350" width="59" height="59"/>
<SubTexture name="textGameOver.png" x="0" y="835" width="412" height="78"/>
<SubTexture name="textGetReady.png" x="0" y="913" width="400" height="73"/>
</TextureAtlas>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 446 KiB

Some files were not shown because too many files have changed in this diff Show more