Comments (9)
The Geometry util has undergone some major reworks and because of that it has broken this example. You can fix it by doing two things:
- Swap the order of both
#include "utilities/olcUTIL_Geometry2D.h"
and#include "olcPixelGameEngine.h"
inolcUTIL_Animate2D.h
andTEST_Animate2D.cpp
so they look like this:
#include "utilities/olcUTIL_Animate2D.h"
#include "olcPixelGameEngine.h"
- Add
#define OLC_IGNORE_VEC2D
inTEST_Animate2D.cpp
above#include "utilities/olcUTIL_Animate2D.h"
Should be good to go after that.
from olcpixelgameengine.
This is because you have to supply your own image to load (it tries to load "./assets/MegaSprite1.png"
). I don't have the image this example provides, but if you have a spritesheet, you can tailor the animation system to work for that sheet using the example file as a guide.
from olcpixelgameengine.
Regarding the olcUTIL_Geometry2d.h
it should be noted that has a separate repo where development on it is actively progressing. Before patching the header here, check to see that the issue hasn't already been solved in the other repo.
Unfortunately, the header provided in the PGE repo doesn't match.
from olcpixelgameengine.
Good to point that out. That's just for PGE itself, the extensions and utilities might have differing requirements. The wiki doesn't reflect that..... yet
from olcpixelgameengine.
It compiled! And it ran but it immediately got a segfault
[1] 30019 segmentation fault (core dumped) ./test_animate
Hey that's still progress
from olcpixelgameengine.
As to sprites and spritesheets, I'm new to them. I don't want to get too much down that rabbit hole because I'm more interested in the math and algorithms vs the game design but they're on my radar now as a thing to consider.
I plugged in a static creative commons licensed mario png and it works, albiet probably not as expected. It doesn't crash. It shards the thing during animation in a kind of cool way.
Anyway I opened a PR for these fixes. Feel free to update with a better spritesheet or make changes!!!
from olcpixelgameengine.
In addition to the above I needed to add #include <array>
to the file olcUTIL_Geometry2D.h
and to add template
to turn
return !(p.x < r.pos.x || p.y < r.pos.y ||
into
return !(p.template x < r.pos.x || p.template y < r.pos.y ||
in file olcUTIL_Geometry2D.h
as well.
(using "g++ (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0" under Ubuntu 22.04 LTS)
from olcpixelgameengine.
g++ -o test_quickGUI examples/TEST_QuickGUI.cpp -I. -lX11 -lGL -lpthread -lpng -lstdc++fs -std=c++17
g++ -o test_quickGUI examples/TEST_Animate2D.cpp -I. -lX11 -lGL -lpthread -lpng -lstdc++fs -std=c++17
we require C++20, you're compiling with C++17
from olcpixelgameengine.
Compilation followed the Wiki under "https://github.com/OneLoneCoder/olcPixelGameEngine/wiki/Compiling-on-Linux#building":
g++ -o olcExampleProgram olcExampleProgram.cpp -lX11 -lGL -lpthread -lpng -lstdc++fs -std=c++17
See also the latest version of "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/olcPixelGameEngine.h#L73":
Compiling in Linux
You will need a modern C++ compiler, so update yours! To compile use the command: g++ -o YourProgName YourSource.cpp -lX11 -lGL -lpthread -lpng -lstdc++fs -std=c++17
Where is the "C++20" coming from? Maybe you are referring to another branch?
from olcpixelgameengine.
Related Issues (20)
- [Request] To set program window position on monitor screen when program start.
- Eliminating some warnings when building the hello world app
- Missing assets/MegaSprite1.png HOT 2
- What would be the closest framework to olcPixelGameEngine on OSX? HOT 3
- Make New More general QuadTree
- ScanHardware bPressed clarity
- Can't paste text when Console is open
- v2d_generic::lerp
- Doesn't build with /Wx and /Wall
- Directly draw on a sprite --> scaled string HOT 2
- Implement PingPong style in Animate2D HOT 1
- olcUTIL_Camera2D: m_vScreenSize is hard coded with no construction update, or means to change
- WASM (Emscripten): font looks ugly (strange underscores) HOT 2
- drawing Decal on Decal --> no transparency possible? HOT 2
- cursor disable and mouse delta values HOT 1
- Not an issue - Font suggestions. HOT 3
- PGEX extensions not usable in dll context
- Integrating render window into MFC or Qt
- have no function loading like mutillang font file or vector diagram as pixel Sprite HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from olcpixelgameengine.