[ 176 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: Getting started with Haxe NME, a cross-platform framework
PostPosted: Fri Aug 20, 2010 11:46 pm 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Hi!

You probably have not heard of Haxe or NME, but they are both very cool.

Haxe is a "multi-platform language," similar to ECMAscript languages like Javascript and Actionscript. The Haxe compiler can actually take your code and turn it *into* other languages. Code written in Haxe can become Javascript, Actionscript, C++ and even PHP. This probably seems a little confusing, but it is much easier to understand in the context of NME, a framework I have personally used to produce games for webOS and Facebook.

NME is a cross-platform library which uses a "Flash-like API," so if you are familiar with flash.display.Sprite and friends, most of them are implemented. Even if you are not familiar with Flash's API (or do not care to learn), trust me, it is easy-to-use and makes a lot of sense when you start writing games.

NME currently supports "targets" like webOS, iOS, Android, Windows, Mac, Linux and Flash. You can write platform-agnostic code that compiles as native C++ (using SDL, OpenGL or OpenGL ES, etc) for mobile targets like webOS, iOS and Android, or desktop targets like Windows, Mac and Linux. Your code can also compile for the web, running your same game or application in Flash.

There is also a project called "jeash" which maps the Flash API to HTML5 canvas, so theoretically your same application could also publish to canvas. This is something I have not played with as extensively, as Flash performs faster and translates more transparently from C++, but its out there and people use it!

There were older instructions on this thread that I am overwriting, since the process has changed (and gotten better). If you would like more information for getting started with Haxe NME, you can visit a personal blog post about it, here:

http://www.joshuagranick.com/blog/2011/ ... made-easy/

As a developer, find a method that works for you, and allows you to express yourself creatively. There are many good choices for writing a new application, using C/C++, Airplay, NME, ShiVa 3D and more. Using Haxe and NME together has been a solution has felt very comfortable for me. If this is a benefit for you, or may be a benefit for you, I encourage you to look into it, ask me questions, try it out, or contribute if you want! It is an open-source, MIT-licensed project. I don't want to sound as if I am saying that Haxe NME is better than C++ ... use the tools that allow YOU to do what you want with the platform.

(This was rewritten July 29th, 2011, so the comments that follow may not make complete sense, since they point to the previous instructions. Comments that appear later in the thread relate to these instructions)


UPDATE: There is a new website for NME which includes more information, tutorial and examples from the framework. There are also forums which may be helpful if you have any questions. The website is located at http://www.haxenme.org.

Happy coding!

_________________
Joshua Granick
Developer Relations


Last edited by singmajesty on Fri Sep 10, 2010 6:49 pm, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 12:32 am 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
OK I followed the 2.06 info here and here is what I get now, seems everything goes smooth
installing seems to be good when I make a new project I named myhaxe, uncheck the encoding on appinfo etc then build and I get the following

Running process: C:\Program Files\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\Documents and Settings\Administrator\My Documents\myhaxe\myhaxe.hxproj" -ipc 6fcbe3e5-b49f-49f9-98bc-847d57d31590 -compiler "C:\Program Files\Motion-Twin\haxe" -library "C:\Program Files\FlashDevelop\Library"
Building myhaxe
haxe -cp "C:\Documents and Settings\Administrator\My Documents\myhaxe\Source" -swf9 "C:/Documents and Settings/Administrator/My Documents/myhaxe/Export/myhaxe.swf" -swf-header 320:480:30:FFFFFF -debug myhaxe -main .myhaxe
Error : Invalid class name myhaxe
Build halted with errors (haxe.exe).
Done(1)


as CPP project it's pretty much the same message

Running process: C:\Program Files\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\Documents and Settings\Administrator\My Documents\myhaxe\myhaxe (CPP).hxproj" -ipc 6fcbe3e5-b49f-49f9-98bc-847d57d31590 -compiler "C:\Program Files\Motion-Twin\haxe" -library "C:\Program Files\FlashDevelop\Library"
Building myhaxe (CPP)
haxe -cp "C:\Documents and Settings\Administrator\My Documents\myhaxe\Source" -lib nme -cpp obj -debug -D webos myhaxe -main .myhaxe --remap flash:nme
Error : Invalid class name myhaxe
Build halted with errors (haxe.exe).
Done(1)

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 12:34 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
It looks like you configured your classpath wrong. You can try and fix the path to your "main" file by going to Project > Properties.

Otherwise, you can also try to create a new project, and name the package something like "com.myapps.myapp", and name the project "My App"

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 12:58 am 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
OK clearly I just misunderstood the Namespace Vs Name portions of the new project :-)
Where it says Name: call it like My App
where it says package is where the namespace goes so com.watchmefreak.mytestapp

