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

    ambitious-knife-25690

    02/27/2023, 12:05 PM
    yeah, the thing i'm trying to figure out is "what" should be passed to the
    resource
    field
  • b

    bright-gpu-74537

    02/27/2023, 12:06 PM
    how does a "normal" ceramic app load and display an image?
  • a

    ambitious-knife-25690

    02/27/2023, 12:07 PM
    texture = assets.texture(Images.CERAMIC);
  • b

    bright-gpu-74537

    02/27/2023, 12:07 PM
    ok, so if you, to test, just hardcode getImageInternal (or whatever its called), to always return that texture, does it work?
  • a

    ambitious-knife-25690

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

    ambitious-knife-25690

    02/27/2023, 12:08 PM
    Yeah, i just got a hardcoded version working with haxeui
  • b

    bright-gpu-74537

    02/27/2023, 12:08 PM
    and what does that code from AssetsImpl look like? (just for my brain)
  • a

    ambitious-knife-25690

    02/27/2023, 12:09 PM
    that's loaded with
    <Image resource="ceramic" width="130" height="170" />
  • b

    bright-gpu-74537

    02/27/2023, 12:09 PM
    right, but what does the impl look like in haxeui-ceramic?
  • b

    bright-gpu-74537

    02/27/2023, 12:10 PM
    (just for me to know we are talking about the same thing)
  • a

    ambitious-knife-25690

    02/27/2023, 12:10 PM
    Copy code
    hx
        private override function getImageInternal(resourceId:String, callback:ImageInfo->Void):Void {
            var asset = ceramic.App.app.scenes.main.assets.imageAsset(resourceId);
            if (asset != null) {
                    asset.onceComplete(null, function(suc) {
                        callback({
                            data: asset.texture,
                            width: Std.int(asset.texture.width),
                            height: Std.int(asset.texture.height)
                        });
                    });
            } else {
                trace('empty');
                callback(null);
            }
        }
  • b

    bright-gpu-74537

    02/27/2023, 12:10 PM
    so there is no hardcoding here? So its working?
  • b

    billowy-waiter-28954

    02/27/2023, 12:10 PM
    assets.addImage(your image path)
  • a

    ambitious-knife-25690

    02/27/2023, 12:11 PM
    Yeah, i just got it working a couple of mins ago by removing the
    asset.load()
    call but now I need to figure out what I can pass to ceramic
  • a

    ambitious-knife-25690

    02/27/2023, 12:12 PM
    like i'm not sure what the resourceId would be if a file is in a folder, it may not be
    items/icon
  • a

    ambitious-knife-25690

    02/27/2023, 12:12 PM
    it might be
    items_icon
  • b

    bright-gpu-74537

    02/27/2023, 12:12 PM
    try it i guess... i would presume the latter
  • a

    ambitious-knife-25690

    02/27/2023, 12:13 PM
    Oh, nice to know that I might be able to have ceramic handle "any file" - I might add an asset object to the haxeui backend 🤔
  • a

    ambitious-knife-25690

    02/27/2023, 12:13 PM
    But right now I want to know how to use, users own loaded images
  • a

    ambitious-knife-25690

    02/27/2023, 12:14 PM
    so a user has preloaded their images in code to either
    App.assets
    or
    scene.assets
  • a

    ambitious-knife-25690

    02/27/2023, 12:14 PM
    They may want to use that image in haxeui
  • b

    bright-gpu-74537

    02/27/2023, 12:15 PM
    im a bit lost, havent you already "done it"?
  • a

    ambitious-knife-25690

    02/27/2023, 12:17 PM
    yes, but i don't know how to direct a user on usage
  • a

    ambitious-knife-25690

    02/27/2023, 12:17 PM
    a ceramic user, based on ceramic's design has no concept of mentioning an image asset by string id
  • a

    ambitious-knife-25690

    02/27/2023, 12:17 PM
    its setup through macro
  • b

    bright-gpu-74537

    02/27/2023, 12:20 PM
    ok, well, i mean, if they are used to "Image.CERAMIC", you could always do something like
    var fixed = resourceId.split(".").pop().toLowerCase()
    (obviously ive just invented that), but allowing them to do
    <Image resource="ceramic" />
    or
    <Image resource="Images.CERAMIC" />
    seems nice
  • b

    bright-gpu-74537

    02/27/2023, 12:21 PM
    you might also want to make sure (at some point) that this also works in code, ie:
    myImage.resource = Images.CERAMIC
    (
    .resource
    is a
    Variant
    , and one of its types can be
    ImageData
    , which for you is a
    Texture
    - i believe)
  • a

    ambitious-knife-25690

    02/27/2023, 12:22 PM
    ahah
  • a

    ambitious-knife-25690

    02/27/2023, 12:23 PM
    folders are translated from
    HAXEUI_CORE__CHECK_BLUE
    to
    haxeui-core/check-blue
    when in a directory
    /root/assets/haxeui-core/check-blue.png
  • a

    ambitious-knife-25690

    02/27/2023, 12:24 PM
    that's relatively intuitive
1...808182...124Latest