Giter Club home page Giter Club logo

tmxlite's People

Contributors

bgospodaru avatar d8174 avatar dajack05 avatar dennissc avatar dmitrumoth avatar docskellington avatar eren121 avatar expl0it3r avatar fallahn avatar grant1219 avatar ironpowertga avatar jonnyptn avatar karamu98 avatar ldornbusch avatar mateusvmv avatar mpartel avatar muzak93 avatar mx-payn avatar patrickhoward avatar pptgamer avatar roig avatar sakarah avatar samyatchmenoff avatar simonrenger avatar timschwartz avatar u3shit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tmxlite's Issues

Documentation for tmxlite

I appreciate your work on creating tmxlite and i'd really like to use it,
but i can't wrap my head around your code.
Maybe i'm too dumb to understand, but is there a documentation for tmxlite?
Any reference to make it easier for beginners to get into tmxlite?
Or a way to get the Logger running on linux?

pugixml is embedded

I'd appreciate your thoughts on this - at the moment there's a copy of pugixml embedded in the tmxlite code. This makes it a little bit awkward if someone wants to use XML for some other part of the app. They'd have to include the header from tmxlite/detail/ , which looks like it was put there to make it 'private' (i.e. an implementation detail), or maybe have their own copy of the header (but not the source) and let the linker sort it out.

I was wondering if it would be possible to add an option to the CMakefile to allow an external copy of pugixml to be used? In that way tmxlite and pugixml would both be dependencies of the main app. I'm not very good on CMake.

Installs to wrong folder for 64bit Linux

Issue

Using the 1.0.1 release tarball and cmake, the library installs to the /usr/lib directory regardless of its architecture.

Explanation

On most *nix distributions, 'lib' is for 32 bit libraries and 'lib64' is for 64 bit libraries. This allows the 32 bit library to be installed alongside the 64 bit library, for compatibility.

It seems the tmxlite/CMakeLists.txt file explicitly defines this when installing as a shared library. If there's no specific need for this, it would be easier to package and use this library if it would allow CMake to use the system defaults for folder locations. It will also make the project more portable, in case someone wants to compile on a non-FHS *nix system.

Suggestion

If You include(GNUInstallDirs), You can use the already-populated variables ${CMAKE_INSTALL_INCLUDEDIR}, ${CMAKE_INSTALL_LIBDIR}, and ${CMAKE_INSTALL_BINDIR} in place of the presently hard coded include, lib, and bin.

SFMLOrthogonalLayer ignores tile spacing

I have a tileset which has a 1px spacing set on it. Unfortunately your provided SFMLOrthogonalLayer.hpp file doesn't seem to take into account the spacing of the tiles.

I've looked through the source but can't really work out where the modifications would be required. Would you mind pointing me in the right direction?

License?

This looks to be a very useful library. I'm looking to use it for a university project, so I need proof of legality of use. How come there's no license associated with the project when it seems it's built for others to use?

Mutli-line string property is empty

Are multi-line properties working currently? I have a map with a rectangle shape which has a property named "script" and has a value with multi-line lua (using the tiled text editor). However, when I find this property and call .getStringValue() I get an empty string.

Here is a sample .tmx file to demonstrate.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.2" tiledversion="1.3.1" orientation="orthogonal" renderorder="right-down" compressionlevel="0" width="20" height="20" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="3">
 <tileset firstgid="1" source="house_01.tsx"/>
 <layer id="1" name="Tile Layer 1" width="20" height="20">
  <data encoding="csv">
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
</data>
 </layer>
 <objectgroup id="2" name="Object Layer 1">
  <object id="1" x="59.407" y="59.2195" width="80" height="80">
   <properties>
    <property name="script">function test()
    print(&quot;Hello World&quot;)
end</property>
   </properties>
  </object>
  <object id="2" x="173.284" y="79.5128" width="80" height="80">
   <properties>
    <property name="script" value="print(&quot;Hello World&quot;)"/>
   </properties>
  </object>
 </objectgroup>
</map>

The single line string is read properly just FYI.

Thanks in advance! Love the parser!

Error with Android.hpp