That worked ok to compile and run the flash(swf) version but I get a new error when trying to build the cpp version

C:\Documents and Settings\Administrator\My Documents\Test\Source/com/watchmefreak/test/Test.hx:10: characters 0-28 : Class not found : flash.display.Sprite


Running process: C:\Program Files\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\Documents and Settings\Administrator\My Documents\Test\Test (CPP).hxproj" -ipc 29c8befd-4097-4e9f-830f-f642f96be243 -compiler "C:\Program Files\Motion-Twin\haxe" -library "C:\Program Files\FlashDevelop\Library"
Building Test (CPP)
haxe -cp "C:\Documents and Settings\Administrator\My Documents\Test\Source" -lib nme -cpp obj -debug -D webos -main com.watchmefreak.test.Test --remap flash:nme
C:\Documents and Settings\Administrator\My Documents\Test\Source/com/watchmefreak/test/Test.hx:10: characters 0-28 : Class not found : flash.display.Sprite
Build halted with errors (haxe.exe).
Done(1)

All-in-all it seems I am closer :-)

any Ideas on this one? something to do with --remap flash:nme ???

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 1:20 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Huh. Maybe "-lib nme" isn't working quite right.

Try going to Tools > Global Classpaths and adding the path to your nekonme folder (from the hxcpp-webos repository)

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 1:33 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Hello,

Thank you for your tutorial.

I'm unable to run the MyApp.swf file.

Error: "Method not found: 'Boolean.System.Threading.WaitHandle.WaitOne(Int32)'."

I don't know what is wrong...

Thank you.


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 1:41 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Hi kunkurus,

It sounds like haXe is trying to compile your application for Windows, instead of webOS. Are you using the FlashDevelop project template, or are you setting it up yourself? Make sure that -Dwebos (or -D webos ... I forgot if it requires a space) is a part of your compiler parameters.

You can also make sure that haXe, the PDK and the Sourcery G++ compiler are all available by testing these commands from a command line:

haxe
palm-install
arm-none-linux-gnueabi-g++

I might be wrong, though, and the problem might not be related to compiling for Windows instead of webOS. If you haven't already, please try to install FlashDevelop and use the project templates I've provided. That may be the easiest way to get started. Otherwise, let me know what OS and version you're using, and all the things you've set up so far.

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 1:57 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Hello Singmajesty,

I followed your tutorial, so I used the FlashDevelop project template.

I compiled the project and in the "Export" folder I have: appinfo.json, MyApp.swf, nekoapi.so, nme.so, regexp.so, std.so.

For the "arm-none-linux-gnueabi-g++" command I get: "not recognized as an internal or external command, operable program or batch file."

I guess that the Sourcery G++ compiler is not available.

I am on Windows XP
Palm webOS SDK Version 1.4.5
Palm webOS SDK Build 465
FlashDevelop Version 3.2.2

Output:

'arm-none-linux-gnueabi-g++' is not recognized as an internal or external command,
operable program or batch file.
Called from ? line 1
Called from BuildTool.hx line 899
Called from BuildTool.hx line 451
Called from BuildTool.hx line 475
Called from BuildTool.hx line 548
Called from BuildTool.hx line 581
Called from BuildTool.hx line 181
Uncaught exception - Error : 1 - build cancelled
Error : Build failed
Build halted with errors (haxe.exe).



Thank you.


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 3:13 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Sorry kunkurus,

I adapted this tutorial from the post I made previously. I didn't realize that I didn't mention G++ in my old tutorial.

I've updated the description to include the details. Palm's documentation for getting started with the PDK mentions the Code Sourcery G++ Lite for ARM GNU/Linux Toolchain. I'm sorry I failed to mention it here!

It's a little hard to find on their site, but here's a more direct link to where you can download it:

http://www.codesourcery.com/sgpp/lite/a ... elease1293

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 3:14 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Hello Singmajesty,

I corrected the problem with Sourcery G++ compiler but now I'm running into this exception:

Output:

Building MyApp (CPP)
haxe -cp D:\dev\repo\hxcpp-webos\nekonme -cp D:\dev\proj\palm_pdk\MyApp\Source -lib nme -cpp obj -debug -D webos -main com.myapps.myapp.MyApp --remap flash:nme
haxelib run hxcpp Build.xml haxe -Ddebug -Dcpp -Ddebug -Dhaxe_206 -Dnme -Dtrue -Dwebos
arm-none-linux-gnueabi-g++ -c -g -ID:\dev\repo\hxcpp-webos\hxcpp//include -IC:\Program Files\Palm\PDK/include -DHXCPP_DEBUG -DWEBOS -fvisibility=hidden -fdollars-in-identifiers -Iinclude -frtti ./src/com/myapps/myapp/MyApp.cpp -o./obj/Debug/src/com/myapps/myapp/MyApp.o
arm-none-linux-gnueabi-g++ -c -g -ID:\dev\repo\hxcpp-webos\hxcpp//include -IC:\Program Files\Palm\PDK/include -DHXCPP_DEBUG -DWEBOS -fvisibility=hidden -fdollars-in-identifiers -Iinclude -frtti ./src/__boot__.cpp -o./obj/Debug/src/__boot__.o
arm-none-linux-gnueabi-g++ -oMyApp-debug -g -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -DWEBOS -rdynamic -LC:\Program Files\Palm\PDK/device/lib -Wl,--allow-shlib-undefined -lSDL -lSDL_image -lGLES_CM -lpdl ./obj/Debug/src/nme/display/JointStyle.o ./obj/Debug/src/nme/geom/Matrix.o ./obj/Debug/src/haxe/io/Bytes.o ./obj/Debug/src/nme/display/GradientType.o ./obj/Debug/src/nme/display/TriangleCulling.o ./obj/Debug/src/nme/media/SoundTransform.o ./obj/Debug/src/com/myapps/myapp/MyApp.o ./obj/Debug/src/haxe/io/Error.o ./obj/Debug/src/nme/geom/Rectangle.o ./obj/Debug/src/nme/Lib.o ./obj/Debug/src/nme/events/KeyboardEvent.o ./obj/Debug/src/cpp/rtti/FieldNumericIntegerLookup.o ./obj/Debug/src/nme/geom/Point.o ./obj/Debug/src/RangeError.o ./obj/Debug/src/Std.o ./obj/Debug/src/nme/display/StageScaleMode.o ./obj/Debug/src/nme/display/LineScaleMode.o ./obj/Debug/src/Hash.o ./obj/Debug/src/nme/events/Listener.o ./obj/Debug/src/nme/utils/ByteArray.o ./obj/Debug/src/haxe/io/Input.o ./obj/Debug/src/nme/events/EventPhase.o ./obj/Debug/src/nme/events/IOErrorEvent.o ./obj/Debug/src/nme/display/BitmapData.o ./obj/Debug/src/StringBuf.o ./obj/Debug/src/nme/geom/Transform.o ./obj/Debug/src/nme/display/StageAlign.o ./obj/Debug/src/IntHash.o ./obj/Debug/src/nme/utils/Endian.o ./obj/Debug/src/nme/geom/ColorTransform.o ./obj/Debug/src/nme/filters/BitmapFilter.o ./obj/Debug/src/Type.o ./obj/Debug/src/ValueType.o ./obj/Debug/src/IntIter.o ./obj/Debug/src/nme/display/IGraphicsData.o ./obj/Debug/src/nme/display/StageDisplayState.o ./obj/Debug/src/nme/display/SpreadMethod.o ./obj/Debug/src/nme/display/Tilesheet.o ./obj/Debug/src/Reflect.o ./obj/Debug/src/haxe/io/Eof.o ./obj/Debug/src/nme/media/SoundChannel.o ./obj/Debug/src/nme/display/Stage.o ./obj/Debug/src/nme/events/TouchEvent.o ./obj/Debug/src/nme/events/MouseEvent.o ./obj/Debug/src/nme/display/TouchInfo.o ./obj/Debug/src/nme/display/Graphics.o ./obj/Debug/src/nme/events/FocusEvent.o ./obj/Debug/src/nme/events/Event.o ./obj/Debug/src/nme/Timer.o ./obj/Debug/src/nme/display/MovieClip.o ./obj/Debug/src/nme/display/Sprite.o ./obj/Debug/src/nme/display/DisplayObjectContainer.o ./obj/Debug/src/nme/display/InteractiveObject.o ./obj/Debug/src/nme/display/DisplayObject.o ./obj/Debug/src/cpp/Lib.o ./obj/Debug/src/nme/Loader.o ./obj/Debug/src/nme/events/EventDispatcher.o ./obj/Debug/src/nme/display/StageQuality.o ./obj/Debug/src/nme/display/InterpolationMethod.o ./obj/Debug/src/nme/events/IEventDispatcher.o ./obj/Debug/src/nme/display/CapsStyle.o ./obj/Debug/src/nme/display/IBitmapDrawable.o ./obj/Debug/src/haxe/io/BytesBuffer.o ./obj/Debug/src/__boot__.o ./obj/Debug/src/__resources__.o ./obj/Debug/src/__main__.o ./obj/Debug/src/hx/Anon.o ./obj/Debug/src/hx/Boot.o ./obj/Debug/src/hx/CFFI.o ./obj/Debug/src/hx/Date.o ./obj/Debug/src/hx/GC.o ./obj/Debug/src/hx/GCInternal.o ./obj/Debug/src/hx/Hash.o ./obj/Debug/src/hx/Interface.o ./obj/Debug/src/hx/Lib.o ./obj/Debug/src/hx/Object.o ./obj/Debug/src/hx/StdLibs.o ./obj/Debug/src/hx/Debug.o ./obj/Debug/src/hx/Thread.o ./obj/Debug/src/Array.o ./obj/Debug/src/Class.o ./obj/Debug/src/Dynamic.o ./obj/Debug/src/Enum.o ./obj/Debug/src/Math.o ./obj/Debug/src/String.o
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libnapp.so, needed by C:\Program Files\Palm\PDK/device/lib/libSDL.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libPiranha.so, needed by C:\Program Files\Palm\PDK/device/lib/libSDL.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libpalmvibe.so, needed by C:\Program Files\Palm\PDK/device/lib/libSDL.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libIMGegl.so, needed by C:\Program Files\Palm\PDK/device/lib/libGLES_CM.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libsrv_um.so, needed by C:\Program Files\Palm\PDK/device/lib/libGLES_CM.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: liblunaservice.so, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libsqlite3.so.0, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libcjson.so, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libcurl.so.4, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libluna-prefs.so, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libssl.so.0.9.8, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
Running Post-Build Command Line...
cmd: Export\scripts\package.bat

