B4A Library ProBundle

aidymp

Well-Known Member
Licensed User
Longtime User
Regarding the CoverFlow lib is there a way to "wrap a round" the list?

Thanks

Aidy
 

Informatix

Expert
Licensed User
Longtime User
Regarding the CoverFlow lib is there a way to "wrap a round" the list?

Thanks

Aidy
The only way for now is to repeat many many times the same list. If you select a starting position in the middle of this long repeated list, scrolling to the left or to the right gives the feeling that the list is infinite. As the images are loaded only when needed, the memory consumption stays low. It's a poor trick, I agree, but there's no other way to do that. Maybe I will add an option in the future.
 

Informatix

Expert
Licensed User
Longtime User
There's a new version available for download for ProBundle and the guides.

Changelog:
- I fixed a bug in the C code of F5Steg. This library did not work on some devices;
- I fixed the same bug in the C template of SecureVaultGenerator;
- I fixed a bug in DataCollection. Array of objects were not properly serialized;
- I added two sections to the MySecureVault guide (What should I protect? and Troubleshooting);
- I updated the Proguard files and added two new examples (for HttpUtils2+OkHttp and UltimateListView);
- The byte arrays are now compressed by SecureVaultGenerator.
 

aidymp

Well-Known Member
Licensed User
Longtime User

You really do spoil us!

As you know I like to ask the most stupid questions! So here is stupid question number 230923, Would the ArchiverPlusZip lib work on B4j?

Thanks

Aidy
 

Informatix

Expert
Licensed User
Longtime User
There's a new version of ProBundle. I added two libraries, ClassLoader and CPUFeatures, and I updated ArchiverPlusUnrar with the latest available C code.

ClassLoader can dynamically load classes from a separate file (JAR or uninstalled APK) at runtime and verify the file signatures to make sure of its origin.
This library can be used to create plug-ins, load code encrypted in the assets or download code from a remote server, for example.

CPUFeatures detects the target device's CPU family and the maximum number of CPU cores.

Changelog v1.08:
- I added the ClassLoader library with a demo;
- I added the CPUFeatures library with its Java and C source code;
- I updated ArchiverPlusUnrar with the latest available C code;
- I added a native add-on to ArchiverPlusUnRar and F5Steg with a read_me file.
 
Last edited:

wonder

Expert
Licensed User
Longtime User
Hi Fred,

I'm developing a game where my character throws bombs and I would like to use a dynamic array of lgTextureRegions.

Since I never use lists (in-game), I usually do something like this:
B4X:
Sub Globals
    Dim BombArray() as lgTextureRegion
End Sub

'Adds a new bomb to the current amount of bombs on screen.
Sub ThrowBomb
    Dim tempArray = BombArray as lgTextureRegion
    Dim BombArray(tempArray.Lenght + 1)
    For i = 0 To (tempArray.Lenght - 1)
        BombArray(i) = tempArray(i)
    Next
    BombArray(BombArray.Lenght - 1).Initialize
    BombArray(BombArray.Lenght - 1).Texture = ....
    ...
    ...
End Sub

Is there a more efficient way to do it, using any of the structures provided in the ProBundle?
 

Informatix

Expert
Licensed User
Longtime User
95% of my data structures are arrays in my games because nothing is faster. If you need to sort your arrays, you can do it with a few java lines or with the library for arrays made by Agraham. I use specialized collections when I need something specific, not possible with arrays, or when the convenience of use is more important than speed.
Note that your code above has a major flaw: it resizes the array repeatedly. A dynamic array is not really compatible with performance (especially for large arrays). In your create event, you should size all arrays at their maximum capacity to avoid resizing them.
If you want to implement a dynamic pool, just memorize the index of the last entry in a fixed size array. When you release an entry, move all entries after the gap to fill it (it's a simple loop that moves references starting from the last entry; it's extremely fast). So the next available entry in the pool is always the index of the last entry + 1. It's what I used for the opponents, the projectiles and the miscellaenous sprites in my tower game. Reusing objects is a major key for good performance. Without allocation/deallocation, you save time and you avoid also the garbage collections.
 

Informatix

Expert
Licensed User
Longtime User
So, it's kinda like a pointer in C/C++! Got it!
Thank you so much!
When you create an object in Java (Object myObject = new Object()), you create a pointer on this object and when you call a function with this object as parameter, you pass the address of the object (its reference), never the object itself. Primitive types are a special case as usual and, contrary to C, you cannot pass a pointer on them, just the value they hold. That's why Java is a "pass-by-value" language. Either you pass the value of the address when it's an object, or the stored value when it's a primitive.
 

wonder

Expert
Licensed User
Longtime User
You have just answered a question that was lingering on my mind for a really long time!
Now I understand why my variables behave differently from objects.
 

DonManfred

Expert
Licensed User
Longtime User
I don't know exactly as I'm not a B4J user
If the lib does not use Android specific methods then it should work. Android Async Task for example will not work in a B4J library.

You need to use the B4J Version of SLC to compile it to a b4j library.
Maybe you can give it a try?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…