OpenFL -Dnext building fails because ByteArray.hx can't find cpp.NativeArray

Just implemented support for lower frame-rates, so we can knock that off the list :slight_smile:

1 Like

@singmajesty I ran into an issue. The legacy SharedObject uses these two classes:
sys.FileSystem;
sys.io.File;

However, I have no idea where they are. I looked in the openfl as well as lime packages but canā€™t find any sys namespace, and itā€™s not located in root of haxelib either. A hint?

These are haxe standard library classes,
http://api.haxe.org/sys/FileSystem.html

Thanks ibilon!

Just downloaded OpenFL 3.0.6 and there are some changes where instead of using sys.io.File, itā€™s using openfl.filesystem.File. Iā€™ll continue with that.

sys.io.File sounds right, you just need to #if sys #end around the import, so it doesnā€™t break Flash or HTML5 compilation :slight_smile:

What, but it complained that sys.io.File didnā€™t have the property applicationStorageDirectory! Which indeed it doesnā€™t. So we do need a separate openfl.filesystem.File, which Iā€™ve copied over from _legacy.

Iā€™m trying to build it now to see if loading the shared object works. But Iā€™m having some issues with my dev environment. I forked openfl, then set up the local repository in my /usr/lib/haxe/lib/openfl, so I have it in a folder named dev, right next to my 3,0,6. I thought I could haxelib set openfl dev but then when I try to run openfl test mac, it fails: ā€œError: Could not find haxelib ā€œopenflā€, does it need to be installed?ā€ I get the same result just by running openfl in Terminal. Is there any guide on setting up for contributing?

applicationStorageDirectory can be found in lime.system.System http://docs.openfl.org/lime/system/System.html

Maybe doing a haxelib dev openfl dev would work better.

1 Like

Iā€™ve also just done an initial implementation of the GameInput API

Thanks ibilon, Iā€™m a noob! Iā€™m now properly set up with dev environment :slight_smile:

lime.system.System.applicationStorageDirectory is a string, while openfl.filesystem.File.applicationStorageDirectory is a File instance. The file instanceā€™s nativePath is what is used in legacy, but thereā€™s an inconsistency:

System.applicationStorageDirectory -> /Users/x/Library/Application Support/Xavier Stamps-Lafont/TheMission/
File.applicationStorageDirectory. nativePath -> /Users/x/Library/Application Support/TheMission

So System uses the company attribute from the project.xml meta element and the title attribute to form the path, while File only uses the title attribute. Iā€™m finding it in Lime, but a bit shaky about modifying it since I donā€™t know what all the implications areā€¦

Should the application storage use the company/title in the path, or just the title?? I would think the title, both because itā€™s a bit clearer file structure, and because it would maintain backwards compatibility. But probably itā€™s a call for @singmajesty

Currently using this C++ code (with SDL2) to get the storage path:

I suppose we could test and see what happens if the company is set to an empty string, to see if it matches. I wonder, though, how it compares on mobile

Hey I got it to load my shared object data!

For testing it, I changed this:

To:
return lime_system_get_directory (SystemDirectory.APPLICATION_STORAGE, ā€œā€, file);

And that loaded fine. The path ended up being like /Users/x/Library/Application Support//TheMission///ControlsConfig.sol but the extra / are ignored.

Iā€™m not sure about mobile. I canā€™t spend much time on this, if itā€™s fine to just get it working on desktop (assuming itā€™s consistent across Mac/Windows/Linux?) and make a pull request for that, then somebody else can resume for other platforms.

Also, are there unit tests for these?

Thatā€™s fine, get it working for desktop (perhaps #if desktop on the Lime change) and send over the pull requests. We can always continue to tune things as we go :slight_smile:

Hmm I donno if itā€™s that simple, the conditional in the Lime change. Currently itā€™s like this:

Does desktop target mean cpp and neko only? I canā€™t seem to find the conditional compiling documentation on OpenFL anymore.

Thatā€™s fine, I forget, I thought #if desktop was defined, but honestly we should have an #if cffi or perhaps we should consider using #if sys for these

Oh, I meant #if desktop because Iā€™m not sure this applies to mobile, for example:

lime_system_get_directory (SystemDirectory.APPLICATION_STORAGE, #if desktop "" #else company #end, file);

Hm Iā€™m still not sure what conditions to use. Itā€™s odd to have this:

#if (cpp || neko || nodejs)
return lime_system_get_directory (SystemDirectory.APPLICATION_STORAGE, #if desktop "" #else company #end, file);
#else
return null;
#end

Itā€™s odd to have these conditionals within each other, also makes it difficult to read the code. Iā€™d rather:

#if (desktop)
return lime_system_get_directory (SystemDirectory.APPLICATION_STORAGE, "", file);
#elseif (nodejs || ?????)
return lime_system_get_directory (SystemDirectory.APPLICATION_STORAGE, company, file);
#else 
return null;
#end

Isnā€™t there documentation for what all conditionals there are?

You could do the latter if you want, keep it as #elseif cpp || nodejs

Sorry about the really late response, been very busy recently.

I updated to latest Lime and OpenFL so that I could continue on this SharedObject stuff, but now have some other issues.

Primarily the text is placed differently, which is very odd. It seems the actual TextFields are placed at double the x and y values that are set, and maybe the width and height are also reported as double what they used to be in -Dlegacy. I get these traces when compiling:

Could not find primitive lime_cairo_set_font_face__2.
Could not find primitive lime_cairo_set_font_size__2.
Could not find primitive lime_cairo_set_font_options__2.
Could not find primitive lime_cairo_get_font_options__1.
Could not find primitive lime_cairo_show_text__2.
Could not find primitive lime_cairo_rotate__2.
Could not find primitive lime_cairo_scale__3.
Could not find primitive lime_cairo_ft_font_face_create_for_ft_face__2.
Could not find primitive lime_cairo_font_face_destroy__1.
Could not find primitive lime_cairo_font_options_create__0.
Could not find primitive lime_cairo_font_options_get_antialias__1.
Could not find primitive lime_cairo_font_options_get_subpixel_order__1.
Could not find primitive lime_cairo_font_options_get_hint_style__1.
Could not find primitive lime_cairo_font_options_get_hint_metrics__1.
Could not find primitive lime_cairo_font_options_set_antialias__2.
Could not find primitive lime_cairo_font_options_set_subpixel_order__2.
Could not find primitive lime_cairo_font_options_set_hint_style__2.
Could not find primitive lime_cairo_font_options_set_hint_metrics__2.
Could not find primitive lime_buffer_get_native_pointer__1.

Do I have to rebuild something for the text to work properly?

The other issue I already mentioned earlier in this post, my input layer isnā€™t working properly, Iā€™ll look into that.

Are you using source? If so, make sure you git submodule init && git submodule update and rebuild

Or try a newer version, your error looks like something that was fixed