D:\dev\proj\palm_pdk\MyApp>set EXPORT_DIR=Export

D:\dev\proj\palm_pdk\MyApp>call Export\scripts\getappinfo.bat

D:\dev\proj\palm_pdk\MyApp>set STAGING_DIR=obj\com.myapps.myapp

D:\dev\proj\palm_pdk\MyApp>rmdir /s /Q obj\com.myapps.myapp

D:\dev\proj\palm_pdk\MyApp>del Export\*.ipk
Could Not Find D:\dev\proj\palm_pdk\MyApp\Export\*.ipk

D:\dev\proj\palm_pdk\MyApp>mkdir obj\com.myapps.myapp

D:\dev\proj\palm_pdk\MyApp>xcopy Export\*.* obj\com.myapps.myapp /E /EXCLUDE:Export\scripts\exclusions.txt
Export\appinfo.json
Export\nekoapi.so
Export\nme.so
Export\regexp.so
Export\std.so
5 File(s) copied

D:\dev\proj\palm_pdk\MyApp>echo filemode.755=MyApp 1>obj\com.myapps.myapp\package.properties
( was unexpected at this time.
D:\dev\proj\palm_pdk\MyApp>if == debug (
Build halted with errors.
Done(1)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 3:24 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
FlashDevelop supports a drop-down to change between Debug and Release build configurations.

Previously, my CPP project template only supported the Release build configuration. However, I recently updated it so that it would work correctly with either.

It looks like I updated the script files in the template, but failed to update the project file. I apologize for the inconvenience. I've updated the SVN repository so this doesn't happen again.

You can download the new *.fdz file from the repository (update the SVN folder) and install it again to correct this issue for any future projects.

For your current project, it's a simple change. Go to Project > Properties > Build, and change "Post-Build Command Line" from:

Code:
Export\scripts\package.bat

... to:

Code:
Export\scripts\package.bat $(BuildConfig)

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 3:36 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Thank you very much for your help and your valuable tutorial.

It's my first contact with HaXe. I think I love it.


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 4:07 am 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
just checked out the SVN source when I got home and there is no \version2 folder now, is this soemthing build.bat makes now?

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 4:26 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Hi kernelsandirs,

One of the major changes when haXe 2.06 was released is that NME 2 became the main version. Sorry! I should have gone through the old tutorial a bit more thoroughly. You should point your dev version to "nekonme" and not "nekonme\version2"

You should not have to run build.bat ... that's for rebuilding nme.so, which is included in the FlashDevelop project template

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 5:07 am 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
singmajesty wrote:
Hi kernelsandirs,

One of the major changes when haXe 2.06 was released is that NME 2 became the main version. Sorry! I should have gone through the old tutorial a bit more thoroughly. You should point your dev version to "nekonme" and not "nekonme\version2"

You should not have to run build.bat ... that's for rebuilding nme.so, which is included in the FlashDevelop project template


Awesome work singmajesty!
Got it working(well building the ipk now, haven't been able to test on my phone yet but certainly closer now) :-)

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 5:24 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Hello,

I installed the application on the Palm emulator but it is not running...

I added a text into the initialize() function:

private function initialize ():Void {

var tf = new TextField();
tf.text = "Hello World !";

Lib.current.stage.addChild(tf);

Lib.current.stage.align = StageAlign.TOP_LEFT;
Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE;
Lib.current.stage.frameRate = 31;

}

I click the application icon but, nothing happens...


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 5:30 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Perhaps it is because you haven't typed tf, or maybe it doesn't like that you're adding it to the stage?

Using the template as-is, this code should show you something on screen (in the construct method)

Code:
graphics.beginFill (0xFF0000);
graphics.drawRect (10, 10, 100, 100);


You might also try adding a text field in the construct method, like this:

Code:
var textField:TextField = new TextField ();
textField.text = "Hello World!";
addChild (textField);



Occasionally, the C implementation can be a bit finicky, but generally speaking it's been treating me well. There's just little limitations built-in that aren't always obvious. For example, if I try and load a Bitmap that is too large, it just doesn't appear. I also noticed in the sound sample that it only supports one MP3 at a time, though it supports as many OGG, WAV or AIFF files as you want, I think. Stuff like that. There aren't too many issues like this, but probably they surround the use of specific libraries (audio, bitmap, text) than it does the rest of the framework.

Let me know if the above code works!

I may be building better logging into the framework in the future, so it will report runtime C errors (it is currently possible to take the application and run it directly from Linux, which helps provide options for debugging, but that's certainly more complicated)

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 5:51 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Sorry,

It doesn't work... The application is installed... I see that in command prompt. The launch command don't do anything... If I try to launch the application by clicking on the icon, it doesn't run.

In the Output window I have these red lines (warnings):

c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libnapp.so, needed by C:\Program Files\Palm\PDK/device/lib/libSDL.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libPiranha.so, needed by C:\Program Files\Palm\PDK/device/lib/libSDL.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libpalmvibe.so, needed by C:\Program Files\Palm\PDK/device/lib/libSDL.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libIMGegl.so, needed by C:\Program Files\Palm\PDK/device/lib/libGLES_CM.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libsrv_um.so, needed by C:\Program Files\Palm\PDK/device/lib/libGLES_CM.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: liblunaservice.so, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libsqlite3.so.0, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libcjson.so, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libcurl.so.4, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libluna-prefs.so, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld.exe: warning: libssl.so.0.9.8, needed by C:\Program Files\Palm\PDK/device/lib/libpdl.so, not found (try using -rpath or -rpath-link)


Right now I'm a bit tired... I need to sleep. I will revise all the steps tomorrow.

Thank you very much.


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 5:58 am 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
Awesome your last post helped me finally get started, now I can draw all kinds of cool stuff :-)

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 6:04 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
kunkurus,

Do you have 1.4.5 installed on your phone?

Those warnings are actually to be expected. Don't worry about them. Try and pare back the application until it does run, then go step by step to see what is causing the application to break. If you aren't running 1.4.5, though, the application won't run correctly.


kernelsandirs,

Awesome! I'm glad I was able to help you with these working project templates, rather than the "nitty gritty" of the earlier alpha versions.

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 11:40 am 

Joined: Wed Aug 18, 2010 7:20 pm
Posts: 7
Maybe that is the problem... I do not have a phone, I use only the Palm Emulator.


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 4:25 pm 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Yep, that would do it. I just updated the post to make that more clear. PDK applications are compiled for the ARM processor instruction set, which is different and not compatible with the x86 or x64 architecture that's probably in your desktop or laptop.

On the other hand, since haXe supports multiple targets, you can compile to Flash, or even to C in Windows, Linux or OS X. If you remove the -D webos flag from the project properties, it will try and compile using Visual Studio C++ in Windows. If you have it installed and configured correctly, that will let you still compile in C ... just on the desktop. I know that's not identical, but it might be the best bet for now.

If you want to continue developing, I would recommend sticking with Flash. You should still be able to work on an application now, then compile it for webOS once you have a phone to work with

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sat Aug 21, 2010 11:17 pm 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
wow this is so amazing! In just a few hours I put together a very basic game with haxe that runs very nicely on my pixi. So far this is working great. What is the licensing like with haxe oe this particular build of haxe, does it allow for commercial, or ad supported releases? I would without a doubt donate a portion of proceeds of any commercial app to this effort.

now I gotta learn how do do collision detection stuff, off to learn some more cool stuff.

Tim G.

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sun Aug 22, 2010 5:38 am 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Great!

I made sure that the defaults worked for both the Pre and Pixi. There's a "palmpre" directive available to optimize for the Pre's processor, but otherwise it works for both. Ironically, I heard that the Pixi actually has a better graphics board than the Pre. It would be interested to figure out which one runs better ... depends on the application, I suppose :)

You can release commercial or ad-supported applications. That's fine. Send me a PM if you would like to help support the project!

If you're looking for collision detection, there's a couple ways you can go. For the full-on, 2D physics simulation, look into box2Dhx or physaxe, which both appear to be good engines based on the popular Box2D C library. Otherwise there's some easier ways to do it.

Like Flash, you can use the hitTestPoint or hitTestObject methods of a Sprite to check for collisions. However, a more precise (and perhaps faster) method might be to use a collision map.

If you create an additional bitmap for each of your assets, you can color the graphic based on game events. The getPixel method of a BitmapData object will return the color of the pixel, so you could decide that bright green is a "hit", and anything else is a miss. Instead of using hitTestPoint, which might produce false positives if you have a lot of transparency in your graphics, you can ping your collision bitmap to check the color of that pixel.

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: UPDATED: How to get started with haXe 2.06 and the webOS PDK
PostPosted: Sun Aug 22, 2010 4:32 pm 

Joined: Mon May 03, 2010 5:23 am
Posts: 51
Great info, I will say it is kinda funny when I run some of the Physaxe demos on my PC, vs my pixi, the pixi is out-performing flash on my PC :-) very strange
my PC is a few years old AMD 1.7Ghz 2GB Ram, Wish I had a Pre though I love games and there is hardly any good ones for pixi at the moment.

Anyway I got Phx working nicely, still learning how to use it, haven't quite figured out how to change the look of the objects or even color them quite yet, but haven't dug far at all yet, this is way fun!

singmajesty this haxe webos project is incredibly inspiring to me! Guess I better go spend a little time on my primary project BFGMaps though :-) Wish I could port it to PDK and get in the contest. certainly could use the money right now :-(

Thanks again,
Tim G.

_________________
Apps I created(so far):
BFGMaps
Netphlix
Boxalicious(box.net)
Phatsecret(fatsecret.com)


Top
 Profile  
 
Display posts from previous:  Sort by  
   [ 176 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron