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

    bright-gpu-74537

    02/07/2023, 11:11 PM
    works if you use a vbox instead of a box
  • b

    bright-gpu-74537

    02/07/2023, 11:12 PM
    which doesnt make alot of sense to be, but ill check it out tomorrow
  • i

    icy-zebra-52882

    02/07/2023, 11:13 PM
    works with vbox here, that's fine by me
  • i

    icy-zebra-52882

    02/07/2023, 11:13 PM
    👏
  • b

    bright-gpu-74537

    02/07/2023, 11:13 PM
    cool - ill find out whats going on tomorrow - shouldnt be any difference between those components (from a measurement perspective) so something is off
  • i

    icy-zebra-52882

    02/07/2023, 11:14 PM
    you're a trooper
  • b

    bright-gpu-74537

    02/08/2023, 8:21 AM
    ok, this is fixed now, a weird fix, but a fix
  • b

    bumpy-engineer-49082

    02/08/2023, 8:38 AM
    Copy code
    public function render(framebuffers:Array<Framebuffer>):Void {
            _backgroudColor = ColorUtil.parseColor(Toolkit.backendProperties.getProp("haxe.ui.kha.background.color", "0xFFFFFF"));
            var g = framebuffers[0].g2;
            g.begin(true, _backgroudColor);
            Screen.instance.renderTo(g);
            g.end();
        }
  • b

    bumpy-engineer-49082

    02/08/2023, 8:40 AM
    As i see, it should have given me white background.
  • b

    bright-gpu-74537

    02/08/2023, 8:41 AM
    can you paste the full code? Or are you using HaxeUIApp now? Either way - can you post your entire Main.hx again? @bumpy-engineer-49082
  • b

    bumpy-engineer-49082

    02/08/2023, 8:42 AM
    Copy code
    package;
    
    import haxe.ui.HaxeUIApp;
    import haxe.ui.Toolkit;
    import haxe.ui.components.Button;
    import haxe.ui.containers.dialogs.Dialog;
    import haxe.ui.core.Component;
    import haxe.ui.core.Screen;
    import haxe.ui.macros.ComponentMacros;
    import haxe.ui.themes.Theme;
    import haxe.ui.util.ColorUtil;
    import kha.Assets;
    import kha.Assets;
    import kha.Color;
    import kha.Framebuffer;
    import kha.Framebuffer;
    import kha.Scheduler;
    
    import kha.System;
    
    class Main {
        private var _callback:Void->Void;
        private var _backgroudColor:Int = 0;
    
        static function update():Void {}
    
        public function render(framebuffers:Array<Framebuffer>):Void {
            _backgroudColor = ColorUtil.parseColor(Toolkit.backendProperties.getProp("haxe.ui.kha.background.color", "0xFFFFFF"));
            var g = framebuffers[0].g2;
            g.begin(true, _backgroudColor);
            Screen.instance.renderTo(g);
            g.end();
        }
    
        public static function main() {
            kha.System.start({}, function(_) {
                kha.Assets.loadEverything(function() {
                    haxe.ui.Toolkit.init();
    
                    final screen = haxe.ui.core.Screen.instance;
                    final ui = haxe.ui.ComponentBuilder.fromFile("main-view.xml");
    
                    screen.addComponent(ui);
                    System.start({title: "Project", width: 1024, height: 768}, function(_) {
                        // Just loading everything is ok for small projects
                        Assets.loadEverything(function() {
                            // Avoid passing update/render directly,
                            // so replacing them via code injection works
                            Scheduler.addTimeTask(function() {
                                update();
                            }, 0, 1 / 60);
                            System.notifyOnFrames(function(frames) {});
                        });
                    });
                });
            });
        }
    }
  • b

    bumpy-engineer-49082

    02/08/2023, 8:42 AM
    Oh, i deleted render()
  • b

    bright-gpu-74537

    02/08/2023, 8:42 AM
    you still arent calling render... (which should also be static)
  • b

    bright-gpu-74537

    02/08/2023, 8:43 AM
    System.notifyOnFrames(function(frames) {});
    is just calling an empty function
  • b

    bright-gpu-74537

    02/08/2023, 8:43 AM
    change
    public function render(framebuffers:Array<Framebuffer>):Void {
    to
    public static function render(framebuffers:Array<Framebuffer>):Void {
  • b

    bright-gpu-74537

    02/08/2023, 8:44 AM
    and change
    System.notifyOnFrames(function(frames) {});
    to
    System.notifyOnFrames(render);
  • p

    powerful-morning-89

    02/08/2023, 8:44 AM
    Also, Kha uses ARGB colors, so
    0xFFFFFF
    is white, but with
    alpha = 0
    . That probably won't give the results you expect.
  • b

    bright-gpu-74537

    02/08/2023, 8:45 AM
    valid point, thats copied from AppImpl in haxeui-kha, so probably a bug there... but still, their main issue here is that
    render
    is never being called (and its not static)
  • b

    bumpy-engineer-49082

    02/08/2023, 8:49 AM
    Cannot access _backgroudColor in static function
  • b

    bright-gpu-74537

    02/08/2023, 8:49 AM
    well, make the var static too...
  • b

    bright-gpu-74537

    02/08/2023, 8:50 AM
    you might have some pretty general programming issues with haxe / haxeui / kha if you arent sure what the difference is between static and non-static (just a heads up 🙂 )
  • b

    bright-gpu-74537

    02/08/2023, 8:51 AM
    this is Java, but the same principle applies to Haxe: https://beginnersbook.com/2013/05/static-vs-non-static-methods/
  • b

    bright-gpu-74537

    02/08/2023, 8:52 AM
    (there are probably better resources too)
  • p

    powerful-morning-89

    02/08/2023, 8:52 AM
    Reject classes, embrace functional programming, no more static :)
  • b

    bumpy-engineer-49082

    02/08/2023, 8:53 AM
    I guessed, if it works in appiml, it should work elsewhere.
  • b

    bright-gpu-74537

    02/08/2023, 8:54 AM
    well, appimpl is supposed to be instanced, its not a static class
  • e

    early-butcher-76809

    02/08/2023, 12:59 PM
    Hi again, @bright-gpu-74537 <3 My issue with the background opacity is with buttons (I got the git versions of both heaps and core). This doesn't work in Heaps (although it does within the online builder) :
    Copy code
    <vbox id="vbox">
        <style>
            .btnStyle {
                background-opacity: 0;
                border-opacity: 0;
            }
        </style>
        <button id="act0" styleName="btnStyle" />
    </vbox>
    In StyleHelper.hx (l 47), this test is true, although I haven't touched this properties (probably set and different from each other by default) :
    Copy code
    if (style.backgroundColorEnd != null && style.backgroundColor != style.backgroundColorEnd)
    The use of opacity is in the else of that previous test, thus it's never called :( Is it intended ?
  • b

    bright-gpu-74537

    02/08/2023, 1:01 PM
    certain feels like a bug - lemme check this end
  • b

    bright-gpu-74537

    02/08/2023, 1:03 PM
    yup, you are right
  • b

    bright-gpu-74537

    02/08/2023, 1:04 PM
    certainly not intentional
1...147914801481...1687Latest