Comments (12)
How are you including the rest of the library? This error is basically saying 'your header tells me the maploader exists, but I can't find it anywhere'. You need to either build the map loader as a .lib file (the simplest/most reliable way being via the cmake file in the 'next' branch) and link it to your project, or you can include the .cpp files directly. Make sure they are somewhere near the rest of your source files, then right click on the source folder in visual studio and select 'add existing'. Add each one of the .cpp files, omitting tmx2box2d if you're not using the box2d library. There is an example on the wiki here.
from sfml-tmxloader.
I tried building with CMake, but it keeps giving me the error
CMake Error at cmake/Modules/FindSFML.cmake:349 (message):
SFML found but version too low (requested: 2, found: 1.x.x)
Call Stack (most recent call first):
CMakeLists.txt:94 (find_package)
which doesn't make any sense, since I'm using version 2.3.2
from sfml-tmxloader.
Have you tried the method of including the .cpp files?
from sfml-tmxloader.
If I try including the cpp files, I just get a lot of unresolved external symbol errors, most of them from MapLoaderPrivate.obj
from sfml-tmxloader.
Are you also linking zlib?
from sfml-tmxloader.
I built and linked zlibstat.lib
EDIT: Silly me, forgot to include pugixml.cpp... It works now, but I get 118 warnings when compiling. Most of them being code C4275 "non dll-interface class 'sf::...' used as base for dll-interface class ...". Don't know if that's something I have to worry about or not.
EDIT 2: Btw, does the spritesheet need to be in the same folder as the .tmx file? Even if the spritesheet is set to be in another folder, it still looks for it in the same folder as the .tmx file. Also, there's still this issue of cmake not working under Windows...
from sfml-tmxloader.
OK, glad you got it working. Is this the CMake file from the master or next branch? The next branch contains quite a few fixes, although the CMake file is generally directed at linux/gcc builds. There is a Visual Studio solution in the repository set up to build both static and shared versions of the the library. If the CMake bug is in the next branch feel free to post an issue as a bug.
The loader reads the path of sprite sheets directly from the map file, so generally relative to the current working directory. For example you have a maps directory which is your working directory, and an images directory next to it containing your textures, the map file needs to have the path
'../images/mytex.png'.
The dll warnings are only pertinent if you're building a shared library. Including the source directly shouldn't matter, and the warnings can be surpressed with something like
#pragma warning(disable:C4275)
from sfml-tmxloader.
Tried the CMake from the next branch on Windows 7 with VS2015. Tried the same on Ubuntu 16.04 where it compiled just fine, so the Linux version works just fine. Not a big issue, but I can open a new issue for it if you want, but since this works now, it's nothing that has to be fixed really.
I have an assets folder where all assets are in. In that folder, I have one folder named "maps" and one "spritesheets". The tmx file in the maps folder points to "../spritesheets/ground.png", but it still tried to look for the ground.png file in the maps folder.
from sfml-tmxloader.
OK, the image thing might be an issue, if I get the time I'll take a look over the weekend. Thanks for the feedback!
from sfml-tmxloader.
Thanks for helping me and creating this 👍 Keep me updated if you find the issue!
from sfml-tmxloader.
On line 288 of MapLoaderPrivete.cpp and again on line 354 there is this:
std::string imageName = fileFromPath(c.attribute("source").as_string());
I'm not sure why I decided to reduce the file path to just the image name, but if you remove the call to fileFromPath()
and use the path property directly it should load your images properly. It might also break something else though... give it a try and let me know if it works :)
from sfml-tmxloader.
Yup that was it! From quick testing, everything seems to work just fine. The map and all layers load properly. Thanks a lot!
from sfml-tmxloader.
Related Issues (20)
- Thanks Matt! HOT 3
- No compatibility with AnimatedSprite class? HOT 2
- MapObject setVisible ? HOT 3
- Terrain Tiled tmx load HOT 3
- Strange culling HOT 4
- Collision issues HOT 7
- Animated Tile with Tiled Editor HOT 4
- layer->tiles doesn't give tiles from layers HOT 3
- GetLayers() doesn't work as spected HOT 4
- Simple test fails: call for help
- Can't draw map properly if it wasn't the the first one the maploader loaded. HOT 4
- Colission with player sprite HOT 6
- Collisions detected incorrectly due to AABB having incorrect height (2x what it should be) HOT 1
- Isometric causing weird issues HOT 5
- unresolved symbol sf::Sprite::Draw in MapLoaderPublic.obj? HOT 1
- Isometric Layering offset not happening? HOT 22
- Missing vtable HOT 3
- Can not build tmxsfml project as I've set link options correctly HOT 1
- Doesn't build woth MinGW Makefiles HOT 2
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 sfml-tmxloader.