SDL_getbasepath |
Owen Alanzo Hogarth
Guest
|
Hi it seems SDL_getBasePath() isn't implemented on android atmI found this doc:Â https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46
so I implemented it myself but with this test application I am getting back this location: Â /data/data/org.libsdl.app/files/ that doesn't seem to be the resources directory and even if i add an assets directory and put my files in there, they are not copied over to that location. How can I get the location of the assets directory through SDL on android? |
|||||||||||
|
SDL_getbasepath |
hardcoredaniel
Guest
|
Hi,
as far as I understand the concept, "assets" are read-only files that are bundled inside the app's a.pk - i.e. they are not unpacked and thus the assets do not form a "real" directory. You can read assets in C via dedicated functions only, they cannot be accessed via direct file IO. I don't know whether SDL implements this "special" Android behaviour for assets. If not, you can take a look at this header file
Daniel ---------- Původnà zpráva ---------- Od: Owen Alanzo Hogarth Komu: Datum: 17. 8. 2015 14:05:54 Předmět: [SDL] SDL_getbasepath
|
|||||||||||||||
|
SDL_getbasepath |
Owen Alanzo Hogarth
Guest
|
Thank you, using android Â
worked out. On Mon, Aug 17, 2015 at 8:25 PM, hardcoredaniel wrote:
|
|||||||||||||||||||
|
SDL_getbasepath |
Leonardo
|
SDL_RW* functions also read from files in asset folder.
Em seg, 17 de ago de 2015 Ã s 16:46, Owen Alanzo Hogarth escreveu:
|
|||||||||||||||||||||
|
SDL_getbasepath |
Owen Alanzo Hogarth
Guest
|
@Leonardo
Do you have some sample code that you use with SDL_RW* functions? I would prefer to keep things inside of SDL_* functions if at all possible. Best, Owen On Tue, Aug 18, 2015 at 3:48 AM, Leonardo Guilherme wrote:
|
|||||||||||||||||||||||
|
SDL_getbasepath |
Leonardo
|
Well, you'd use SDL_RWFromFile("file"), and if there's a file in assets/ folder with that name, it will automagically open. Then you use it almost as you would with stdio. The wiki page might have more info, but its really a no brainer. Replace fopen/fclose/fread with SDL_RW* stuff and you're set.
It is worth noticing that all SDL functions that open files (like SDL_LoadBMP) use RWops by default, they should just work on android. Here's the wiki link: https://wiki.libsdl.org/SDL_RWops HTH, Leonardo. Em seg, 17 de ago de 2015 Ã s 18:15, Owen Alanzo Hogarth escreveu:
|
|||||||||||||||||||||||||
|
SDL_getbasepath |
Jonny D
|
Also, the satellite libraries (SDL_image, SDL_ttf, etc.) load files via SDL_RWops, so they work right on Android as well.
Jonny D On Tue, Aug 18, 2015 at 1:34 AM, Leonardo Guilherme wrote:
|
|||||||||||||||||||||||||||
|