From 2a42731628bf7428dd0444ac2fbd0802059e540d Mon Sep 17 00:00:00 2001 From: _brxxh <11dac2t@huhn-online.de> Date: Thu, 23 Nov 2023 17:49:07 +0100 Subject: [PATCH 1/9] fixed quickwings, added me to readme, fixed readme --- README.de.md | 39 ++++---- README.md | 32 +++---- examples/quickwings/assets/background-day.png | Bin 7026 -> 10361 bytes examples/quickwings/assets/base.png | Bin 470 -> 2300 bytes examples/quickwings/assets/blank.png | Bin 0 -> 466 bytes examples/quickwings/assets/gameover.png | Bin 0 -> 758 bytes examples/quickwings/assets/message.png | Bin 0 -> 1602 bytes examples/quickwings/quickwings.cpp | 89 ++++++++++++------ 8 files changed, 94 insertions(+), 66 deletions(-) create mode 100644 examples/quickwings/assets/blank.png create mode 100644 examples/quickwings/assets/gameover.png create mode 100644 examples/quickwings/assets/message.png diff --git a/README.de.md b/README.de.md index 6b3d0d6..274cee6 100644 --- a/README.de.md +++ b/README.de.md @@ -1,40 +1,41 @@ # 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). +**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: +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 +- 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. +Da diese Engine einige Muster und Designkonzepte zeigen soll, versucht sie, unnötigen Ballast zu vermeiden. -## Abh�ngigkeiten +## Abhängigkeiten -ParadiSO wird mit den notwendigen Komponenten geliefert. Diese sollte jedoch hier erw�hnt werden: +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) +- [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) +- 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 +## 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 \ No newline at end of file +- [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 diff --git a/README.md b/README.md index 6f3f006..07828bc 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,41 @@ # ParadiSO - 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 -Because this engine should show some patterns and design concepts it tries to avoid adding unnecessary bloat. +Because this engine should show some patterns and design concepts it tries to avoid adding unnecessary bloat. ## Dependencies 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) +- [STB image](https://github.com/nothings/stb) ## 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) +- 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 \ No newline at end of file +- [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 diff --git a/examples/quickwings/assets/background-day.png b/examples/quickwings/assets/background-day.png index afcb5ec982a3de74cb9186f6af3ba329d63a22bb..f9ed139c84f87b86b0ea31e47c729fde44f8b70d 100644 GIT binary patch literal 10361 zcmeHtXIB$i&~88w1S#qPJyHcZAcz&E6O<-RR18ShqYxq>V(5?rY;+>h1Oq{O3qh*1 z1QkSS37|j-Axevs5E3AiB;<1Ly+7go_WEIe*n6#6d#{;ip8d?MNw{&{N&x+`kV1XrzUt5wwKv9qR$M#hi?6mwtim^Y7F+2h}DKShl7XrBND z?%c-m8N3#iq%6OyrDV%@vU*6&Bx? z1HBL=-EVc_b`j+2>3CJ!>+KzdS;bXqmsDHT9P&Y#9EK64pLmzpaY`}-iQ^xCwiB>5 z!Qv6jsCc8k32czDSs4gJPz~^F9MDoWkmL1Cf7c8kAS5U>zwgU~YeLed zcQs4}Rivd&mF;4L{<0)=iYo8z_y5`d@y8!L{KL2JNuJG$TwwG%Z8zBbLM=jaT@TDBu8sKW_Q6U8b4&h#orvkg36;mNyDetYH4DVR zQ~aUa=GWkFQXi8%1+*U+j<3;pqO2fk=CHcG3?brd(4h7mwY7J;CgG|`QoWGZn7bTKNCB(1^$kE-|` zlKfD`fq2-8h78fQz38EJG5_*ta;ys1yUZhFV}#B}^dOJ-`e{M%hUx{Er< zMBH=1ef8@uPuHcpZWice2Q_XAT&TX|dQ=BT*oTb|&Z?r+-SQo>{Rd>8m(Sy3ak%r* z+;`4b4cxNOYEk1e4<@#X1aqAdLq(O(L1Ra;(JKr07V{}!9}KcKfWlNI&4PXWnp^zn z*B8O_E(5W_muNR3uy0q8AEcbx!-*~lH?*#|$GjnL@SG=;2MtJ})g1S}yA3)K{%ua= zraZ)|&)X#zb}v|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>Q3r3&<-y@XOP{PN1ss{C+Ir z(@nfIYn7j4u^kww+g?hL8co&$k&XmfbaFb`|~{?1`& zi%v>C)wQTbIX6Z-zw>U=jrD`nMk;912wGqs-tfjM)e*Jt8*2DWV7Q~e!*%j9`aaLRbv4~$XS~7ID?dRw} zA=b^laiF@e=`GiRhMeqJD?_-(P?dd!jNYi9H}Cq*6Y!7te+_{aY+Q6Z@lR)+gZ`(~ z(bNk!Qg7c(jXVQQj?@c)!%2IW6DJ){*xO&TcRq8{;f%eD^+~5QCr^I(+NJw{C?vpc b$3|uR-wMAWen9IL0NxiM9{6v+|M9;7ImZIa diff --git a/examples/quickwings/assets/base.png b/examples/quickwings/assets/base.png index c374f2b34f2d8a75f74641775970314b462cb337..2ba45d32091724ae7160522722bb3cfa63d3a345 100644 GIT binary patch literal 2300 zcmeAS@N?(olHy`uVBq!ia0y~yU|IlV7jUov$%Atb9cEx)%*%9k4#-SSW?;~mSUT~% zHcO(!ar@mJI-W8r?Urv&HGW$B6ZoJ&!ug)=2L@6IasHQwyG?$l97%Z~1N_Wz9G zPrWoV4zrSpJzp+3mU+m7UKn)RFbxXnPX_t$m{u=kX zWTZCC$lLYp#+8t!`s>Ga6+`oXg{=So{_jqu?rGUhD;z6sY?1YkSf;q~(akRN*4t<2 z?9-@Gxbyl%!=dS3=1g@#b9jIFZk+7Z=N$3%$|n08KMtmy)8zQh;m-YYQshkcTF=R$ zb7oGvrMa7Xx{C0Tiv}7SUF7=hR=S>ilOJDy)BNP73ZKf`YaVqdd;9I#yJ*^y)vBh- zyHx$>g--qb-sbL^3ketYYVwu#@B1&+{44jztxtc?JKz6r)ijIULO<;9=}DJQ?0yj) zs=JF{_jN&4;ME>ki`xx-)zRf&Hial#&pCPEG^fe(g>R*#o;R=2dMMgV7lM`SSr1K$x4W}K?cC(XdXZsO_U7*Y}U_O4@AaG=QX zhb~O-4tI7a@ZD|X;44+lJFru_P<)+JSMhd5QLQTrRNk}X)t`OvdP{%#q3gx(|K6YM z_+9?qp1pT}DmpYUFfy@l2q*|}+H}6saE5Um9{45v|9o9sIN&T?$pp?B4QW@n1Qnnn zcYGb}YpY8yvV1xEdAj(?yMKPvUHp8neqJ~K{A9-0uWRf-JS^5p_`jw8mi_aIZx(*{ z7ryZG{-Mbr+rTDpv+!Lm-(k562>rrO=Y79m?*88Vrt!_$>)oGE|9twVX}tc`pGizs z|7TZBg1XWnq4B^omMdp30%764ORHu-{vsT?|JwSm*0H+#cHWq@Y5&h>sZY)I)fPl+ zpL@>Qe|!Gh^R=O$zJLGr{Pmsrz7EfA z-*|$91L(j;R;K^H4tLjp;B)QMXMb7cUt4ZB_3zn#Y4w};-<1EyVe{>0Dw9=w_dFF? z7)2-)*fW|+8UW#p^(&6=v;6nlb8Y%X?v`F>lMyeYkY-d}bfU^vWsifj-2WMLqj z{L{E=;XV=Lcw=8zSGN0sZJZ-Kt`bxdn5>dM z2|!}fq2Yj5*tQ2tg3Nxa?K}(@w*_|$U0^?Xv1vA1yK~%sYIPWOjdX@lNm=OvSxHuMQ zZcl>yjA?}&ER70yu(Dj35^V^JR7S=S{!#BSjmF++;^Yt*QF-r!^v4(B@hP)|n1Gck NgQu&X%Q~loCIAIj%eDXj literal 470 zcmeAS@N?(olHy`uVBq!ia0y~yUG}$vdpD;3|NsAJp`$ub4P%nGy9>KmV#jMBhqJ&VvY3H^?+6GpPSxg< z1`4v5c>21sKW64(U=n`*OLYfOXql&rV@SoVx91!=nHU*Z1GOU#a)oVZ5`81@cw_el z_QdChXJ3}N|8|*uxqK%3FN-Rz*Q7`oU(j#<^uFNA z%(zmZi&aZpBT7;dOH!?pi&B9UgOP!urLKXouAyOwp@o%!k(HsPwt<FVdQ&MBb@03g?$h5!Hn diff --git a/examples/quickwings/assets/blank.png b/examples/quickwings/assets/blank.png new file mode 100644 index 0000000000000000000000000000000000000000..5c1b88f4045da9b1d191fb5b907e85fca4542ce3 GIT binary patch literal 466 zcmV;@0WJQCP)q)jWdF(fHcTm=^g!9jHK zYw#cFD!3{Lf+C2xx%;(9iRZS37SS7S&cl1}dpLOmp+wHidrcFNw|zGmk7)~wOIph- zZG?%?&ZusB&g9HYf`8Z7Jq@bfMOCl=@BO*jQ)$nHhF0M*({X)anTEu=?Py0Ddwy1G zkL+GNlEjIjVNhU|96nL0wq*9VZ@BE6W=%Y%yd8?T;>eH{?~tek>6(^miJq1xM^WYe zJ5SFV9jSB=$DsK+2;TdlWfw|2LGXPX1f>&be1c26=3kSX#y>^hscC(O5ZQ$DtD0u) z!NnGIKRUXrm!(G8Av~=QQY`6?zK#qG8~eHcB(ehe3dtTp zz6=aistgPb%?u1b{{!il3=E|P3=FRl7#OT(0Cnb1ia+WGRBI666XN>+KTrui5MtpD zL_lSK7I-{KkT{)kY#vZKPf3tpFwlA?HfDB44p#0zv)_qt0E#mvdAqwXbg;^L06Clm z9+AZi4BWyX%*Zfnjs#GUy~NYkmHja@4+E3%^IxhvfO@8Rx;Tb-9KSmKVD4c99@ni- z6IhviFD!5n&tUW5pQ+GrG24IE0*Ai6X|3ym)-4d-(xeqFXn{4@1l2{lx8d|iC} zkYKRyDWm<|FFuJ}t9rC^!>{QK4!%0C_*=p+*QX@Q8NAMrYM7qS=$9^Qwf?+pTIsI| zCGtVCjI$QCr5u>jz3JY^c_IhCZ`zXJ&A6fT0E68$WkKP!K@C=i3qLkKP;jW-pxkV6 zz?bQSrNym=jgA5V*M2e{xG(ZRiXrZawnOAgF@|`zH@~7B{=7TI{HpTWi=PdjLO+T# z4oU-o9h?Opt8>ukAa*&$cI$lNeYxFSSTa(s+Mk@;w!X`6s)5n8c(H zn*t+EwZt`|BqgyV)hf9t6-Y4{85mmX8W`&u8ip8JSQ!{u8Cq%^m{}PZJk+v0jG`eo aKP5A*61Rp4<&E_~4Gf;HelF{r5}E*LS`Uf< literal 0 HcmV?d00001 diff --git a/examples/quickwings/assets/message.png b/examples/quickwings/assets/message.png new file mode 100644 index 0000000000000000000000000000000000000000..9243ab58b2910ae63393eb28ac5867237826d7e0 G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uBahxWajI=*fPRdOBIuo zzad+0m=GkVZ1Xuwk}cEv;{qdOgnyged0ojJd$lrFV!E|QwN68k>EPM~`;*l|6W(I^ zbU0_Udtvq2tG9w#QbK7`irpd3TfxA%x#h-UR1p3khuNL>sy=Novll<1*{+=5b&Qp> zIDNz=`=x7xF2&^xb;i*-a?RLc`@o4|NRU7tiW-#`=b}uAqoR~D zECC;Gf~2SBK)DEC=oO@XU!L`KH0OIO?&or*fS-L0{-713C{+!MVI!u@&M4_?Q$<*a zbcV5NFz&!$94yk(B5C@aj&9?7+;)N^qIgU__c)7=-R}81aMC(I#`hz6WlN()eI8rY z?65zO)Phn$(1C)do!2Q##mM{e>n$uZI-eRR>TG-xmyEcv#gEZ0;>F7J-=S!C*=8f1 z)7N?COlx~tj5|amS1=f^lqGUn=fO`A8Bg?&4-bitz=fTN00CHF%xz3CmL}%r-sV^w s#sX(::make(0.0f, 0.0f), - .scale = paradiso::Vector2::make(1.01f, 1.0f)}; + .pivot = {paradiso::Vector2::make(0.0f, 0.16f)}, + .scale = {paradiso::Vector2::make(1.01f, 1.3f)}}; backgroundRight = paradiso::Sprite{ .bitmap = backgroundImage, - .pivot = paradiso::Vector2::make(2.0f, 0.0f), - .scale = paradiso::Vector2::make(1.01f, 1.0f)}; + .pivot = {paradiso::Vector2::make(2.018f, 0.16f)}, + .scale = {paradiso::Vector2::make(1.01f, 1.3f)}}; auto grassImage = paradiso::BitmapIO::get().load("base.png"); grassLeft = paradiso::Sprite{ .bitmap = grassImage, - .pivot = paradiso::Vector2::make(0.0f, -1.0f), - .scale = paradiso::Vector2::make(1.0f, 0.33333f)}; + .pivot = {paradiso::Vector2::make(0.0f, -1.0f)}, + .scale = {paradiso::Vector2::make(1.0f, 0.33333f)}}; grassRight = paradiso::Sprite{ .bitmap = grassImage, - .pivot = paradiso::Vector2::make(2.0f, -1.0f), - .scale = paradiso::Vector2::make(1.0f, 0.33333f)}; + .pivot = {paradiso::Vector2::make(2.0f, -1.0f)}, + .scale = {paradiso::Vector2::make(1.0f, 0.33333f)}}; } void draw(const paradiso::Shader& shader) { @@ -61,7 +61,7 @@ struct Background { if (sprite->pivot.x() <= -2.0f) { sprite->pivot.x() += 4.0f; } - sprite->pivot.x() -= 0.001f; + sprite->pivot.x() -= 0.002f; shader.set_uniform("pivot", sprite->pivot); shader.set_uniform("scale", sprite->scale); shader.set_uniform("rotation", sprite->rotation); @@ -79,23 +79,23 @@ struct Grass { paradiso::Sprite* scrolling[2] = {&grassLeft, &grassRight}; Grass() { - auto grassImage = paradiso::BitmapIO::get().load(std::string("base.png")); + auto grassImage = paradiso::BitmapIO::get().load("base.png"); grassLeft = paradiso::Sprite{ .bitmap = grassImage, - .pivot = paradiso::Vector2::make(0.0f, -0.9f), - .scale = paradiso::Vector2::make(1.0f, 0.33333f)}; + .pivot = {paradiso::Vector2::make(1.0f, -0.9f)}, + .scale = {paradiso::Vector2::make(2.0f, 0.33333f)}}; grassRight = paradiso::Sprite{ .bitmap = grassImage, - .pivot = paradiso::Vector2::make(2.0f, -0.9f), - .scale = paradiso::Vector2::make(1.0f, 0.33333f)}; + .pivot = {paradiso::Vector2::make(1.0f, -0.9f)}, + .scale = {paradiso::Vector2::make(2.6f, 0.33333f)}}; } void draw(const paradiso::Shader& shader) { for (auto sprite : scrolling) { - if (sprite->pivot.x() <= -2.0f) { - sprite->pivot.x() += 4.0f; + if (sprite->pivot.x() <= -1.0f) { + sprite->pivot.x() += 2.0f; } - sprite->pivot.x() -= 0.035f; + sprite->pivot.x() -= 0.03f; shader.set_uniform("pivot", sprite->pivot); shader.set_uniform("scale", sprite->scale); shader.set_uniform("rotation", sprite->rotation); @@ -106,6 +106,7 @@ struct Grass { paradiso::Renderer renderer{}; }; + struct QuickWings { paradiso::Renderer renderer1{}; @@ -118,10 +119,10 @@ struct QuickWings { unsigned int flapCounter = 0; // How many ticks since last flap float velocity = 0.0f; - const float max_velocity = 0.05f; + const float max_velocity = 0.04f; const float gravity = -0.004f; - const float move_up_velocity = 0.0055f; + const float move_up_velocity = 0.04f; bool move_up = false; bool paused = true; @@ -129,30 +130,30 @@ struct QuickWings { const float max_pos = 0.95f; const float min_pos = -0.5f; - float pos = 0.0f; + float pos = 0.34f; float rotation = 0.0f; QuickWings() { - float scaleh = 0.07f; - float scalew = scaleh * 1.416666666666667f; + float scaleh = 0.08f; + float scalew = 0.158f; birds = { paradiso::Sprite{ .bitmap = paradiso::BitmapIO::get().load("yellowbird-downflap.png"), - .pivot = paradiso::Vector2::make(0.0f, 0.0f), - .scale = paradiso::Vector2::make(scalew, scaleh)}, + .pivot = {paradiso::Vector2::make(0.0f, 0.0f)}, + .scale = {paradiso::Vector2::make(scalew, scaleh)}}, paradiso::Sprite{ .bitmap = paradiso::BitmapIO::get().load("yellowbird-midflap.png"), - .pivot = paradiso::Vector2::make(0.0f, 0.0f), - .scale = paradiso::Vector2::make(scalew, scaleh)}, + .pivot = {paradiso::Vector2::make(0.0f, 0.0f)}, + .scale = {paradiso::Vector2::make(scalew, scaleh)}}, paradiso::Sprite{ .bitmap = paradiso::BitmapIO::get().load("yellowbird-upflap.png"), - .pivot = paradiso::Vector2::make(0.0f, 0.0f), - .scale = paradiso::Vector2::make(scalew, scaleh)}}; + .pivot = {paradiso::Vector2::make(0.0f, 0.0f)}, + .scale = {paradiso::Vector2::make(scalew, scaleh)}}}; } void draw(const paradiso::Shader& shader) { @@ -185,6 +186,7 @@ struct QuickWings { } void update() { + // Stop game if (paused) return; @@ -213,7 +215,7 @@ struct QuickWings { } // Update rotation - rotation = velocity * 15.0f; + rotation = velocity * 10.0f; } // keyboard handler @@ -231,6 +233,30 @@ struct QuickWings { } }; +/* +TODO: finish this + +struct Message { + paradiso::Sprite messageSprite; + paradiso::Renderer renderer{}; + + Message() { + auto messageImage = paradiso::BitmapIO::get().load("message.png"); + messageSprite = paradiso::Sprite{ + .bitmap = messageImage, + .pivot = {paradiso::Vector2::make(0.0f, 0.0f)}, + .scale = {paradiso::Vector2::make(0.8f, 0.8f)} + }; + }; + + void draw(const paradiso::Shader& shader) { + shader.set_uniform("pivot", messageSprite.pivot); + shader.set_uniform("scale", messageSprite.scale); + renderer.draw(messageSprite, shader); + } +}; +*/ + auto main() -> int { // Ausgabefenster ... sieht aus als wäre es auf dem Stack @@ -274,9 +300,9 @@ auto main() -> int { paradiso::BitmapIO::get().set_path("assets"); // Load + //* auto message = Message{}; auto background = Background{}; auto grass = Grass{}; - auto quickwingsapp = QuickWings{}; // timer @@ -298,6 +324,7 @@ auto main() -> int { // Draw background.draw(shader); grass.draw(shader); + //* message.draw(shader); quickwingsapp.draw(shader); // wait for frame rate From 500464fa73b1463d7353b407eb290c918d35aa72 Mon Sep 17 00:00:00 2001 From: _brxxh <11dac2t@huhn-online.de> Date: Thu, 23 Nov 2023 18:19:24 +0100 Subject: [PATCH 2/9] Added welcome-message --- examples/quickwings/quickwings.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index 6146f12..ac626a0 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -233,12 +233,13 @@ struct QuickWings { } }; -/* -TODO: finish this +// TODO: finish this struct Message { paradiso::Sprite messageSprite; paradiso::Renderer renderer{}; + bool start = false; + float pos = 100.0f; Message() { auto messageImage = paradiso::BitmapIO::get().load("message.png"); @@ -254,8 +255,20 @@ struct Message { shader.set_uniform("scale", messageSprite.scale); renderer.draw(messageSprite, shader); } + + void update() { + if (start == true) { + messageSprite.pivot.y() = pos; + } + } + + void on_keyboard(const paradiso::Window::KeyboardInputStack& input) { + if (input.size()) { + start = true; + } + } }; -*/ + auto main() -> int { @@ -300,7 +313,7 @@ auto main() -> int { paradiso::BitmapIO::get().set_path("assets"); // Load - //* auto message = Message{}; + auto message = Message{}; auto background = Background{}; auto grass = Grass{}; auto quickwingsapp = QuickWings{}; @@ -321,10 +334,13 @@ auto main() -> int { quickwingsapp.on_keyboard(w.keyboard_input()); quickwingsapp.update(); + message.on_keyboard(w.keyboard_input()); + message.update(); + // Draw background.draw(shader); grass.draw(shader); - //* message.draw(shader); + message.draw(shader); quickwingsapp.draw(shader); // wait for frame rate From 7a3afe12819754d597cf30099423fabe381348cb Mon Sep 17 00:00:00 2001 From: _brxxh <11dac2t@huhn-online.de> Date: Thu, 23 Nov 2023 18:59:30 +0100 Subject: [PATCH 3/9] Addded game over to quickwings --- examples/quickwings/quickwings.cpp | 92 +++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index ac626a0..2a91d22 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -5,6 +5,7 @@ * */ +#include #include #include #include @@ -24,6 +25,7 @@ // #include "lib/image_loader.hpp" const int frame_rate = 60; +bool game_over = false; struct Background { paradiso::Sprite backgroundLeft; @@ -187,47 +189,60 @@ struct QuickWings { void update() { + if (game_over == true) { + paused = true; + } + // Stop game if (paused) return; + else { + // Apply gravity + velocity += gravity; - // Apply gravity - velocity += gravity; + if (move_up) + velocity += move_up_velocity - gravity; - if (move_up) - velocity += move_up_velocity - gravity; + // Cap velocity + if (velocity > max_velocity) + velocity = max_velocity; + if (velocity < -max_velocity) + velocity = -max_velocity; - // Cap velocity - if (velocity > max_velocity) - velocity = max_velocity; - if (velocity < -max_velocity) - velocity = -max_velocity; + // Cap position + pos += velocity; + if (pos < min_pos) { + pos = min_pos; + velocity = 0.0f; + game_over = true; + } + if (pos > max_pos) { + pos = max_pos; + velocity = 0.0f; + game_over = true; + } - // Cap position - pos += velocity; - if (pos < min_pos) { - pos = min_pos; - velocity = 0.0f; + // Update rotation + rotation = velocity * 10.0f; } - if (pos > max_pos) { - pos = max_pos; - velocity = 0.0f; - } - - // Update rotation - rotation = velocity * 10.0f; } // keyboard handler void on_keyboard(const paradiso::Window::KeyboardInputStack& input) { if (input.size()) { paused = false; - bool pressed_up = input.top().key == ' ' || input.top().key == 'W'; - if (input.top().action == 1 && pressed_up) { - move_up = true; - } else if (input.top().action == 0 && pressed_up) { - move_up = false; + if (paused == false) { + bool pressed_up = input.top().key == ' ' || input.top().key == 'W'; + + if (input.top().action == 1 && pressed_up) { + move_up = true; + } else if (input.top().action == 0 && pressed_up) { + move_up = false; + } + } + else { + return; } } } @@ -269,6 +284,25 @@ struct Message { } }; +struct GameOverMessage { + paradiso::Sprite messageSprite; + paradiso::Renderer renderer{}; + + GameOverMessage() { + auto messageImage = paradiso::BitmapIO::get().load("gameover.png"); + messageSprite = paradiso::Sprite{ + .bitmap = messageImage, + .pivot = {paradiso::Vector2::make(0.0f, 0.4f)}, + .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 192.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 42.0f)) / 700.0f) * 2.25f)} + }; + }; + + void draw(const paradiso::Shader& shader) { + shader.set_uniform("pivot", messageSprite.pivot); + shader.set_uniform("scale", messageSprite.scale); + renderer.draw(messageSprite, shader); + } +}; auto main() -> int { @@ -317,6 +351,7 @@ auto main() -> int { auto background = Background{}; auto grass = Grass{}; auto quickwingsapp = QuickWings{}; + auto gameover = GameOverMessage{}; // timer @@ -341,6 +376,11 @@ auto main() -> int { background.draw(shader); grass.draw(shader); message.draw(shader); + + if (game_over == true) { + gameover.draw(shader); + } + quickwingsapp.draw(shader); // wait for frame rate From 6ae437ef75b5ea9634d628cb1bf7407481f7c2a0 Mon Sep 17 00:00:00 2001 From: _brxxh <11dac2t@huhn-online.de> Date: Thu, 23 Nov 2023 19:17:57 +0100 Subject: [PATCH 4/9] Setted window "spawn point" to middle of screen --- examples/quickwings/quickwings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index 2a91d22..9ba279e 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -319,7 +319,7 @@ auto main() -> int { */ window .set_size(size) // ... Grösse - .set_position(paradiso::Point{.x = 100, .y = 100}) // ... Position + .set_position(paradiso::Point{.x = 1920 / 2 - 500 / 2, .y = 1080 / 2 - 700 / 2}) // ... Position .set_title("PardiSO.FlappyBird") // ... Titel .set_visible(true); // ... und jetzt anzeigen! From 68915cb24b864fde5c8a69451ae70664e819c84a Mon Sep 17 00:00:00 2001 From: brxxh <11dac2t@huhn-online.de> Date: Thu, 23 Nov 2023 20:10:35 +0100 Subject: [PATCH 5/9] Added test pipe sprite to quickwings (random pos) --- examples/quickwings/quickwings.cpp | 52 ++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index 9ba279e..45d1446 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -5,6 +5,7 @@ * */ +#include #include #include #include @@ -21,6 +22,8 @@ #include #include #include +#include +#include // #include "lib/image_loader.hpp" @@ -74,12 +77,49 @@ struct Background { paradiso::Renderer renderer{}; }; +struct Pipe { + paradiso::Sprite pipe_top; + paradiso::Sprite pipe_bottom; + + paradiso::Renderer renderer1{}; + paradiso::Renderer renderer2{}; + + int pipe_spawn_rand_int = rand() % 80 + 25; + float pipe_spawn_rand = float(pipe_spawn_rand_int) / 100; + + Pipe() { + auto pipe_image = paradiso::BitmapIO::get().load("pipe-green.png"); + + pipe_top = paradiso::Sprite{ + .bitmap = pipe_image, + .pivot = {paradiso::Vector2::make(0.0f, pipe_spawn_rand + 1.0f)}, + .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 320.0f)) / 700.0f) * 2.25f)}, + .rotation = 3.1415926f}; + pipe_bottom = paradiso::Sprite{ + .bitmap = pipe_image, + .pivot = {paradiso::Vector2::make(0.0f, pipe_spawn_rand - 1.6f)}, + .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 320.0f)) / 700.0f) * 2.25f)}}; + } + + void draw(const paradiso::Shader& shader) { + shader.set_uniform("pivot", pipe_bottom.pivot); + shader.set_uniform("scale", pipe_bottom.scale); + renderer1.draw(pipe_bottom, shader); + + shader.set_uniform("pivot", pipe_top.pivot); + shader.set_uniform("scale", pipe_top.scale); + shader.set_uniform("rotation", pipe_top.rotation); + renderer1.draw(pipe_top, shader); + } +}; + struct Grass { paradiso::Sprite grassLeft; paradiso::Sprite grassRight; - paradiso::Sprite* scrolling[2] = {&grassLeft, &grassRight}; + paradiso::Renderer renderer{}; + Grass() { auto grassImage = paradiso::BitmapIO::get().load("base.png"); grassLeft = paradiso::Sprite{ @@ -104,13 +144,10 @@ struct Grass { renderer.draw(*sprite, shader); } } - - paradiso::Renderer renderer{}; }; struct QuickWings { - paradiso::Renderer renderer1{}; paradiso::Renderer renderer2{}; paradiso::Renderer renderer3{}; @@ -248,8 +285,6 @@ struct QuickWings { } }; - -// TODO: finish this struct Message { paradiso::Sprite messageSprite; paradiso::Renderer renderer{}; @@ -305,6 +340,7 @@ struct GameOverMessage { }; auto main() -> int { + std::srand(std::time(nullptr)); // Ausgabefenster ... sieht aus als wäre es auf dem Stack auto window = paradiso::Window(); @@ -347,10 +383,11 @@ auto main() -> int { paradiso::BitmapIO::get().set_path("assets"); // Load - auto message = Message{}; auto background = Background{}; auto grass = Grass{}; auto quickwingsapp = QuickWings{}; + auto pipe = Pipe{}; + auto message = Message{}; auto gameover = GameOverMessage{}; // timer @@ -374,6 +411,7 @@ auto main() -> int { // Draw background.draw(shader); + pipe.draw(shader); grass.draw(shader); message.draw(shader); From ba56c0d91172a5a7357ad9200bfa955bf35d0f7c Mon Sep 17 00:00:00 2001 From: brxxh <11dac2t@huhn-online.de> Date: Thu, 23 Nov 2023 21:40:00 +0100 Subject: [PATCH 6/9] Started working on pipes collision (WIP) --- examples/quickwings/assets/blank.png | Bin 466 -> 0 bytes examples/quickwings/quickwings.cpp | 75 ++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 8 deletions(-) delete mode 100644 examples/quickwings/assets/blank.png diff --git a/examples/quickwings/assets/blank.png b/examples/quickwings/assets/blank.png deleted file mode 100644 index 5c1b88f4045da9b1d191fb5b907e85fca4542ce3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 466 zcmV;@0WJQCP)q)jWdF(fHcTm=^g!9jHK zYw#cFD!3{Lf+C2xx%;(9iRZS37SS7S&cl1}dpLOmp+wHidrcFNw|zGmk7)~wOIph- zZG?%?&ZusB&g9HYf`8Z7Jq@bfMOCl=@BO*jQ)$nHhF0M*({X)anTEu=?Py0Ddwy1G zkL+GNlEjIjVNhU|96nL0wq*9VZ@BE6W=%Y%yd8?T;>eH{?~tek>6(^miJq1xM^WYe zJ5SFV9jSB=$DsK+2;TdlWfw|2LGXPX1f>&be1c26=3kSX#y>^hscC(O5ZQ$DtD0u) z!NnGIKRUXrm!(G8A +#include #include #include #include @@ -29,6 +31,12 @@ const int frame_rate = 60; bool game_over = false; +float risky_pos_x; +float risky_pos_max_x; +float risky_pos_bottom_y; +float risky_pos_top_y; +float risky_pos_bottom_max_y; +float risky_pos_top_max_y; struct Background { paradiso::Sprite backgroundLeft; @@ -84,9 +92,11 @@ struct Pipe { paradiso::Renderer renderer1{}; paradiso::Renderer renderer2{}; - int pipe_spawn_rand_int = rand() % 80 + 25; + int pipe_spawn_rand_int = rand() % 90 + 25; float pipe_spawn_rand = float(pipe_spawn_rand_int) / 100; + bool pos_reset = false; + Pipe() { auto pipe_image = paradiso::BitmapIO::get().load("pipe-green.png"); @@ -97,10 +107,43 @@ struct Pipe { .rotation = 3.1415926f}; pipe_bottom = paradiso::Sprite{ .bitmap = pipe_image, - .pivot = {paradiso::Vector2::make(0.0f, pipe_spawn_rand - 1.6f)}, + .pivot = {paradiso::Vector2::make(0.0f, pipe_spawn_rand - 1.5f)}, .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 320.0f)) / 700.0f) * 2.25f)}}; } + void update() { + pipe_spawn_rand_int = rand() % 90 + 20; + pipe_spawn_rand = float(pipe_spawn_rand_int) / 100; + + pipe_top.pivot.x() -= 0.02f; + pipe_bottom.pivot.x() -= 0.02f; + + risky_pos_x = pipe_top.pivot.x(); + risky_pos_max_x = + pipe_top.pivot.x() + ((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f; + + risky_pos_top_y = pipe_top.pivot.y(); + risky_pos_top_max_y = pipe_top.pivot.y() + 10.0f; + + // std::cout << risky_pos_top_x << std::endl; + // std::cout << risky_pos_top_max_x << std::endl; + + if (pipe_top.pivot.x() <= -1.4f || pipe_bottom.pivot.x() <= -1.4f) { + pos_reset = true; + + if (pos_reset == true) { + pipe_top.pivot.y() = pipe_spawn_rand + 1.0f; + pipe_bottom.pivot.y() = pipe_spawn_rand - 1.5; + + pos_reset = false; + } + + pipe_top.pivot.x() = 1.4f; + pipe_bottom.pivot.x() = 1.4f; + } + + } + void draw(const paradiso::Shader& shader) { shader.set_uniform("pivot", pipe_bottom.pivot); shader.set_uniform("scale", pipe_bottom.scale); @@ -137,7 +180,7 @@ struct Grass { if (sprite->pivot.x() <= -1.0f) { sprite->pivot.x() += 2.0f; } - sprite->pivot.x() -= 0.03f; + sprite->pivot.x() -= 0.02f; shader.set_uniform("pivot", sprite->pivot); shader.set_uniform("scale", sprite->scale); shader.set_uniform("rotation", sprite->rotation); @@ -158,10 +201,10 @@ struct QuickWings { unsigned int flapCounter = 0; // How many ticks since last flap float velocity = 0.0f; - const float max_velocity = 0.04f; + const float max_velocity = 0.02f; - const float gravity = -0.004f; - const float move_up_velocity = 0.04f; + const float gravity = -0.002f; + const float move_up_velocity = 0.02f; bool move_up = false; bool paused = true; @@ -231,8 +274,9 @@ struct QuickWings { } // Stop game - if (paused) + if (paused) { return; + } else { // Apply gravity velocity += gravity; @@ -262,6 +306,19 @@ struct QuickWings { // Update rotation rotation = velocity * 10.0f; } + + std::cout << risky_pos_top_y << std::endl; + std::cout << risky_pos_top_max_y << std::endl; + + std::cout << pos << std::endl; + std::cout << "\n\n" << std::endl; + + if (risky_pos_x <= 0.0f && risky_pos_max_x >= 0.0f) { + if (pos >= risky_pos_top_y && pos <= risky_pos_top_max_y) { + game_over = true; + std::cout << "collision!" << std::endl; + } + } } // keyboard handler @@ -402,7 +459,9 @@ auto main() -> int { ctx.clear(); auto t1 = std::chrono::high_resolution_clock::now(); - // Keyboard and state change + // Keyboard and state change + update + pipe.update(); + quickwingsapp.on_keyboard(w.keyboard_input()); quickwingsapp.update(); From 5a9eb10507613a28b3d59d751e1be4c42bfcf1e3 Mon Sep 17 00:00:00 2001 From: brxxh <11dac2t@huhn-online.de> Date: Fri, 24 Nov 2023 17:43:17 +0100 Subject: [PATCH 7/9] finally added pipes + collision --- examples/quickwings/quickwings.cpp | 128 ++++++++++++++++++----------- 1 file changed, 81 insertions(+), 47 deletions(-) diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index 875f838..f8a4995 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -46,6 +46,8 @@ struct Background { paradiso::Sprite* scrolling[2] = {&backgroundLeft, &backgroundRight}; + paradiso::Renderer renderer{}; + Background() { auto backgroundImage = paradiso::BitmapIO::get().load("background-day.png"); @@ -71,18 +73,18 @@ struct Background { void draw(const paradiso::Shader& shader) { for (auto sprite : scrolling) { - if (sprite->pivot.x() <= -2.0f) { - sprite->pivot.x() += 4.0f; + if (game_over == false) { + if (sprite->pivot.x() <= -2.0f) { + sprite->pivot.x() += 4.0f; + } + sprite->pivot.x() -= 0.002f; } - sprite->pivot.x() -= 0.002f; shader.set_uniform("pivot", sprite->pivot); shader.set_uniform("scale", sprite->scale); shader.set_uniform("rotation", sprite->rotation); renderer.draw(*sprite, shader); } } - - paradiso::Renderer renderer{}; }; struct Pipe { @@ -92,7 +94,9 @@ struct Pipe { paradiso::Renderer renderer1{}; paradiso::Renderer renderer2{}; - int pipe_spawn_rand_int = rand() % 90 + 25; + bool paused = false; + + int pipe_spawn_rand_int = rand() % 80 + 15; float pipe_spawn_rand = float(pipe_spawn_rand_int) / 100; bool pos_reset = false; @@ -102,46 +106,57 @@ struct Pipe { pipe_top = paradiso::Sprite{ .bitmap = pipe_image, - .pivot = {paradiso::Vector2::make(0.0f, pipe_spawn_rand + 1.0f)}, + .pivot = {paradiso::Vector2::make(1.4f, pipe_spawn_rand + 1.0f)}, .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 320.0f)) / 700.0f) * 2.25f)}, .rotation = 3.1415926f}; pipe_bottom = paradiso::Sprite{ .bitmap = pipe_image, - .pivot = {paradiso::Vector2::make(0.0f, pipe_spawn_rand - 1.5f)}, + .pivot = {paradiso::Vector2::make(1.4f, pipe_spawn_rand - 1.5f)}, .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 320.0f)) / 700.0f) * 2.25f)}}; + + paused = true; + } void update() { - pipe_spawn_rand_int = rand() % 90 + 20; - pipe_spawn_rand = float(pipe_spawn_rand_int) / 100; - pipe_top.pivot.x() -= 0.02f; - pipe_bottom.pivot.x() -= 0.02f; - - risky_pos_x = pipe_top.pivot.x(); - risky_pos_max_x = - pipe_top.pivot.x() + ((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f; - - risky_pos_top_y = pipe_top.pivot.y(); - risky_pos_top_max_y = pipe_top.pivot.y() + 10.0f; - - // std::cout << risky_pos_top_x << std::endl; - // std::cout << risky_pos_top_max_x << std::endl; - - if (pipe_top.pivot.x() <= -1.4f || pipe_bottom.pivot.x() <= -1.4f) { - pos_reset = true; - - if (pos_reset == true) { - pipe_top.pivot.y() = pipe_spawn_rand + 1.0f; - pipe_bottom.pivot.y() = pipe_spawn_rand - 1.5; - - pos_reset = false; - } - - pipe_top.pivot.x() = 1.4f; - pipe_bottom.pivot.x() = 1.4f; + if (game_over == true) { + paused = true; } + if (paused == true) { + return; + } + else { + pipe_spawn_rand_int = rand() % 80 + 15; + pipe_spawn_rand = float(pipe_spawn_rand_int) / 100; + + pipe_top.pivot.x() -= 0.02f; + pipe_bottom.pivot.x() -= 0.02f; + + risky_pos_x = pipe_top.pivot.x(); + risky_pos_max_x = pipe_top.pivot.x() + ((500.0f - (500.0f - 52.0f)) / 500.0f) * 2.25f; + + risky_pos_top_y = pipe_top.pivot.y(); + risky_pos_top_max_y = pipe_top.pivot.y() + 10.0f; + + risky_pos_bottom_y = pipe_bottom.pivot.y(); + risky_pos_bottom_max_y = pipe_bottom.pivot.y() - 10.0f; + + if (pipe_top.pivot.x() <= -1.4f || pipe_bottom.pivot.x() <= -1.4f) { + pos_reset = true; + + if (pos_reset == true) { + pipe_top.pivot.y() = pipe_spawn_rand + 1.0f; + pipe_bottom.pivot.y() = pipe_spawn_rand - 1.5; + + pos_reset = false; + } + + pipe_top.pivot.x() = 1.4f; + pipe_bottom.pivot.x() = 1.4f; + } + } } void draw(const paradiso::Shader& shader) { @@ -177,10 +192,12 @@ struct Grass { void draw(const paradiso::Shader& shader) { for (auto sprite : scrolling) { - if (sprite->pivot.x() <= -1.0f) { - sprite->pivot.x() += 2.0f; + if (game_over == false) { + if (sprite->pivot.x() <= -1.0f) { + sprite->pivot.x() += 2.0f; + } + sprite->pivot.x() -= 0.02f; } - sprite->pivot.x() -= 0.02f; shader.set_uniform("pivot", sprite->pivot); shader.set_uniform("scale", sprite->scale); shader.set_uniform("rotation", sprite->rotation); @@ -216,6 +233,8 @@ struct QuickWings { float rotation = 0.0f; + int collision_counter = 0; + QuickWings() { float scaleh = 0.08f; float scalew = 0.158f; @@ -307,16 +326,26 @@ struct QuickWings { rotation = velocity * 10.0f; } - std::cout << risky_pos_top_y << std::endl; - std::cout << risky_pos_top_max_y << std::endl; + float final_risky_pos_top_y = risky_pos_top_y - 1.06f; + float final_risky_pos_bottom_y = risky_pos_bottom_y + 1.06f; - std::cout << pos << std::endl; - std::cout << "\n\n" << std::endl; - - if (risky_pos_x <= 0.0f && risky_pos_max_x >= 0.0f) { - if (pos >= risky_pos_top_y && pos <= risky_pos_top_max_y) { + if (risky_pos_x - 0.3f <= 0.0f && risky_pos_max_x >= 0.0f) { + if (pos >= final_risky_pos_top_y && pos <= risky_pos_top_max_y) { game_over = true; - std::cout << "collision!" << std::endl; + } + if (pos <= final_risky_pos_bottom_y && pos >= risky_pos_bottom_max_y) { + if (collision_counter == 0) { + collision_counter++; + std::cout << "incremented!" << std::endl; + } + else { + collision_counter = 2; + } + + + if (collision_counter == 2) { + game_over = true; + } } } } @@ -447,6 +476,7 @@ auto main() -> int { auto message = Message{}; auto gameover = GameOverMessage{}; + // timer // das update führt den hier mitgegebnen Ausdruck innerhalb der internen @@ -460,6 +490,10 @@ auto main() -> int { auto t1 = std::chrono::high_resolution_clock::now(); // Keyboard and state change + update + if (quickwingsapp.paused == false) { + pipe.paused = false; + } + pipe.update(); quickwingsapp.on_keyboard(w.keyboard_input()); @@ -490,7 +524,7 @@ auto main() -> int { // Quit return !(w.keyboard_input().size() && w.keyboard_input().top().key == 'Q'); - })) { + })) { }; return 0; From e37a74137dfc48931a898c2377050fbea28256b7 Mon Sep 17 00:00:00 2001 From: brxxh <11dac2t@huhn-online.de> Date: Fri, 24 Nov 2023 18:13:58 +0100 Subject: [PATCH 8/9] fixed grass again, didn't help lol --- examples/quickwings/assets/base.png | Bin 2300 -> 1963 bytes examples/quickwings/quickwings.cpp | 41 ++++++++++++++++++---------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/examples/quickwings/assets/base.png b/examples/quickwings/assets/base.png index 2ba45d32091724ae7160522722bb3cfa63d3a345..26fa39129aa33fe2b906d9b77751651fee1a2272 100644 GIT binary patch literal 1963 zcmeAS@N?(olHy`uVBq!ia0y~yVEh4O7jUov$xnNd>VN`yna<7unaRlv3>p(lC)#=+ z4iIUZALhETt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JQ?0yj) zs=JF{_jN&4;ME>ki`xx-)zRf&Hial#&pCPEG^fe(g>R*#o;R=2dMMgV7lM`SSr1K$x4W}K?cC(XdXZsO_U7*Y}U_O4@AaG=QX zhb~O-4tI7a@ZD|X;44+lJFru_P<)+JSMhd5QLQTrRNk}X)t`OvdP{%#q3gx(|K6YM z_+9?qp1pT}DmpYUFfy@l2q*|}+H}6saE5Um9{45v|9o9sIN&T?$pp?B4QW@n1Qnnn zcYGb}YpY8yvV1xEdAj(?yMKPvUHp8neqJ~K{A9-0uWRf-JS^5p_`jw8mi_aIZx(*{ z7ryZG{-Mbr+rTDpv+!Lm-(k562>rrO=Y79m?*88Vrt!_$>)oGE|9twVX}tc`pGizs z|7TZBg1XWnq4B^omMdp30%764ORHu-{vsT?|JwSm*0H+#cHWq@Y5&h>sZY)I)fPl+ zpL@>Qe|!Gh^R=O$zJLGr{Pmsrz7EfA z-*|$91L(j;R;K^H4tLjp;B)QMXMb7cUt4ZB_3zn#Y4w};-<1EyVe{>0Dw9=w_dFF? z7)2-)*fW|+8UW#p^(&6=v;6nlb8Y%X?v`F>lMyeYkY-d}bfU^vWsifj-2WMLqj z{L{E=;XV=Lcw=8zSGN0sZJZ-Kt`bxdn5>dM z2|!}fq2Yj5*tQ2tg3Nxa?K}(@w*_|$U0^?Xv1vA1yK~%sYIPWOjdX@lNm=OvSxHuMQ zZcl>yjA?}&ER70yu(Dj35^V^JR7S=S{!#BSjmF++;^Yt*QF-r!^v4(B@hP)|n1Gck NgQu&X%Q~loCIAIj%eDXj diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index f8a4995..a49f5c6 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -176,33 +176,44 @@ struct Grass { paradiso::Sprite grassRight; paradiso::Sprite* scrolling[2] = {&grassLeft, &grassRight}; - paradiso::Renderer renderer{}; + paradiso::Renderer renderer1{}; + paradiso::Renderer renderer2{}; Grass() { auto grassImage = paradiso::BitmapIO::get().load("base.png"); grassLeft = paradiso::Sprite{ .bitmap = grassImage, - .pivot = {paradiso::Vector2::make(1.0f, -0.9f)}, - .scale = {paradiso::Vector2::make(2.0f, 0.33333f)}}; + .pivot = {paradiso::Vector2::make(0.0f, -0.9f)}, + .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 504.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 112.0f)) / 700.0f) * 2.25f)}}; grassRight = paradiso::Sprite{ .bitmap = grassImage, - .pivot = {paradiso::Vector2::make(1.0f, -0.9f)}, - .scale = {paradiso::Vector2::make(2.6f, 0.33333f)}}; + .pivot = {paradiso::Vector2::make(1.002f, -0.9f)}, + .scale = {paradiso::Vector2::make(((500.0f - (500.0f - 504.0f)) / 500.0f) * 2.25f, ((700.0f - (700.0f - 112.0f)) / 700.0f) * 2.25f)}}; } void draw(const paradiso::Shader& shader) { - for (auto sprite : scrolling) { - if (game_over == false) { - if (sprite->pivot.x() <= -1.0f) { - sprite->pivot.x() += 2.0f; - } - sprite->pivot.x() -= 0.02f; + if (game_over == false) { + grassLeft.pivot.x() -= 0.02f; + grassRight.pivot.x() -= 0.02f; + + if (grassRight.pivot.x() <= 0.0f) { + grassLeft.pivot.x() = 1.002f; + } + if (grassRight.pivot.x() <= -1.002f) { + grassRight.pivot.x() = 1.002f; } - shader.set_uniform("pivot", sprite->pivot); - shader.set_uniform("scale", sprite->scale); - shader.set_uniform("rotation", sprite->rotation); - renderer.draw(*sprite, shader); } + + shader.set_uniform("pivot", grassLeft.pivot); + shader.set_uniform("scale", grassLeft.scale); + shader.set_uniform("rotation", grassLeft.rotation); + + shader.set_uniform("pivot", grassRight.pivot); + shader.set_uniform("scale", grassRight.scale); + shader.set_uniform("rotation", grassRight.rotation); + + renderer1.draw(grassLeft, shader); + renderer2.draw(grassRight, shader); } }; From b124afdedfa1004faf5bd7bd12337228513a1fb5 Mon Sep 17 00:00:00 2001 From: brxxh <11dac2t@huhn-online.de> Date: Fri, 24 Nov 2023 18:45:37 +0100 Subject: [PATCH 9/9] final quickwings commit --- examples/quickwings/quickwings.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/quickwings/quickwings.cpp b/examples/quickwings/quickwings.cpp index a49f5c6..2d8bd96 100644 --- a/examples/quickwings/quickwings.cpp +++ b/examples/quickwings/quickwings.cpp @@ -347,13 +347,11 @@ struct QuickWings { if (pos <= final_risky_pos_bottom_y && pos >= risky_pos_bottom_max_y) { if (collision_counter == 0) { collision_counter++; - std::cout << "incremented!" << std::endl; } else { collision_counter = 2; } - if (collision_counter == 2) { game_over = true; }