https://linen.dev logo
Join DiscordCommunities
Powered by
# openfl
  • o

    orange-van-60470

    12/19/2022, 2:02 AM
    https://nanjizal.github.io/turtleAnimation/index.html this is webgl animation
  • o

    orange-van-60470

    12/19/2022, 2:02 AM
    I have not built the lime version but it would be slower
  • o

    orange-van-60470

    12/19/2022, 2:03 AM
    definitely slower to redraw with lime
  • h

    hallowed-ocean-84954

    12/19/2022, 2:17 AM
    ok ... I'll have to do experiments at some point - but I don't know why it's like that
  • d

    damp-artist-60225

    12/19/2022, 8:54 AM
    Is there any way to use Google Play's billing library v4+, for in-app purchases? It's mandatory now, and the "extension-iap" extension seems to only support v1.2.2, from what I can tell.
  • a

    able-printer-41379

    12/19/2022, 12:56 PM
    is there a sparrow atlas animation library for openfl?
  • w

    witty-island-52596

    12/19/2022, 5:57 PM
    Copy code
    hx
    var loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, (e)->
    {
        if (loader.content is Bitmap)
            callback((cast loader.content:Bitmap).bitmapData);
        else
            throw "Expected Bitmap";
    });
    loader.addEventListener(IOErrorEvent.IO_ERROR, (e)->{trace('IOError: ${e.toString()}');});
    loader.addEventListener(ProgressEvent.PROGRESS, (e)->{trace('ProgressEvent: ${e.toString()}');});
    loader.load(new URLRequest(getIconPath(size)));
    this doesn't seem to be working
  • w

    witty-island-52596

    12/19/2022, 5:59 PM
    no events fire
  • w

    witty-island-52596

    12/19/2022, 6:00 PM
    If I were to load the file as a string, would I use loadFromBase64 to convert the data to a bitmap?
  • w

    witty-island-52596

    12/19/2022, 6:00 PM
    i'm struggling to understand the MIME-type arg, anyone got examples?
  • w

    witty-island-52596

    12/19/2022, 6:03 PM
    it's a webp image, btw. but that works in my other project
  • r

    rhythmic-wolf-50922

    12/19/2022, 6:07 PM
    @witty-island-52596 have you tried storing the
    Loader
    in a non-local variable somewhere, just in case it's getting garbage collected?
  • w

    witty-island-52596

    12/19/2022, 6:08 PM
    good idea
  • w

    witty-island-52596

    12/19/2022, 6:09 PM
    that said, does BitmapData.loadFromFile load from https?
  • w

    witty-island-52596

    12/19/2022, 6:09 PM
    looks like Loader may be using that under the hood
  • r

    rhythmic-wolf-50922

    12/19/2022, 6:10 PM
    I load an image with Loader from https in one of my Feathers UI samples, so it should work
  • w

    witty-island-52596

    12/19/2022, 6:11 PM
    I just realized I misread loadFromFile's doc
    A local file path or web address containing an image
    and missed the "web address" part
  • w

    witty-island-52596

    12/19/2022, 6:11 PM
    I think I prefer this to using loaders
  • w

    witty-island-52596

    12/19/2022, 6:14 PM
    might suffer from the same problem tho
  • w

    witty-island-52596

    12/19/2022, 6:21 PM
    tried it, no luck
    Copy code
    hx
    static var loading = new Map<Int, Loader>();
    public function loadIcon(size:NGIconSize = LARGE, callback:(BitmapData)->Void)
    {
        var loader = new Loader();
        loading[this.id] = loader;// store ref to avoid GC
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, (e)->
        {
            loading.remove(this.id);
            if (loader.content is Bitmap)
                callback((cast loader.content:Bitmap).bitmapData);
            else
                throw "Expected Bitmap";
        });
        loader.addEventListener(IOErrorEvent.IO_ERROR, (e)->{trace('IOError: ${e.toString()}');});
        loader.addEventListener(ProgressEvent.PROGRESS, (e)->{trace('ProgressEvent: ${e.toString()}');});
        loader.load(new URLRequest(getIconPath(size)));
    }
  • w

    witty-island-52596

    12/19/2022, 6:22 PM
    no events are firing
  • w

    witty-island-52596

    12/19/2022, 6:22 PM
    also I was under the impression that useWeakRef = false* should prevent GC on event listeners
  • r

    rhythmic-wolf-50922

    12/19/2022, 6:24 PM
    it's a common misconception. with an event listener, it's the Loader holding a ref to the listener. the listener isn't holding a ref to the Loader. to prevent garbage collection of the Loader, something needs a ref to the Loader.
  • w

    witty-island-52596

    12/19/2022, 6:25 PM
    I also assumed the stack held a ref to it since it's reffed in an anonymous callback
  • w

    witty-island-52596

    12/19/2022, 6:25 PM
    but thats some shaky logic
  • r

    rhythmic-wolf-50922

    12/19/2022, 6:25 PM
    weak refs make sense when a global object (like the stage) is the dispatcher because that can prevent something from being garbage collected.
  • r

    rhythmic-wolf-50922

    12/19/2022, 6:26 PM
    anyway, we've determined that it's probably not GC in this case
  • w

    witty-island-52596

    12/19/2022, 6:26 PM
    yeah
  • w

    witty-island-52596

    12/19/2022, 6:26 PM
    also tried BitmapData.loadFromFile with no luck
  • r

    rhythmic-wolf-50922

    12/19/2022, 6:26 PM
    which target are you using?
1...232425...57Latest