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

is there any samples ? #2

Open
sonygod opened this issue Mar 17, 2020 · 14 comments
Open

is there any samples ? #2

sonygod opened this issue Mar 17, 2020 · 14 comments

Comments

@sonygod
Copy link

sonygod commented Mar 17, 2020

are there any samples?

how to use haxeui with heaps?

@ianharrigan
Copy link
Member

As fair as i know development has stalled on haxeui-heaps, and honestly, im not 100% what state its in as ive never used it. Eventually it would be nice to breathe some life into the project, but at this stage i honestly just dont know. @aW4KeNiNG - do you have a moment? Is haxeui-heaps in a usable state? I forget how it left off. :)

@BrodyB
Copy link

BrodyB commented Aug 29, 2020

Chiming in here as I'm stumbling into Heaps dev and would also really like to use HaxeUI. Any samples or examples of how to setup the project to use this would be really helpful!

@ianharrigan
Copy link
Member

Funnily enough im actually writing docs at the moment, not on heaps specifically, but on all the backends - so that includes heaps.

For now though is there something you are having issues with? You should just be able to do:

Toolkit.init();
var b = new Button();
b.text = "Test";
Screen.instance.addComponent(b);

That should be all you need, if that doesnt work then let me know as there might be some additional steps (i cant remember them off hand though)

Cheers,
Ian

@BrodyB
Copy link

BrodyB commented Sep 1, 2020

Thanks for the help!

I'm a bit new to Haxe development, in general, so I'm also not sure what the best practice is for incorporating this repo's contents into my project structure. Should that be handled through haxelib?

@ianharrigan
Copy link
Member

Yeah, haxelib is the usual method, though there are other ways... you can install the official versions with:

haxelib install haxeui-core
haxelib install haxeui-heaps

or the development versions with:

haxelib git haxeui-core https://github.com/haxeui/haxeui-core
haxelib git haxeui-heaps https://github.com/haxeui/haxeui-heaps

The development versions will likely have more fixes, but may also create regresssions, but you can flip between the two with ease.

Then in your .hxml file (im assuming you are building using .hxml?) you can add these lines:

-lib haxeui-core
-lib haxeui-heaps

And that should be it... if you run into any troubles, let me know.

Cheers,
Ian

@BrodyB
Copy link

BrodyB commented Sep 2, 2020

This is really helpful, thank you!!

@FlashTang
Copy link

FlashTang commented Mar 11, 2021

Hi @ianharrigan
I get error after import haxe.ui.Toolkit;

/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/Res.hx:4: characters 1-8 : Warning : Resource directory not found in classpath 'res' (use -D resourcesPath=DIR)
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/Res.hx:4: characters 1-8 : Uncaught exception __invalid: No such file or directory
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:96: characters 13-46 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:64: characters 4-20 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:264: characters 18-24 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:375: characters 10-41 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/Res.hx:4: characters 1-8 : Called from here
The terminal process "haxe '--connect', '6000', 'compile.hxml'" terminated with exit code: 1.

P.S. if don't import , no above error

After I add -D resourcesPath=DIR compile.hxml
error:

/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/Res.hx:4: characters 1-8 : Uncaught exception Failure("get_full_path")
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:47: characters 15-43 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:30: characters 16-33 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/res/FileTree.hx:375: characters 10-27 : Called from here
/usr/local/lib/haxe/lib/heaps/1,9,1/hxd/Res.hx:4: characters 1-8 : Called from here
The terminal process "haxe '--connect', '6000', 'compile.hxml'" terminated with exit code: 1.

@ianharrigan
Copy link
Member

So, i think you need to create a "res" folder in your project root... something like that, and when you say -D resourcesPath=DIR the DIR should point to an actual directory (ie, not actually "DIR" - unless you create a "DIR" directory ofc)

@FlashTang
Copy link

FlashTang commented Mar 12, 2021

So, i think you need to create a "res" folder in your project root... something like that, and when you say -D resourcesPath=DIR the DIR should point to an actual directory (ie, not actually "DIR" - unless you create a "DIR" directory ofc)

@ianharrigan
Thanks ,I added -D resourcesPath=mySrc, and created a new folder mySrc in the root of the project
Now the second error in prev post is gone
But it comes with new error :

/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:22: lines 22-26 : { width : Dynamic, height : Dynamic, data : hxd.BitmapData } should be hxd.res.ImageInfo
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:15: characters 31-47 : Field getImageInternal overrides parent class with different or incomplete type
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/backend/AssetsBase.hx:16: characters 22-38 : Base field is defined here
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:10: lines 10-79 : Defined in this class
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:15: characters 31-47 : error: hxd.res.ImageInfo -> Void should be haxe.ui.assets.ImageInfo -> Void
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:15: characters 31-47 :  have: (..., ... -> ...) -> ...
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:15: characters 31-47 :  want: (..., ... -> ...) -> ...
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:57: lines 57-61 : { width : Dynamic, height : Dynamic, data : hxd.BitmapData } should be hxd.res.ImageInfo
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:47: characters 30-44 : Field imageFromBytes overrides parent class with different or incomplete type
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/backend/AssetsBase.hx:24: characters 21-35 : Base field is defined here
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:10: lines 10-79 : Defined in this class
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:47: characters 30-44 : error: hxd.res.ImageInfo -> Void should be haxe.ui.assets.ImageInfo -> Void
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:47: characters 30-44 :  have: (..., ... -> ...) -> ...
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:47: characters 30-44 :  want: (..., ... -> ...) -> ...
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:40: characters 31-55 : Field getImageFromHaxeResource overrides parent class with different or incomplete type
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/backend/AssetsBase.hx:20: characters 22-46 : Base field is defined here
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:10: lines 10-79 : Defined in this class
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:40: characters 31-55 : error: (String, hxd.res.ImageInfo) -> Void should be (String, haxe.ui.assets.ImageInfo) -> Void
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:40: characters 31-55 :  have: (..., (..., ...) -> ...) -> ...
/usr/local/lib/haxe/lib/haxeui-heaps/1,3,1/haxe/ui/backend/AssetsImpl.hx:40: characters 31-55 :  want: (..., (..., ...) -> ...) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:92: characters 69-83 : error: hxd.res.ImageInfo has no field data
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:92: characters 69-83 :  have: (..., haxe.ui.assets.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:92: characters 69-83 :  want: (..., hxd.res.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:92: characters 69-83 : For function argument 'callback'
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:94: characters 62-76 : error: hxd.res.ImageInfo has no field data
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:94: characters 62-76 :  have: (..., haxe.ui.assets.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:94: characters 62-76 :  want: (..., hxd.res.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:94: characters 62-76 : For function argument 'callback'
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:86: lines 86-99 : error: hxd.res.ImageInfo has no field data
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:86: lines 86-99 :  have: (haxe.ui.assets.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:86: lines 86-99 :  want: (hxd.res.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/ToolkitAssets.hx:86: lines 86-99 : For function argument 'callback'
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:104: characters 65-73 : error: hxd.res.ImageInfo has no field data
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:104: characters 65-73 :  have: (haxe.ui.assets.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:104: characters 65-73 :  want: (hxd.res.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:104: characters 65-73 : For function argument 'callback'
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:123: characters 75-83 : error: hxd.res.ImageInfo has no field data
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:123: characters 75-83 :  have: (haxe.ui.assets.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:123: characters 75-83 :  want: (hxd.res.ImageInfo) -> ...
/usr/local/lib/haxe/lib/haxeui-core/1,2,3/haxe/ui/util/ImageLoader.hx:123: characters 75-83 : For function argument 'callback'
The terminal process "haxe '--connect', '6000', 'compile.hxml'" terminated with exit code: 1.

Again if don't import haxe.ui.Toolkit; no above error
P.S. Haxe 4.1.4 , hashlink 1.12.0 (github master) , heaps 1.9.1 ,haxeui-core 1.2.3 ,haxeui-heaps 1.3.1
Here is the compile.hxml :

-cp src
-lib haxeui-core
-lib haxeui-heaps
-lib heaps
-lib hlsdl
-D resourcesPath=mySrc
-hl main.hl
-main Main
-debug

@ianharrigan
Copy link
Member

I think that maybe your heaps is out of date, ive been told to always use the git version. But not sure if that is the error to be honest. Can you try out git heaps and see?

@FlashTang
Copy link

I think that maybe your heaps is out of date, ive been told to always use the git version. But not sure if that is the error to be honest. Can you try out git heaps and see?

I think maybe haxeui-heaps is out of date (instead of heaps)
After I install git version of haxeui-heaps , it works now

Toolkit.init({root: s2d,manualUpdate: false});
Screen.instance.addComponent(new Button()).text = "Test";

Thanks for your help, really appreciated !

@ianharrigan
Copy link
Member

ah, right... cool... other way round then :)

Weird though, i thought i made a haxelib release with all the latest changes, ill have to double check. Thanks!

@robinp
Copy link

robinp commented Jun 21, 2022

A data point:

Haxe 4.2.1  (Linux / nix)
haxeui-core: [1.4.0]
haxeui-heaps: [1.4.0]
heaps: [git]

This makes the -js target work. And with some patching for nix, -hl out/main.hl + hl out/main.hl also works (see NixOS/nixpkgs#168289 for nixy details)

@ianharrigan
Copy link
Member

You almost certainly want to be using git version of haxeui-core and haxeui-heaps - the haxelib versions have yet again managed to get woefully out of date - i going to rerelease soon (tm) and also see if i can work out a way to release more often (ie, start actually using minor versions again, 1.4.6, etc)

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

5 participants