jtransc / gdx-backend-jtransc

GDX backend for JTransc: targeting every platform lime supports (html5, windows, linux, mac, android, ios...) (flash is wip) (consoles + unity likely to be supported in the future)
23 stars 6 forks source link

SplashScreens with haxe:ios target #60

Closed ghost closed 7 years ago

ghost commented 7 years ago

iOS can show splash screen before loading game, in lime i see support this https://github.com/openfl/lime/blob/b40f82b6e7f644c428cac35fe761884a683465ef/lime/tools/platforms/IOSPlatform.hx#L514 But i can't understand how provide it from jtransc.

Please give me any ideas =)

soywiz commented 7 years ago

It seems that there is an undocumented ( http://www.openfl.org/lime/docs/project-files/xml-format/ ) xml tag: https://github.com/openfl/lime/blob/b40f82b6e7f644c428cac35fe761884a683465ef/lime/project/ProjectXMLParser.hx#L1481

By reading the code it seems that it should be something like:

<splashscreen path="..." width="" height="" />

So I think you can do the same trick you did here: https://github.com/jtransc/gdx-backend-jtransc/commit/b3a744864d17197bf3d57c9e00aaf635c128996b#diff-2315d83dcf3b6d05d40bf6c8da2408b4L30

ghost commented 7 years ago

Tnx, i make it asap.

ghost commented 7 years ago

I see we can provide multiply icons and splashes for pixel perfect, but how provide array of strings in extra?

soywiz commented 7 years ago

In build.gradle you can use appendVar (introduced in 0.6.3) : https://github.com/jtransc/jtransc/commit/fdd58dbe26203703adfc64484c5a575f17dddb9f

appendVar("myicons", "icon1.png")
appendVar("myicons", "icon2.png")

Then in template:

{% for myicon in myicons %}
<icon path="{{ myicon }}" />
{% end %}
soywiz commented 7 years ago

If you need some more complex like setting list of maps to do something like:

{% for myicon in myobjs %}
<icon path="{{ myicon.path }}" width="{{ myicon.width }}" />
{% end %}
// WARNING: This doesn't exists
setComplexVar("myobjs", [{ path: "icon1", width: 100, height: 100 }, { path: "icon2", width: 200, height: 200 }])

It doesn't exists, but if you need it I can implement it for this week's release.

ghost commented 7 years ago

I think, this good idea for make groups, but i make first version without it, and return in future.

ghost commented 7 years ago

to @soywiz {% for myicon in myicons %} not working {% for myicon in extraVars.myicons %} not working too

https://github.com/SergeyLabutin/gdx-backend-jtransc/blob/master/gdx-backend-jtransc/resources/program.xml#L45 https://github.com/SergeyLabutin/jtransc-examples/blob/master/spine-demo/build.gradle#L78

soywiz commented 7 years ago

Thats strange. They should be available at the top level. I will check in a few hours when i get home

ghost commented 7 years ago

program.xml fixed, but need more work in backend

ghost commented 7 years ago

@soywiz It works now, in manual tests. Lime ignore splashscreen without width and heigh attributes. Need support in jtransc setComplexVar("myobjs", [{ path: "icon1", width: 100, height: 100 }, { path: "icon2", width: 200, height: 200 }])

soywiz commented 7 years ago

Going to work on it. Also I can add a couple of functions or filters to get an image properties for you directly. Something like:

{{ path|image_width }}
{{ path|image_height }}

or

{% set image = image_properties(path) %}
path="{{ path }}" width="{{ image.width }}" height="{{ image.height }}"

So you can make this simple and avoid having to do this manually.

ghost commented 7 years ago

@soywiz please, help me

{% for splashScreen in splashScreens %}
{% set splashImage = image_properties(splashScreen) %}
<splashScreen path="{{ splashScreen }}" width="{{ splashImage.width }}" height="{{ splashImage.height }}" if="ios" />
{% end %}

Not working, splashImage always is null =( I can not find description image_properties() anywhere.

soywiz commented 7 years ago

Ill look this in a few hours. I also have the PR for getting the size of an image inside the template almost done so i eill have this probably today too

soywiz commented 7 years ago

Also will release new version of jtransc. After this is done. Probably tomorrow