haxeui / haxeui-heaps

MIT License
31 stars 12 forks source link

is there any samples ? #2

Open sonygod opened 4 years ago

sonygod commented 4 years ago

are there any samples?

how to use haxeui with heaps?

ianharrigan commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

This is really helpful, thank you!!

FlashTang commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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 https://github.com/NixOS/nixpkgs/pull/168289 for nixy details)

ianharrigan commented 2 years ago

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)