Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kha color "leaks" into theme #3

Open
anissen opened this issue Oct 22, 2021 · 4 comments
Open

Kha color "leaks" into theme #3

anissen opened this issue Oct 22, 2021 · 4 comments

Comments

@anissen
Copy link

anissen commented Oct 22, 2021

Changing the color of the kha.graphics2.Graphics-object affects the colors in this theme.

For instance:

g2.color = kha.Color.White;
screen.renderTo(g2);

image

And:

g2.color = kha.Color.Green;
screen.renderTo(g2);

image

@ianharrigan
Copy link
Member

Huh, thats interesting - do you have full test app to play with? (just we are on the exact same page)

@anissen
Copy link
Author

anissen commented Oct 23, 2021

Sure, I'll make a minimal project that reproduces this issue!

@anissen
Copy link
Author

anissen commented Oct 24, 2021

Here's a minimal project setup to reproduce this issue:

Main.hx

package;

import kha.Assets;
import kha.Framebuffer;
import kha.System;

class Main {
    public static function main() {
        System.start({title: "HaxeUI issue", width: 800, height: 600}, function (_) {
            Assets.loadEverything(function () {
                haxe.ui.Toolkit.theme = "kenney";
                haxe.ui.Toolkit.init({ showFPS: true });

                final screen = haxe.ui.core.Screen.instance;
                final ui = haxe.ui.macros.ComponentMacros.buildComponent("ui.xml");
                screen.addComponent(ui);

                function render(frames: Array<Framebuffer>) {
                    var g2 = frames[0].g2;
                    g2.begin(true, kha.Color.White);

                    g2.color = kha.Color.Yellow;
                    screen.renderTo(g2);

                    g2.end();
                }

                System.notifyOnFrames(function (frames) { render(frames); });
            });
        });
    }
}

ui.xml

<vbox width="100%" height="500">
    <frame text="Code" width="100%" height="100%">
        <vbox width="100%" height="100%">
            <textarea id="script" width="100%" height="100%" text="I am a text area 1" style="font-size: 16px; font-name: 'BrassMono';" />
            <button width="100%" text="Reload" />
        </vbox>
    </frame>
</vbox>

image

And here's the zipped files (with Kha/ and libs/{haxeui-theme-kenney,haxeui-kha,haxeui-core}/):

haxeui-issue.zip

By the way, I'm using...

  • Haxe 4.2.3
  • Kha a57f47bcca84154935de9c567451c55fb646117a
  • HaxeUI core 3f544dc4214a7718e96a441eecd666fde228e418
  • HaxeUI kha 6b1c565ad8ad6f8c79e23dee83ebcb5affa8ec0f
  • HaxeUI theme Kenney ddc4cd0

@ianharrigan
Copy link
Member

OK, that should be fixed now in latest haxeui-kha (git version).

If thats working can you close this?

Cheers,
Ian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants