Giter Site home page Giter Site logo

Comments (12)

fallahn avatar fallahn commented on May 24, 2024

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.

kraxarn avatar kraxarn commented on May 24, 2024

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.

fallahn avatar fallahn commented on May 24, 2024

Have you tried the method of including the .cpp files?

from sfml-tmxloader.

kraxarn avatar kraxarn commented on May 24, 2024

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.

fallahn avatar fallahn commented on May 24, 2024

Are you also linking zlib?

from sfml-tmxloader.

kraxarn avatar kraxarn commented on May 24, 2024

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.

fallahn avatar fallahn commented on May 24, 2024

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.

kraxarn avatar kraxarn commented on May 24, 2024

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.

fallahn avatar fallahn commented on May 24, 2024

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.

kraxarn avatar kraxarn commented on May 24, 2024

Thanks for helping me and creating this 👍 Keep me updated if you find the issue!

from sfml-tmxloader.

fallahn avatar fallahn commented on May 24, 2024

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.

kraxarn avatar kraxarn commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.