Open wighawag opened 6 years ago
Say for flash you can't change W/H via System.init
as it is compiled into the swfheader and therefore must be set via khafile.js
project.windowOptions.width = 960;
project.windowOptions.height = 540;
This will generate the required -swf-header 960:540:60:ffffff
directive in the project-flash.hxml . That was the original usecase of the projectOptions.windowOptions i implemented.
I think someone extended the usage for other targets then as well.
ok, should not this be a targetOptions then if it is platform specific it could be called : targetOptions.flash.swfheader
It would be cool if we had a design principle for options so we do not have the current situation with width/height
Well you can just ignore it, then you get the default 800x600 iirc.
Edit: It will be overwritten via System.init()
anyway if the target supports it.
What I mean and the purpose of this issue is to decide on how options are supposed to work.
If we could put all target specific options in targetOptions this would already a first step.
I understand though that compile time width/height might be something needed for other target and so the case you mentioned might still belong to windowOptions.
Currently System.init width/height options do not get used on the html5 target for example but the width/height set in the khafile project.windowOptions get used in the html5 template (which is normally only used for development).
So as of now, there is no strict design principle
I suggest that the html5 template variable should be html5 target specific and named accordingly, maybe targetOption.html5.template.width ...
Then if we need windowOptions.width/height or any other options and there is an equivalent named options in System.init, System.init should take precedence
IIRC, flash was the only exceptional case in the beginning, not sure who implemented it for html5 or if it's even a good idea as you can easily supply your own template. But it does sound reasonable to remove the project.windowOptions
and put it in the respective project.targetOptions
.
When calling System.init, kha allows us to set options
Kha also allow us to set options via the khafile
Since the options sometime refers to the same thing (like width and height)
Which one should take precedence?
Or do they have each different purpose ?