Save
Saving
  • C
    Cuco

    I'm not sure I know too. In the onLoad1() and onLoad2() functions I mentioned, when I do

    Assets.blobs.get(name).unload();
    

    it doesn't work. When I do

    Reflect.callMethod(Assets.blobs, Reflect.field(Assets.blobs, name + "Unload"), []);
    

    it works. Inside the onLoad1() and onLoad2() callbacks, I can correctly ask if an asset is or isn't loaded (by saying Assets.blobs.get(name) != null) using this last way of unloading, but not the first.

    posted in Kode read more
  • C
    Cuco

    Well, I'm unloading some files (one by one) in their onLoad1 callback, and shortly afterwards, in the same callback, I'm reloading them again (with a new onLoad2 callback). Then, I'm unloading them again in this new callback. lol I suppose this is a bit confusing, but it works fine. I need to do this, for some sets of files, every time the app starts, to build (at the end of the first callback) and populate (somewhere in the second callback) a data structure per set of files, needed for the app to work. Only when these data structures are built and populated, can those sets of files be used normally in the regular course of the app. I can't use loadEverything because there are lots of files in the project, but, if I could, it would make things easier.

    posted in Kode read more
  • C
    Cuco

    For some reason, the unload() functions don't work for me. That's why I asked, to try to learn a bit more about their behaviour. After a few tries, I discovered I have to do

    Reflect.callMethod(Assets.blobs, Reflect.field(Assets.blobs, name + "Unload"), []);
    

    to get the results I need.

    posted in Kode read more
  • C
    Cuco

    Yes, that did it, thank you!

    However, I had to wait over 20 minutes for the thing to compile! And the final APK size, with an empty assets folder, was over 10 whooping megs! Which is why I'd like to ask you to continue supporting the android-java target. I know it's slow, but the stuff I'm doing isn't too demanding. Besides, it compiles in less than 2 minutes and the APK is really very small. For the 'tiles & a few sprites' kinda project the android-java target is, I think, ideal. If I was doing 3D, the android-native target would be the way to go, undoubtedly, but I'm not. I'd like to say I have no idea what sort of work goes into maintaining a Kha backend, but I really like the android-java one, and I'd like to ask you to think twice before discarding it.

    Thanks again!

    posted in Kode read more
  • C
    Cuco

    Sorry. I'm running Windows 10, VS Code 1.38.1, Kha downloaded from github yesterday, and gradle 5.4.1. I started a new Kha project and the Main.hx file looks like this:

    package;
    
    import kha.Assets;
    import kha.System;
    
    class Main
    {
    	public static function main()
    	{
    		System.start({title:"TestKha", width:512, height:384}, function(_)
    		{
    			Assets.loadBlob("blob_res", function(_)
    			{
    				if(Assets.blobs.blob_res != null)
    					trace("Loaded!");
    			});
    		});
    	}
    }
    

    (I've got a 'blob.res' file in the assets folder.) I then did a native Android build and, when building, got the following error (with lots of lines deleted - just skip to the last bit):

    Build command failed.
    Error while executing process C:\Development\Android\android-sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build C:\Users\Rui\Projects\TestKha\build\android-native-build\TestKha\app\.cxx\cmake\debug\armeabi --target kore}
    [1/529] Building CXX object CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics2/Graphics1.cpp.o
    [2/529] Building CXX object CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics2/truetype/VectorOfIntPointer.cpp.o
    [3/529] Building CXX object CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics4/ConstantLocation.cpp.o
    [4/529] Building CXX object CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics2/truetype/Stbtt_packedchar.cpp.o
    [5/529] Building CXX object CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics2/truetype/Stbtt_temp_font_v_metrics.cpp.o
    [6/529] Building CXX object CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics1/Graphics.cpp.o
    FAILED: C:\Development\Android\android-ndk-r15b\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe  --target=armv5te-none-linux-androideabi --gcc-toolchain=C:/Development/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --sysroot=C:/Development/Android/android-ndk-r15b/sysroot  -Dkore_EXPORTS -IC:/Users/Rui/Projects/TestKha/build/android-native-build/Sources/include -IC:/Development/Kha/Backends/Kore/lib -IC:/Development/Kha/Backends/Kore/khacpp/include -IC:/Development/Kha/Backends/Kore/khacpp/project/thirdparty/pcre-8.42 -IC:/Development/Kha/Backends/Kore/khacpp/project/thirdparty/zlib-1.2.11 -IC:/Development/Kha/Backends/Kore/khacpp/project/libs/nekoapi -IC:/Development/Kha/Backends/Kore/khacpp/project/thirdparty/mbedtls-2.9.0/include -IC:/Development/Kha/Kinc/Sources -IC:/Development/Kha/Kinc/Backends/System/Android/Sources -IC:/Development/Kha/Kinc/Backends/System/POSIX/Sources -IC:/Development/Kha/Kinc/Backends/Graphics4/OpenGL/Sources -IC:/Development/Kha/Kinc/Backends/Graphics5/G5onG4/Sources -IC:/Development/Kha/Kinc/Backends/Audio3/A3onA2/Sources -isystem C:/Development/Android/android-ndk-r15b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:/Development/Android/android-ndk-r15b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -isystem C:/Development/Android/android-ndk-r15b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem C:/Development/Android/android-ndk-r15b/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=14 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -marm -Wa,--noexecstack -Wformat -Werror=format-security  -frtti -fexceptions -O0 -fno-limit-debug-info  -DHXCPP_API_LEVEL=400 -DHXCPP_DEBUG -DHX_SMART_STRINGS -DKORE_MULTITHREADED_AUDIO -DANDROID -D_ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=24 -DSTATIC_LINK -DPCRE_STATIC -DHXCPP_VISIT_ALLOCS -DKHA -DKORE -DROTATE90 -DHAVE_CONFIG_H -DSUPPORT_UTF -DSUPPORT_UCP -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_ANDROID -DKORE_OPENGL -DKORE_OPENGL_ES -DKORE_ANDROID_API=15 -DKORE_POSIX -DKORE_G4 -DKORE_G5 -DKORE_G5ONG4 -DKORE_A3 -fPIC -MD -MT CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics4/ConstantLocation.cpp.o -MF CMakeFiles\kore.dir\C_\Users\Rui\Projects\TestKha\build\android-native-build\Sources\src\kha\graphics4\ConstantLocation.cpp.o.d -o CMakeFiles/kore.dir/C_/Users/Rui/Projects/TestKha/build/android-native-build/Sources/src/kha/graphics4/ConstantLocation.cpp.o -c C:\Users\Rui\Projects\TestKha\build\android-native-build\Sources\src\kha\graphics4\ConstantLocation.cpp
    
    In file included from C:\Users\Rui\Projects\TestKha\build\android-native-build\Sources\src\kha\graphics4\ConstantLocation.cpp:2:
    
    In file included from C:/Development/Kha/Backends/Kore/khacpp/include\hxcpp.h:370:
    
    C:/Development/Kha/Backends/Kore/khacpp/include\hx/Object.h:223:52: error: no member named 'numeric_limits' in namespace 'std'
    
       virtual double __ToDouble() const { return std::numeric_limits<double>::quiet_NaN(); }
    

    Was this detailing more helpful? The last message seems important. Notice how it says there is no member named 'numeric_limits' in namespace 'std' in function __ToDouble() in line 223 in file Kha/Backends/Kore/khacpp/include\hx/Object.h. Does this make sense to you (it's a bit alien to me, I must confess)? There are quite a few lines more in the error message, but they're all connected to this one error, so I didn't print them. Help, please!

    posted in Kode read more
  • C
    Cuco

    I still haven't been able to compile an Android (Native) project. Android Studio issues the following error:

    C:/Development/Kha/Backends/Kore/khacpp/include\hx/Object.h:223:52: error: no member named 'numeric_limits' in namespace 'std'

    posted in Kode read more
  • C
    Cuco

    I guess, from what you've said, that the load...FromPath() functions can load any file in the file system (almost, I guess!). That is interesting to know, as I was about to ask about expansion packs downloaded from a server and placed somewhere in a user's home, and how to access them.

    It is also interesting to know that the loadBlob(), loadImage(), ... functions also set the Assets.blobs.myblob, Assets.images.myimage, ... values before the callback is called.

    Can you explain the Assets.blobs.myblob.unload() function? Is it executed immediately? Does it reset the Assets.blobs.myblob value immediately?

    posted in Kode read more
  • C
    Cuco

    Actually, this is a bit more complicated. Consider the following code:

    package;
    
    import kha.Assets;
    import kha.System;
    
    class Main
    {
    	public static function main()
    	{
    		System.start({title:"TestKha", width:512, height:384}, function(_)
    		{
    			Assets.loadBlobFromPath("blob.res", function(blob)
    			{
    				if(blob != null)
    					trace("Loaded!"); // This works!
    			});
    
    			Assets.loadBlobFromPath("blob.res", function(_)
    			{
    				if(Assets.blobs.blob_res != null)
    					trace("Loaded!"); // This doesn't!
    			});
    		});
    	}
    }
    

    It seems a bit weird that the second example doesn't work, but it doesn't. Can anyone explain?

    posted in Kode read more
  • C
    Cuco

    Yes, that's simpler, thanks!

    posted in Kode read more
  • C
    Cuco

    The assets are copied to target build folder only in Kha 19.2. When I'm using the latest Kha from github, no files are copied. I tried debug-html5 and android-native targets without success.

    posted in Kode read more