I get the following error when I try to compile with the android NDK:

In file included from E:\max\android_libs\tmxliteOG\tmxlite\src\FreeFuncs.cpp:28:
In file included from E:\max\android_libs\tmxliteOG\tmxlite\include\tmxlite\FreeFuncs.hpp:54:
E:\max\android_libs\tmxliteOG\tmxlite\include\tmxlite\detail\Android.hpp:37:11: error: expected '{'

Box2D intergration

Does this version also contain the box2D converter or collision detection? I can't seem to find it.

I get the following error when loading the map (which contains GroupLayer). Any help is greatly appreciated!

As stated, I get the error when I load the map saying
ObjectGroup.cpp:45: virtual void tmx::ObjectGroup::parse(const pugi::xml_node&, tmx::Map*): Assertion 'map' failed.

Here is the structure of my layers:
Screenshot_tmx_error1

I get different error when I remove object layers from the group
Screenshot_tmx_error
(First make exec error is when I delete the object layers from the groups (the ones called "thing"). Second error is the one I get If I keep all the object layers in their respective groups)

Also, I get no errors if I remove the groups altogether. Which makes me believe there is some peoblem in importing groups

ERROR: Failed opening data/assets/demo.tmx

Im trying to use this library in xcode, and its failing while trying to load the sample provided. Im able to load other assets from the data folder referenced in the error message.

Any help would be great.

LNK 2019 error unresolved external symbol

I am trying to use tmxlite for the first time and I keep getting this error:

LNK2019 unresolved external symbol _mz_inflateInit referenced in function "bool __cdecl tmx::decompress(char const *,class std::vector<unsigned char,class std::allocator > &,int,int)" (?decompress@tmx@@YA_NPBDAAV?$vector@EV?$allocator@E@std@@@std@@hh@Z)

I'm using Visual Studio 2017.

I am using the SFML example from the download:

#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Window/Event.hpp>

#include <tmxlite/Map.hpp>

#include "SFMLOrthogonalLayer.hpp"

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

    tmx::Map map;
    map.load("assets/demo.tmx");

    MapLayer layerZero(map, 0);
    MapLayer layerOne(map, 1);
    MapLayer layerTwo(map, 2);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::Black);
        window.draw(layerZero);
        window.draw(layerOne);
        window.draw(layerTwo);
        window.display();
    }

    return 0;
}

Can you explain a bit more in detail how to get it up and running with VS Community 2017?

zstd compression is not supported

As mentioned in #70 from version 1.4.0 Tiled introduces zstd compression as an option for base64 encoded maps. tmxlite currently doesn't support the compression format as it cannot be decompressed by miniz.

The current fix is to switch the format of Tiled maps from zstd compression to zlib compression.

Objects have inconsistent origins

So a couple weeks ago one of my colleagues was working in Tiled and upon creating a level he noticed something strange: Object origins in tiled are inconsistent.

Capture

All of the generic objects (excluding points) have an origin in the top left, whereas objects instantiated from Tiles have origins in the bottom left. I talked to the Tiled devs and they said that they will be adding ways to manually set the origin of a given object in the next dev release... It doesn't seem to be in the latest beta (1.4 at the time of this issue).

Currently in tmxlite, tile objects and rectangles are treated the exact same. It makes sense (as tiles are rectangles, no doubt). However this leads to having to write code such as this...

newObject.dimensions = Vector2i(tilemapObject.getAABB().width, tilemapObject.getAABB().height);
newObject.position = Vector2i(tilemapObject.getPosition().x, tilemapObject.getPosition().y - newObject.dimensions.y + 1);

(For context, I use tmxlite to preprocess maps)

The above code places objects in their expected places if the object is a tile object. However what happens if the object is a generic rectangle? Its impossible to tell if the object is a generic rectangle object or a tile object.

So my proposal is this: add a Tile shape to the Shape enumeration in Object.hpp:

        enum class Shape
        {
            Rectangle,
            Ellipse,
            Point,
            Polygon,
            Polyline,
            Text,
            Tile
        };

That way, one can handle the ambiguity ..

