Caffeine-hx and NME

61 views
Skip to first unread message

plicatibu

unread,
Aug 13, 2012, 9:59:10 AM8/13/12
to caffe...@googlegroups.com
Hi.

I'd like to know whether caffeine-hx works with all platforms supported by Haxe NME:
  1. iOS
  2. Android
  3. Flash
  4. BlackBerry Playbook
  5. HTML
  6. webOS
  7. Windows
  8. Linux
  9. Mac

Thank you.

Russell Weir

unread,
Aug 13, 2012, 11:14:45 AM8/13/12
to caffe...@googlegroups.com
Hi,

Mostly, however there is so much in it that has not been tested or
worked on in some time, so I can't be sure. Also, some things like the
cryptography library are dependent on an ndll for neko, which I have
not tested in c++. Generally speaking, I did write the code in the
most cross platform manner possible, so any changes to make things
work would likely be minor. I have not run it through haxe 2.10 yet
though, so there may be issues there as well.

Russell
> --
>
>

plicatibu

unread,
Aug 13, 2012, 2:21:45 PM8/13/12
to caffe...@googlegroups.com
I see.

Thank you a lot.

plicatibu

unread,
Aug 13, 2012, 6:09:47 PM8/13/12
to caffe...@googlegroups.com
Just one more question:

Is there any particular reason to use native code instead of develop all caffeine-he API using just Haxe code?

Regards.

Russell Weir

unread,
Aug 13, 2012, 8:03:19 PM8/13/12
to caffe...@googlegroups.com
In the case of things like BigInteger and all cryptography, the
openssl libraries and the custom ones I wrote are much faster than
anything that can be written in haxe. Even when compiled to cpp, you
will see a performance hit, since the cpp code abstracts away some of
the haxe types, which causes overhead. However, on small amounts of
use, it's acceptable, but I wouldn't write an SSL webserver in haxe
that used my haxe versions of the SSL. That being said, it's still
possible to compile all the classes using the pure haxe versions, and
not use the ndlls, since the focus of my work in caffeine-hx was pure
cross platform compatibility (though I started dropping flash <= 8
support lately)

R
> --
>
>

plicatibu

unread,
Aug 14, 2012, 10:40:19 AM8/14/12
to caffe...@googlegroups.com

I want to gather some data from mobiles running my games to let me know my audience (platform, country, which screens on my games user saw, and so on).

My idea is to cipher these data prior to send them to my site, so I don't need a big performance.

How could I compile it to use pure haxe version? I'd like to give it a try.

Regards.

Russell Weir

unread,
Aug 14, 2012, 12:51:33 PM8/14/12
to caffe...@googlegroups.com
Generally speaking, if you are not using neko, there are compiler -D
flags for using the ndll version

If you take a look at XXTea.hx
http://code.google.com/p/caffeine-hx/source/browse/trunk/ext3/chx/crypt/symmetric/XXTea.hx
you will see that #if (neko || useNCrypt) surrounds most of the code
that will call ndlls, so unles you are on neko, without setting any
flags, you will get the native code version.

R
> --
>
>

Marcio Andrey Oliveira

unread,
Aug 14, 2012, 2:56:13 PM8/14/12
to caffe...@googlegroups.com
Thank you for replaying.

It seems my English is worst than my programming skills :)

I'm planning to generate a code using haxe nme without any native code as dependency. In other words, just Haxe syntax in the library.

I think I'm not explaining very well (again, sorry about my bad English) so I'll try to illustrate it with a sample.

If I write the code

var logo:Sprite();
logo = new Sprite();

I can send only it to anyone that has haxe NME and it will work on all platforms supported by Haxe NME. There is no need to send any dll / lib.

At compile time Haxe NME will convert it to the target platforms in a transparent way for me and I'm sure it will work on all platforms.

I wish to do the same with caffeine-hx. I don't want any dll / library dependency.

I succeeded compiling the library on Linux Ubuntu  12.04 using default Makefile.linux as you can see here (after renaming i686-pc-linux-gnu-gcc to gcc because i got command not found error).
This version generated dlls.

As far as I understood I should not compile with -neko flag in order to generate a pure haxe library, ok?

The Makefile.linux is to build the NDLLs for the target platforms.

As don't want to generate / use them, so can I just add the caffeine code to a Haxe NME project and use it?

In this case, what would I need to successfully compile it with my project?

I mean, the nmml file should be configured in which way?

And which classes should I include?

Could you give me a short source sample? 

Thank you.






2012/8/14 Russell Weir <damon...@gmail.com>
--





--
Play free on-line games

Get free games for





Russell Weir

unread,
Aug 14, 2012, 3:07:40 PM8/14/12
to caffe...@googlegroups.com
You are correct, there is no need to build the ndlls, and if you are using NME, then you are compiling to c++, so there's no need for the ndlls, and caffeine-hx will use pure haxe code.

I don't have any samples with me right at this moment... seems I did not put them into cvs when I changed the classes, so I will update that when I get home (about 4.5 hours from now)

R

--
 
 

plicatibu

unread,
Aug 18, 2012, 8:02:31 PM8/18/12
to caffe...@googlegroups.com
Russel,

I tried to figure out which files I need to use with my NME project in order to have AES128 and AES256.

At first I thought I simple search by AES would give me the directory.

The point is that there are many directories that contains AES.hx:

caffeine-hx-read-only\ext\crypt\Aes.hx]
caffeine-hx-read-only\ext2\chx\crypt\Aes.hx
caffeine-hx-read-only\ext3\chx\crypt\symmetric\Aes.hx

So I got confused.

Could you please tell me what do I need to import into my NME project?

Best regards.

Russell Weir

unread,
Aug 19, 2012, 12:45:08 AM8/19/12
to caffe...@googlegroups.com
Sorry, not clear. The extX has been for the different versions of
Haxe, so the most current is ext3, and there are files like
Tests/crypt/src/IVModeTest.hx in there that should demonstrate how to
work with crypt.

R
> --
>
>
Reply all
Reply to author
Forward
0 new messages