feat: LoadTMXFromMemory#31
Open
cortexmancer wants to merge 1 commit intoRobLoach:masterfrom
Open
Conversation
Owner
|
This is great, thanks for taking it on. Glad baylej brought in the change. While I haven't looked deep into how it's set up, I think we'd need to figure out the virtual path stuffs within tmx. Loading a map from a buffer is helpful if you're loading the map from a .zip file, or another virtual file system. Like through https://github.com/RobLoach/raylib-physfs . #define RAYLIB_PHYSFS_IMPLEMENTATION
#include "raylib-physfs.h"
int main() {
// Initiatize the file system.
InitPhysFS();
MountPhysFS("resources.zip", "res");
// Load an image through PhysFS directly from resources.zip.
tmx_map* map = LoadTMXFromPhysFS("res/map.tmx");
// TODO: Since the "res" basepath isn't sent through to
// LoadTMXFromPhysFS(), how does the .tmx know where to load its images?
// Close the file system.
ClosePhysFS();
}But again, the buffer loading is only helpful if you're using something other than raylib's stdio file loading. |
Contributor
Author
I was asking myself why this was helpful! Nice input. So some points:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello. I took the liberty to implement this TODO and notice some things.
Looking at baylej/tmx#58 is kinda hard to understand because it seens like baylej forced pushed on your commit, instead of creating a new one.
But I think you intended to tmx_load_buffer_path to acts like tmx_rcmgr_load_buffer_vpath is acting but without the definition of an resource manager. Due to this, it is impossible for the current function tmx_load_buffer_path to find files in a path of a given fileName.
The tests shows that to use this method correctly as it is, without defining the resource manager, the user must control the current directory that is loading. I don't think that is a great deal anyway.
Let me know what you think?
Was that your idea?
Is this implementation okay?
Do you think we should handle the resource_manager somehow?
closes #4 ?