newObject.dimensions = Vector2i(tilemapObject.getAABB().width, tilemapObject.getAABB().height);
if (tilemapObject.getShape() == tmx::Object::Shape::Tile)
{
    newObject.position = Vector2i(tilemapObject.getPosition().x, tilemapObject.getPosition().y - newObject.dimensions.y + 1);
}
else
{
    newObject.position = Vector2i(tilemapObject.getPosition().x, tilemapObject.getPosition().y);
}

Of course, the problem with this is that one needs to know about Tiled's strange exception to Tile objects. Tmxlite could handle this excpetion silently by subtracting the Y and placing the origin in the top left, but that might break some folk's applications.

Thoughts? Suggestions?

Invalid tileID for flipped objects

When I parsing an object with the horizontal flip flag set to true I get an invalid tileID (2147484945).
All other (unflipped) IDs are correct and turning off this flag fixes the issue, giving me a valid ID.

Note:
I am not super familiar with your code and how the IDs are calculated, so this might be an issue with Tiled?

getLayerAs error

Im using the example code from the quick start. On compile, I get an error:
error: undefined reference to 'tmx::ObjectGroup& tmx::Layer::getLayerAs<tmx::ObjectGroup>()'

Here's the code as a refresher:

		tmx::Map map;
		if(map.load("map1.tmx")) {
			const auto& layers = map.getLayers();
			for(const auto& layer : layers)
			{
				if(layer->getType() == tmx::Layer::Type::Object)
				{
					const auto& objectLayer = layer->getLayerAs<tmx::ObjectGroup>();
					const auto& objects = objectLayer.getObjects();
					for(const auto& object : objects)
					{
						//do stuff with object properties
					}
				}
				else if(layer->getType() == tmx::Layer::Type::Tile)
				{
					const auto& tileLayer = layer->getLayerAs<tmx::TileLayer>();
					//read out tile layer properties etc...
					SDL_Log("%s", tileLayer.getName().c_str());
				}
			}

			const auto& tilesets = map.getTilesets();
			for(const auto& tileset : tilesets)
			{
				//read out tile set properties, load textures etc...
			}
		}

Getting two compile errors: `error C2610` upon building project

I'm getting the following errors upon building my project in Visual Studio:

..\include\tmxlite\map.hpp(98): error C2610: 'tmx::Map::Map(tmx::Map &&)' : is not a special member function which can be defaulted
..\include\tmxlite\map.hpp(99): error C2610: 'tmx::Map &tmx::Map::operator =(tmx::Map &&)' : is not a special member function which can be defaulted

Here are lines 98 and 99 of Map.hpp, respectively:

Map(Map&&) = default;
Map& operator = (Map&&) = default;

Are you able to provide some insight into why I'm getting these errors? Thank you!

Linker errors when installing

Hey, I'm trying to install tmxlite but I'm not that experienced with adding multiple libraries to a project and making them all work together.

I added the tmxlite include to the Additional Include Directories, the "Debug Static" folder from the binaries to the Additional Library Directories and listed the libtmxlite-s-d.lib under additional dependencies.

I also added all the SFML Directories in the same way I usually add them to a project ( linked against the static debug libraries ).

I made a solution with a new project, added the main.cpp and SFMLOrthogonalLayer.hpp from the SFML example folder and tried to compile it.

However when I try to do that I get a bunch of linking errors, one of which I found especially suspicious :
Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in main.obj TmxLite

I tried changing the runtime library under code generation to MD_d but then I get it the other way around !
Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj

Do you have any idea how I could solve this ? I think this might be the result of me linking the wrong kind of SFML/tmxlite files together but both the SFML libraries I linked and the tmxlite ones are static libraries. Any ideas what's going on ?

Installing?

I use visual studio 2017, and I would like to know how to link tmx lite with visual studio studio. It would also be useful to include an explanation for code::blocks for other users. :)

Replacing a single tile during run

