https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    bright-gpu-74537

    04/25/2023, 7:17 AM
    Copy code
    haxe
            image1.getImageDisplay().subImage(0, 0, 32, 32);
            image2.getImageDisplay().subImage(32, 0, 32, 32);
            image3.getImageDisplay().subImage(0, 32, 32, 32);
            image4.getImageDisplay().subImage(32, 32, 32, 32);
    
            image5.getImageDisplay().subImage(0, 0, 32, 32);
            image6.getImageDisplay().subImage(32, 0, 32, 32);
            image7.getImageDisplay().subImage(0, 32, 32, 32);
            image8.getImageDisplay().subImage(32, 32, 32, 32);
    
            slider1.onChange = (_) -> {
                image9.getImageDisplay().subImage(slider1.pos, slider2.pos, 32, 32);
            }
            slider2.onChange = (_) -> {
                image9.getImageDisplay().subImage(slider1.pos, slider2.pos, 32, 32);
            }
  • b

    bright-gpu-74537

    04/25/2023, 7:18 AM
    i decided not to with dx,dy,dw,dh (as params) since haxeui can already do the scaling (which just translates into dx, dy, dw, dh in kha anyway)
  • b

    bright-gpu-74537

    04/25/2023, 7:19 AM
    shouldnt be, do you have a repro? What backend?
  • b

    bright-gpu-74537

    04/25/2023, 7:19 AM
    thanks for the PR 🙂
  • b

    bright-gpu-74537

    04/25/2023, 7:23 AM
    the reason i also decided to add the "tile://" image handler (specific to kha currently) is so you can do things like:
  • b

    bright-gpu-74537

    04/25/2023, 7:24 AM
    Copy code
    xml
        <listview width="200" height="150">
            <data>
                <item text="orange" icon="tile://assets/shared_image.png,0,0,32,32" />
                <item text="green" icon="tile://assets/shared_image.png,32,0,32,32" />
                <item text="dark red" icon="tile://assets/shared_image.png,0,32,32,32" />
                <item text="red" icon="tile://assets/shared_image.png,32,32,32,32" />
            </data>
        </listview>
  • b

    bright-gpu-74537

    04/25/2023, 7:24 AM

    https://cdn.discordapp.com/attachments/565569107701923852/1100321373311741952/image.png▾

  • b

    bright-gpu-74537

    04/25/2023, 7:24 AM
    ill commit after i walk el puppos 🙂
  • b

    bright-gpu-74537

    04/25/2023, 8:14 AM
    alright, @helpful-boots-41914 , all in - latest haxeui-core and haxeui-kha... be interested to see how it fares, i think there is scope to add all this to all (most) of the other composite backends - or at least something similar - i do remember a feature request for something like this in flixel... or maybe it was heaps... but yeah, tiles in all game frameworks is probably pretty useful
  • g

    gifted-whale-78169

    04/25/2023, 1:29 PM
    wdym by repro? I'm on openfl
  • b

    bright-gpu-74537

    04/25/2023, 1:30 PM
    i mean reproduction, like something i can preferably run to see the issue rather than attempting to guess and repro myself (as i may very well get it wrong)
  • e

    early-butcher-76809

    04/25/2023, 1:32 PM
    The emptiness is probably about this more than a bug : http://haxeui.org/api/guides/events.html
  • e

    early-butcher-76809

    04/25/2023, 1:33 PM
    So, sharpcdf is aking how to use keyboard events ^^
  • b

    bright-gpu-74537

    04/25/2023, 1:33 PM
    oh, i misread the message entirely... i thought it was like "keyboard events arent working"
  • g

    gifted-whale-78169

    04/25/2023, 1:34 PM
    Yea lol I got confused
  • g

    gifted-whale-78169

    04/25/2023, 1:34 PM
    Yep
  • b

    bright-gpu-74537

    04/25/2023, 1:38 PM
    something like this: http://haxeui.org/builder/?1dbd0270 ?
  • b

    bright-gpu-74537

    04/25/2023, 1:38 PM
    Copy code
    haxe
    @:build(haxe.ui.ComponentBuilder.build("assets/main-view.xml"))
    class MainView extends VBox {
        public function new() {
            super();
    
            tf1.registerEvent(KeyboardEvent.KEY_DOWN, (event:KeyboardEvent) -> {
                trace("tf1 keydown", event.keyCode);
            });
    
            Screen.instance.registerEvent(KeyboardEvent.KEY_DOWN, (event:KeyboardEvent) -> {
                trace("screen keydown", event.keyCode);
            });
        }
    
        @:bind(tf2, KeyboardEvent.KEY_DOWN)
        private function onTF2KeyDown(event:KeyboardEvent) {
                trace("tf2 keydown", event.keyCode);
        }
    }
  • g

    gifted-whale-78169

    04/25/2023, 1:40 PM
    Yes, but is there an enum or something to compare key codes to check if, say, enter was pressed
  • b

    bright-gpu-74537

    04/25/2023, 1:41 PM
    yeah:
    Platform.instance.KeyEnter
  • b

    bright-gpu-74537

    04/25/2023, 1:42 PM
    weirdly, "backend" doesnt seem to be in the api docs...
  • b

    bright-gpu-74537

    04/25/2023, 1:43 PM
    but
    Platform
    is
    haxe.ui.core.Platform
  • g

    gifted-whale-78169

    04/25/2023, 1:44 PM
    ah ok I'll try that when I get home, thanks
  • b

    bright-gpu-74537

    04/25/2023, 1:48 PM
    apologies for misunderstanding, i read it like 3 times and each time came away with ("keyboard events arent working" 🤦‍♂️ )
  • h

    helpful-boots-41914

    04/25/2023, 2:28 PM
    This looks awesome! I looked through your change, loos good. But what about the ImageData for icons? It looks like icons point to https://github.com/haxeui/haxeui-kha/blob/master/haxe/ui/backend/ImageData.hx button icon uses variant: https://github.com/haxeui/haxeui-core/blob/6a07d51f41f268c7985a102062d9a1110c77307d/haxe/ui/components/Button.hx#L124 variant uses ImageData: https://github.com/haxeui/haxeui-core/blob/6a07d51f41f268c7985a102062d9a1110c77307d/haxe/ui/util/Variant.hx#L16 If anything I can take a look later this week if you're busy.
  • h

    helpful-boots-41914

    04/25/2023, 2:47 PM
    How was walking the pups?
  • b

    bright-gpu-74537

    04/25/2023, 2:57 PM
    icons are just Images (haxeui images, not backend images)
  • b

    bright-gpu-74537

    04/25/2023, 2:58 PM
    so it should all work, as you can see by this: https://discord.com/channels/162395145352904705/565569107701923852/1100321242877272155
  • h

    helpful-boots-41914

    04/25/2023, 3:06 PM
    Oh! I must be confused then . . I tried finding
    btn.icon.getImageDisplay()
    and I don't think it existed. That's why I said what I said
  • b

    bright-gpu-74537

    04/25/2023, 3:09 PM
    so .icon takes a variant (as you have found out), then a behaviour will trigger when you set that and a number of different things can happen, it could be an image data already (native to the backend), so that would be used it could be a string (as in a resource, http url, file path, something custom) it could be a canvas
1...165016511652...1687Latest