https://linen.dev logo
Join Discord
Powered by
# ceramic
  • a

    ambitious-knife-25690

    02/27/2023, 1:24 AM
    <image resource="Images.CERAMIC" />
    would get translated to
    assets.asset("Images.CERAMIC")
  • a

    ambitious-knife-25690

    02/27/2023, 1:24 AM
    if you're trying to load an image through xml
  • a

    ambitious-knife-25690

    02/27/2023, 1:26 AM
    right now I think i've got 2 issues 1) It seems to load the image but it displays white for some reason 2) For some reason i need to load an image asset twice
  • a

    ambitious-knife-25690

    02/27/2023, 1:26 AM
    but the last one might be a user error
  • a

    ambitious-knife-25690

    02/27/2023, 1:26 AM
    Gonna go sleep for now tho, gnight!
  • b

    billowy-waiter-28954

    02/27/2023, 6:46 AM
    Never call asset.load()
  • b

    billowy-waiter-28954

    02/27/2023, 6:47 AM
    The process is: you add « asset » items to an « assets » object, then call assets.load() to trigger the load of newly added assets (get notified with assets.onceComplete())
  • b

    billowy-waiter-28954

    02/27/2023, 6:49 AM
    You can create your own « Assets » instance btw, this is what Scene does internally
  • b

    billowy-waiter-28954

    02/27/2023, 6:50 AM
    I guess that’s one more thing that would deserve a guide page on Ceramic website
  • f

    faint-toothbrush-51643

    02/27/2023, 7:38 AM
    so what does asset.load() do and why is it public?
  • b

    billowy-waiter-28954

    02/27/2023, 7:55 AM
    asset.load() is called by Assets class
  • b

    bright-gpu-74537

    02/27/2023, 8:14 AM
    remember that it will call the getImageInternal function first (and if that doesnt return a result it will try to load it from bytes), internal here means "internal to the framework" (so ceramic), so you could turn
    "Images.CERAMIC"
    into whatever you want... like you could split it on the
    .
    and use reflection or maybe "Images" has a "get" function or something?
  • b

    bright-gpu-74537

    02/27/2023, 8:15 AM
    but suffice to say, the resource="..." can be anything really since you are controlling the code that understands what that means (unless it cant be found - which you also control - then it falls back to assuming its a haxe.Resource)
  • a

    ambitious-knife-25690

    02/27/2023, 11:53 AM
    Okay, but how can i use an asset without the macro?
  • a

    ambitious-knife-25690

    02/27/2023, 11:54 AM
    There is no "get" function with the
    Images
    macro
  • a

    ambitious-knife-25690

    02/27/2023, 11:54 AM
    it is just
    Images.IMAGE_NAME
  • b

    bright-gpu-74537

    02/27/2023, 11:55 AM
    var image = Reflect.field(Images, "IMAGE_NAME")
    ?
  • a

    ambitious-knife-25690

    02/27/2023, 11:56 AM
    Oh, i'll try that, but man that feels a lil dirty 😂
  • b

    bright-gpu-74537

    02/27/2023, 11:56 AM
    i mean, it is a little dirty, but also quite reasonable (in this case) i would say
  • a

    ambitious-knife-25690

    02/27/2023, 11:59 AM
    that doesn't work
  • b

    bright-gpu-74537

    02/27/2023, 11:59 AM
    so, to test, if you hardcode it to
    Images.CERAMIC
    then its fine? I mean, can you share the code or whatever?
  • a

    ambitious-knife-25690

    02/27/2023, 12:00 PM
    I had a some what "suitable" solution but the image is loaded as a white square
  • a

    ambitious-knife-25690

    02/27/2023, 12:01 PM
    code is a few messages above
  • a

    ambitious-knife-25690

    02/27/2023, 12:01 PM
    this one
  • b

    bright-gpu-74537

    02/27/2023, 12:01 PM
    arent all the assets loaded already?
  • a

    ambitious-knife-25690

    02/27/2023, 12:02 PM
    according to jeremey yes, but not for me it seems
  • a

    ambitious-knife-25690

    02/27/2023, 12:02 PM
    ahhhhh
  • a

    ambitious-knife-25690

    02/27/2023, 12:02 PM
    the issue was that i was calling
    asset.load
  • a

    ambitious-knife-25690

    02/27/2023, 12:03 PM
    > Never call asset.load() > The process is: you add « asset » items to an « assets » object, then call assets.load() to trigger... I was confused by these mixed messages 😂
  • b

    bright-gpu-74537

    02/27/2023, 12:05 PM
    i dont know enough (anything) about ceramic internals to be able to comment, but suffice to say, if the user can load an image that is a ceramic resource then haxeui-ceramic should be able to do the same - and presumably in the same way
1...798081...124Latest