Chunk(const tmx::TileLayer& layer, std::vector<const tmx::Tileset*> tilesets,

I am trying to modify the SFMLOrthogonalLayer.hpp so that I can update a single tile when the player destroys it (replace it with another tileID), but I'm having problems accessing the ChunkArray inside the Chunk which Vertices I would have to modify in order to replace a tile.
Any tips on how to do it? If not I might have to replace the whole renderer, that would be alot of work... I'm new to C++ and struggling to understand the unique pointers and all that stuff

How do you move the map?

right now im using
view.move(currMoveVec);
but is there a way to move just the map instead of the whole view?

Error parsing collection of images tilesets

Hi,

I am probably not doing it right and is also probably not a bug, but the SFML Sample map example errors if if the Map is created using "Collection of Images". I am not sure why that should be an error. Is anyone else facing a similar error. My tiles are 505x505

Failed to load image "". Reason: Unable to open file

Ex: Dessert.Tmx
tileset firstgid="1" source="images/tilemap/Dessert1.tsx"

Dessert1.tsx
image width="505" height="505" source="platform-block-01.png"

error from tmxlite wiki example & from SFMLExample too

i'm trying out tmxlite and from the first steps i did, i've encountered few errors.
some i could solve, some i couldn't.
the first one is from the wiki 'get started example when i try to compile it, here's what i get:
( also, please note that i'm at beginner level in cpp at the moment )

MBP: my_tmxlite_test
$ g++ -I /usr/local/include/ -o bleh tmxlite-test.cpp 
tmxlite-test.cpp: In function ‘int main()’:
tmxlite-test.cpp:12:48: error: ‘Object’ is not a member of ‘tmx::Layer’
             if(layer->getType() == tmx::Layer::Object)
                                                ^~~~~~
tmxlite-test.cpp:21:53: error: ‘Tile’ is not a member of ‘tmx::Layer’
             else if(layer->getType() == tmx::Layer::Tile)
                                                     ^~~~
tmxlite-test.cpp:28:36: error: ‘class tmx::Map’ has no member named ‘getTileSets’; did you mean ‘getTilesets’?
         const auto& tilesets = map.getTileSets();
                                    ^~~~~~~~~~~
                                    getTilesets
tmxlite-test.cpp:29:35: error: unable to deduce ‘auto&&’ from ‘tilesets’
         for(const auto& tileset : tilesets)
                                   ^~~~~~~~
MBP: my_tmxlite_test
$ 

i have no idea what i should do to make this code from the wiki to work properly.

and then from SFMLExample too:

MBP: tmxlite
$ cd SFMLExample/

MBP: SFMLExample
$ mkdir build && cd build
MBP: build
$ cmake ..
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found tmxlite: /usr/local/lib/libtmxlite.so  
-- Found SFML 2.5.0 in /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/klaus/Sources/tmxlite/SFMLExample/build
MBP: build
$ make
Scanning dependencies of target SFML_example
[ 50%] Building CXX object CMakeFiles/SFML_example.dir/src/main.cpp.o
In file included from /home/klaus/Sources/tmxlite/SFMLExample/src/main.cpp:33:
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp: In constructor ‘MapLayer::Chunk::Chunk(const tmx::TileLayer&, std::vector<const tmx::Tileset*>, const Vector2f&, const Vector2f&, std::size_t, MapLayer::TextureResource&)’:
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp:132:21: error: ‘Logger’ has not been declared
                     Logger::log("This example does not support Collection of Images tilesets", Logger::Type::Info);
                     ^~~~~~
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp:132:96: error: ‘Logger’ has not been declared
                     Logger::log("This example does not support Collection of Images tilesets", Logger::Type::Info);
                                                                                                ^~~~~~
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp:133:21: error: ‘Logger’ has not been declared
                     Logger::log("Chunks using " + ts->getName() + " will not be created", Logger::Type::Info);
                     ^~~~~~
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp:133:91: error: ‘Logger’ has not been declared
                     Logger::log("Chunks using " + ts->getName() + " will not be created", Logger::Type::Info);
                                                                                           ^~~~~~
In file included from /home/klaus/Sources/tmxlite/SFMLExample/src/main.cpp:33:
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp: In member function ‘void MapLayer::updateVisibility(const sf::View&) const’:
/home/klaus/Sources/tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp:330:37: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::unique_ptr<MapLayer::Chunk> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
                 if (idx >= 0 && idx < m_chunks.size() && !m_chunks[idx]->empty())
                                 ~~~~^~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/SFML_example.dir/build.make:63: CMakeFiles/SFML_example.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/SFML_example.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
MBP: build
$ pwd
/home/klaus/Sources/tmxlite/SFMLExample/build
MBP: build
$ 

the 2nd one i was able to workaround the problem by commenting out the two Logger lines.
it compiled fine (i just got that warning on line 330 about comparing ints of different signedness),
and i could run the example program. But when i ran it all i got was a black screen and error line printed on stdout:

$ ./SFML_example 
ERROR: Failed opening assets/demo.tmx
ERROR: Reason: File was not found
Not a valid orthogonal layer, nothing will be drawn.
Not a valid orthogonal layer, nothing will be drawn.
Not a valid orthogonal layer, nothing will be drawn.

i had to change the path in main.cpp line 40 to make the program able to find the example map.

map.load("assets/demo.tmx");
map.load("../assets/demo.tmx");

Are tile animations supported?

Right now I have a MapLayer containing my map data which gets rendered like this:
window.draw(*mapLayer);
by the RenderWindow.
I have now included a small animation in this layer but it is only shown in Tiled, not in the final C++ program.
Is there a special method I need to call in order to render animations?
I have seen this code snippet in the Tileset.hpp file:

Tile::Animation::Frame frame;
frame.duration = frameNode.attribute("duration").as_int();
frame.tileID = frameNode.attribute("tileid").as_int();
tile.animation.frames.push_back(frame);

Do I need to execute this specificly? And if so, how?

Issues with VS2019 [Win Toolkit 10.0/platform toolset v142]

The library builds fine with Cmake and VS2019 however when trying one of the SFML examples to test run, I end up with :

1>D:\Libraries\TMXLite\include\tmxlite\detail\Log.hpp(131,1): error C2664: 'void OutputDebugStringW(LPCWSTR)': cannot convert argument 1 from 'const _Elem *' to 'LPCWSTR'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>D:\Libraries\TMXLite\include\tmxlite\detail\Log.hpp(131,50): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\debugapi.h(62,1): message : see declaration of 'OutputDebugStringW'

Opening files on Android fails as NDK does not support fstream

Migrated from #75
Map files will fail to open on android as the NDK doesn't support opening files with fstream. Potential fixes are to either rewrite the file IO using fopen(), create a custom stream for android builds, or provide an interface so users may supply their own file streams.

Expose size of the tileset image

According to the TMX spec <image> can contain width and height with the size of the referenced image (it's optional, but it looks like tiled writes it). Right now tmxlite ignores these attributes, and the only way to figure out the size of the image is to actually load it (completely unnecessary in some cases).
I've hacked in the support for this in my local checkout, I can turn it into a proper PR if that helps.

I need to use this in a std::map but am being prevented by operator deletion

I'm using a manager to store my game maps. The code is similar to this.

//_maps is an std::map. name is a string
tmx::Map _map
MapManager::_maps[name] = _map;

Fails because of operator deleted. So I got rid of that code and am directly storing maps in my game controller. However, I cannot keep loading the map each cycle as that is cpu intensive. I therefore tried to place the maps as private values in the controller but I get this error.

                                                                                            [5/9038]
./include/playing.h:14:18: note: copy constructor of 'PlayController' is implicitly deleted because field '_outerWorld' has a deleted
      copy constructor
        tmx::Map _outerWorld;

./include/tmxlite/Map.hpp:96:9: note: 'Map' has been explicitly marked deleted here
        Map(const Map&) = delete;

How can I get around this? I tried deleting the Map code but it leads to even more errors. Note std::map insert does not work for some reason

Crash on object layer load

Whenever I try to load any map, it crashes with the following error on Map map; map.load("map.tmx");:
Unhandled exception at 0x749B08B2 in tmx.exe: Microsoft C++ exception: std::out_of_range at memory location 0x00739550. occurred
Map loads and renders fine in the older sfml-tmxloader library.
Running Visual Studio 2017 15.4.2 on Windows 10. Tried both using the pre-compiled binaries, compiled my own and included the source code directly, all crashes.

A little help?

I really can't figure out how to get this into my project. Same for the original SFML Tmx Loader....

I include the include folder. That doesn't work. There are no .libs.

None of it works. Can you point me to a tutorial or something that shows me how to get these into my project? I'm using VS 2017 and SFML 2.4+

As for the original tmxloader for SFML I try and use cmake with it. It will give me static libs, only the pugi.dlls and no tmxloader .dll.

I've tried manually including them straight into my solution as their hpps and cpps. For both versions of the loader, and none of it works.

This time i included the src directory in the includes instead of just the "include" directory.

Now get this error

`On line #106 of Log.Hpp (Using VS 2017 64 bit)

std::string outstring

argument of type "const char *" is incompatible with paramaeter of type "LPCWSTR"`

Crashes loading tmx files from version 1.4.0

Worked perfectly with the same tmx file from version 1.3.x but crashes when saved with 1.4.0.

if (name == "tileset")
{
m_tilesets.emplace_back(m_workingDirectory);
m_tilesets.back().parse(node, this);
}

It crashes in the parse function.

Bug in colourFromString

I am getting 'not a valid colour string' errors when loading a map. Tiled is saving the background colour like this '#ffffff' and the line here converts it to 'fffffff' i.e. a seven character string.

One solution is to write that line as

str.erase (std::remove(str.begin(), str.end(), '#'), str.end());

(as discussed here)

I am using MacOS. It may be that other versions of the C++ library do not cause this issue but I don't think that can be relied on according to the standard.

Maps are being displayed incorrectly

problem

This is a problem, and I don't know if I am doing something wrong. I am using sfml with that sfml orthographic header and I get stuff like this. With bigger maps, only parts are shown. Could you please tell me how to avoid stuff like this and what I need to change to prevent it from happening again. The picture is showing just a small area of the screen. The map is being displayed and then the map is being displayed again next to it, just up a tile. Bigger maps, as I said, are being partly shown. It is like there is a border that I can't stop, that keeps on messing up things. Some help would be appreciated. It looks like it also happens with the sfml examples as well. I am using VS 2017 and sfml 2.4. If you need anything, I would gladly send it. Thanks so much.

"Tile image path missing" error

I'm seeing this error when loading a tileset that has individual tile images. I believe the problem is here.
The XML structure in a .tmx file is

<tile>
   <image source="...."/>
</tile>

In the code, node refers to the <tile> element and child is the <image> element. Therefore line 279 should be

std::string attribString = child.attribute("source").as_string();

Also for lines 286 and 288 (I think, please check.)

Proposel: tmx::TileSet::hasTile(id) & tmx::TileSet::getTile(id) &

Good day,

what is your opinion on those functions? I was in need in my project for them so I implemented them quick and dirty in this way:
tmx::TileSet::hasTile

        bool hasTile(uint32_t a_id) const { return a_id >= m_firstGID && a_id <= getLastGID(); };

tmx::TileSet::getTile(id)
This could be optimized with C++17 and std::find. The reason why I return a pointer is because of nullptr and the ownership would be still clear at the tmx::TileSet class.

        const Tile* getTile(uint32_t a_id) const {
            a_id = (getLastGID() - m_firstGID) - (getLastGID() - a_id);
            for (const auto& tile : m_tiles)
                if (tile.ID == a_id)
                    return &tile;
            return nullptr;
        }

If this approach is not modern enough you could return a std::shared_ptr the problem here would be that you have a small overhead.

        const Tile* getTile(uint32_t a_id) const {
            a_id = (getLastGID() - m_firstGID) - (getLastGID() - a_id);
            for (const auto& tile : m_tiles)
                if (tile.ID == a_id)
                    return &tile;
            return nullptr;
        }

Doesn't compile under 64-bit

You assign a size_t value to an int. On a microsoft compiler int is 32-bit and size_t is 64-bit. This produces a bunch of warnings which doesn't compile for me since I treat warnings as errors.

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.