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

    bright-gpu-74537

    05/01/2019, 9:13 PM
    ie, master compiles? What version of haxe?
  • m

    miniature-summer-93860

    05/01/2019, 10:31 PM
    Yes master compiles and 4.0 2nd version stable
  • b

    bright-gpu-74537

    05/01/2019, 10:46 PM
    im lost.
  • b

    bright-gpu-74537

    05/01/2019, 10:46 PM
    it does compile, or it doesnt?
  • m

    miniature-summer-93860

    05/02/2019, 1:15 AM
    It does on master.
  • m

    miniature-summer-93860

    05/02/2019, 1:15 AM
    Not on the new branch.
  • b

    bright-gpu-74537

    05/02/2019, 8:03 AM
    do you have an error / stack? What version of haxe?
  • f

    fancy-city-440

    05/02/2019, 7:12 PM
    so if I want to have a button by graphics i need to use icon and clear the background color?
  • b

    bright-gpu-74537

    05/03/2019, 6:16 AM
    It would probably make more sense to
    background-image
    css property
  • b

    bright-gpu-74537

    05/03/2019, 6:17 AM
    you can also clip, and slice-9
  • b

    bright-gpu-74537

    05/03/2019, 6:17 AM
    Copy code
    css
    #bitmapButton {
        background-image: "demo/button.png";
        background-image-clip: 0px 0px 40px 94px;
        background-image-slice: 10px 10px 30px 84px;
        border: none;
        background-color: white;
        color: #666666;
        padding-top: 10px;
        padding-left: 15px;
        padding-right: 15px;
        padding-bottom: 10px;
    }
    
    #bitmapButton .label {
        margin-top: -1px;
    }
    
    #bitmapButton:hover {
        background-image: "demo/button.png";
        background-image-clip: 0px 95px 40px 189px;
        background-image-slice: 10px 10px 30px 84px;
        border: none;
        background-color: white;
        color: #FFFFFF;
    }
    
    #bitmapButton:down {
        background-image: "demo/button.png";
        background-image-clip: 0px 190px 40px 284px;
        background-image-slice: 10px 10px 30px 84px;
        border: none;
        background-color: white;
        color: #FCFCFC;
    }
  • b

    bright-gpu-74537

    05/03/2019, 6:32 AM
    ^^ thats the image used in the css above btw
  • f

    fancy-city-440

    05/03/2019, 12:43 PM
    I was trying through code, all I found was background color
  • f

    fancy-city-440

    05/03/2019, 12:44 PM
    but thanks ill keep the css in mind then
  • f

    fancy-city-440

    05/03/2019, 12:47 PM
    also does haxe-ui do anything for optimizations when drawn on the gpu? For example switching image with every g2 call pretty much a drag
  • b

    bright-gpu-74537

    05/03/2019, 1:21 PM
    yeah, its pretty unoptimised for kha i think... im open to suggestions though
  • f

    fancy-city-440

    05/03/2019, 3:53 PM
    all i can think of is building a runtime texture atlas as you keep loading images
  • f

    fancy-city-440

    05/03/2019, 3:53 PM
    but i have little experience in optimizing ui stuff
  • b

    bright-gpu-74537

    05/04/2019, 8:17 AM
    Images should be cached, but ill take a look at the texture atlas stuff too... dont suppose you have a pointers for that in kha do you?
  • f

    fancy-city-440

    05/04/2019, 12:30 PM
    Oh texture atlas is just an image with sub images. you can use g2.drawSubImage to draw a specific region of a texture
  • f

    fancy-city-440

    05/04/2019, 12:36 PM
    Images are clearly uploaded to the gpu otherwise you can't draw them. g2 however works best if you don't change shader or texture so that the vertex buffer gets filled plenty before uploading it to the gpu, so things can be drawn in one go. But with UI stuff that's a bit more complex as you can't always gaurantee draw order based on states anyways.
  • f

    fancy-city-440

    05/04/2019, 12:37 PM
    I'm sure that you're using a mix of
    fillRectangle
    and
    drawImage
    so states are frequently swapped.
  • f

    fancy-city-440

    05/04/2019, 12:38 PM
    I guess it's also far less of a problem with simple UI stuff, but something that's more graphically heavy should definitely be benchmarked.
  • f

    fancy-city-440

    05/04/2019, 12:41 PM
    to be clear I don't know if your current implementation poses a problem, gpus are fairly powerful nowadays even lower end mobile gpus. It's just something I notice in terms of how assets are used.
  • b

    brave-kangaroo-30399

    05/04/2019, 2:15 PM
    @bright-gpu-74537 I do this in the flixel backend
  • b

    brave-kangaroo-30399

    05/04/2019, 2:15 PM
    Not sure if it’ll help to look at it wrt kha but maybe
  • b

    bright-gpu-74537

    05/04/2019, 2:18 PM
    ok, nice... ill take a look
  • b

    bright-gpu-74537

    05/04/2019, 2:18 PM
    👍
  • b

    brave-kangaroo-30399

    05/04/2019, 2:21 PM
    It’s the optional spritesheet param, and I use it as an image source
  • f

    fancy-city-440

    05/04/2019, 2:23 PM
    It would basically comes down to > load asset > render to rendertarget ( the sprite atlas) keep track of rectangle data. And then you likely want to unload the original image.
1...202122...1687Latest