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

    billowy-waiter-28954

    01/29/2023, 5:37 PM
    I can't say in details as I didn't see @ambitious-knife-25690 's implementation, but there are 2 different things in Ceramic: - screen scaling, that you set up for the whole app - any visual can be transformed, including with a scale Given that haxe UI is rendered using a
    Visual
    hierarchy, you can always scale that visual if you want it to be bigger or smaller
  • a

    ambitious-knife-25690

    01/29/2023, 5:38 PM
    yes, my intention was to expose the scaling fields to the user to decide
  • a

    ambitious-knife-25690

    01/29/2023, 5:39 PM
    but i figured for most cases, people would want their setup to scale how they setup their app from the beginning
  • a

    ambitious-knife-25690

    01/29/2023, 5:39 PM
    there's other neat things on a visual that i haven't explored yet
  • a

    ambitious-knife-25690

    01/29/2023, 5:39 PM
    like bindtonativescreensize etc
  • b

    bright-gpu-74537

    01/29/2023, 5:40 PM
    im not sure thats accurate... i certainly wouldnt expect my app to scale as i resized the window
  • b

    bright-gpu-74537

    01/29/2023, 5:41 PM
    but, i guess it very much depends on the type of app
  • a

    ambitious-knife-25690

    01/29/2023, 5:41 PM
    For a general purpose app that would be the case but for a game i think they would
  • b

    billowy-waiter-28954

    01/29/2023, 5:43 PM
    There is also a scaling (used by elements immediate gui) that you can use:
    visual.bindToNativeScreenSize()
    , which will set the width and height of the visual to the native resolution of the window, and scale it accordingly
  • a

    ambitious-knife-25690

    01/29/2023, 5:43 PM
    like, in ceramic you set the default scaling setup at app entry
  • a

    ambitious-knife-25690

    01/29/2023, 5:43 PM
    so, it's completely configurable with a simple enum
  • a

    ambitious-knife-25690

    01/29/2023, 5:44 PM
    and i'll map the scaling props to component surface with getters and setters
  • a

    ambitious-knife-25690

    01/29/2023, 5:44 PM
    Ian, maybe there could be a macro for this
  • a

    ambitious-knife-25690

    01/29/2023, 5:46 PM
    Copy code
    hx
    @map(this.surface.scale) var scale(get, set):Float;
    
    /**
    generates the following
    **/
    var scale(get, set):Float;
    function get_scale() {
      return this.surface.scale;
    }
    
    function set_scale(value:Float) {
      return this.surface.scale = value;
    }
  • a

    ambitious-knife-25690

    01/29/2023, 5:46 PM
    would be useful if someone needs composition
  • a

    ambitious-knife-25690

    01/29/2023, 5:48 PM
    or maybe have the setter options in the meta i dunno
  • a

    ambitious-knife-25690

    01/29/2023, 5:49 PM
    probably not needed considering backend development aint that frequent 🤣
  • b

    bright-gpu-74537

    01/29/2023, 5:50 PM
    seems a little unneeded imo... its not hard to write the getter / setter, its more obvious also. And it would require a build macro on the componentimpl... and yeah, i doubt it would be used very often either 🙂
  • a

    ambitious-knife-25690

    01/29/2023, 5:50 PM
    just seems like it would be cause there's "suddenly" 3 backends being made at once
  • a

    ambitious-knife-25690

    01/29/2023, 5:50 PM
    nvm 🤣
  • b

    bright-gpu-74537

    01/29/2023, 8:27 PM
    update for the validator system:
  • b

    bright-gpu-74537

    01/29/2023, 8:28 PM
    im in no way say you have to use all these methods to let the user know about invalid data, but its nice you can 🙂
  • b

    bright-gpu-74537

    01/29/2023, 8:29 PM
    apart from the UI stuff (showing hiding errors, etc - which im going to try and make semi automatic), this is the code for the validators:
    Copy code
    haxe
            var v1 = new RequiredValidator();
            var v2 = new EmailValidator();
    
            textfield1.validators = [v1, v2];
            textfield2.validators = [v1, v2];
            textfield3.validators = [v2];
  • b

    bright-gpu-74537

    01/29/2023, 8:30 PM
    i also would like to be able to set this all up via xml, so will need to think about that a little
  • f

    full-journalist-82607

    01/29/2023, 9:12 PM
    hmm, I have a Error : ValueException if I do this on openfl and hxwidgets, didn't test others
    Copy code
    haxe
    var dialog = new SaveFileDialog();
                dialog.show();
  • b

    bright-gpu-74537

    01/29/2023, 9:27 PM
    "nothing to write" error?
  • f

    full-journalist-82607

    01/29/2023, 9:30 PM
    Hmm, maybe, in fact in my project, I don't plan to write anything, I plan just to have the save file path , because it's other programs that write the bytes
  • b

    bright-gpu-74537

    01/29/2023, 9:30 PM
    yeah, you shouldnt have to have something to write... i dont think
  • b

    bright-gpu-74537

    01/29/2023, 9:31 PM
    Copy code
    haxe
            if (fileInfo == null || (fileInfo.text == null && fileInfo.bytes == null)) {
                throw "Nothing to write";
            }
  • b

    bright-gpu-74537

    01/29/2023, 9:31 PM
    🤔
1...144314441445...1687Latest