Global Z ordering
Hello, there is no global Z ordering between all sprites on scene.
Maybe Actor::setPriority will help you. It is local z ordering for actor's children.
Global Z ordering
so if you will work on own global Z ordering
here is some tips for you:
-
use Actor::_getFlags()
it is protected method which give you access to 'flags' where you could store your own 'z-order' flag without custom inheritance from each actor/sprite -
override virtual Actor::render and collect all actors to vector<> with priorities. sort then draw this list
-
you will need to save RenderState/Transform too for each Actor to correct rendering
Global Z ordering
Thanks for fast response and tips
I try implementing my own ordering system.
Loading xml
Hello,
I have one problem with loading game resources.
If I try to load an xml file, located in current or parent directory using relative path, file will be loaded:
Resources gameResources;
gameResources.loadXML("../resources.xml");
But if I try to load an xml file, located in a directory that hierarchically above than parent using relative path, file will not be loaded:
Resources gameResources;
gameResources.loadXML("../../resources.xml");
If I use absolute path, file will be loaded successfully anywhere.
Can I solve this problem without using getcwd() or similar function?
Loading xml
Hi, need more info
- show hierarchy tree
- what Working Dir?
- show log with error
btw, if you trying to "leave" working dir it wont work
Loading xml
Apperantly, Working Dir is directory with result executable binary file.
For example, my directory with executable file is "~/project/bin/build-x/".
If the xml file also placed in this directory, I can load it using this code:
gameResources.loadXML("resources.xml");
If I place the xml file in the directory "~/project/bin/", I can load it using this code:
gameResources.loadXML("../resources.xml");
But if I place the xml file in the directory "~/project/", I can't load it using this:
gameResources.loadXML("../../resources.xml");
Consequently, I can't load the xml file if it placed in any of a child directory of "~/project/", for example "~/project/data" or similar.
Log with errors in this case:
054 error: can't read file: resources.xml to buffer
054 error: can't load xml file: '../../resources.xml'
054 error: Assert! !"can't find xml file"
Loading xml
@arcanius said in Loading xml:
Apperantly, Working Dir is directory with result executable binary file.
you are not right
working dir is root directory with all resources, you should not exit from it
binary file could be located anywhere
Loading files from c++ using android ndk
Hello
I have built a game that is working in Windows. It loads multiple XML-files that define game maps. The files are stored in the data folder together with the res.xml and I use pugi XML to read the files. Now I am migrating to android using Android studio and ndk (as the oxygine Hello world android example). I have managed to build the project. The XML files are located in the assets project folder (once again, together with the rest.xml file). After the build I can see that they are included in the apk-file.
The game starts (I see this in the debugger) and the res.xml file is successfully loaded but when my code reads the additional XML files, the pugi reader says that the file is not found. Do I have to do anything special to access these files?
Loading files from c++ using android ndk
Never mind. Did exactly as it says in the the Filesystem article of the Oxygine wiki. Now it works.
Is there a way to pause a tween
I have a progress sprite, and following the demo I have the following:
setProgress(0);
setDirection(ProgressBar::dir_0);
_tween = addTween(ProgressBar::TweenProgress(1.0f), cooldown);
_tween->addEventListener(TweenEvent::DONE, CLOSURE(this, &WE_SpellGUI::spellCast));
I see I can complete it using;
_tween->complete();
Is it possible to pause the tween?