Tony Polinelli
Tarwin Stroh-Spijer

contact [at]
touchmypixel.com

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

Jellyroids – My First haxe C++ game test

jellyroids-01

After only a day or two playing in hxcpp i’ve got my first little test to show – Jellyroids!

This gametest compiles (using haxe) out to flash & C++ (exe in the cpp folder for windows only – i dont have a mac or linux, so cant test as yet).

Running the software rendered c++ version is a little slow – ~200fps on my comp, opengl is ~1500fps. Whereas flash clocks in at 100fps (maxed out). Prerendering the explosion animation (currently vector animation from a swf) will make it MUCH faster for c++ (stop the slowdown on shoot), as i feel its vector animation code isnt anywhere as optimized as that in flash.

Overall, its fun to see how easy its been to get out a simple test in hxcpp.

download the game test here

cheers – Tony

UPDATE:

to get it to work you need to change a few small things in the neash 0.9. realease.

There are two issues with the current release of neash that need fixing. Just change the following lines:

1/ in neash.display.MovieClip:
add in some stubs for functions (just copy in the following lines)

public function gotoAndPlay(frame:Dynamic, ?scene:String):Void { }
public function gotoAndStop(frame:Dynamic, ?scene:String):Void { }

public function stop(){}
public function play(){}

2/ in neash.display.DisplayObject:
make getRotation method look as follows:

public function GetRotation()
{
return mRotation * (180.0 / Math.PI);
}

8 comments

  1. Sam

    Cheers! You have inspired me to look in to hxcpp in more detail than just reading about it on gamehaxe.com. Thanks so much for including the source too.

    Interestingly on my laptop I had the highest framerate in Flash (at 100FPS) with about 70FPS in software and 60FPS openGL. Also openGL doesn’t appear to smooth the explosions so they don’t look half as nice as they do in Flash or software.


  2. I think Hugh is working on the way memory is handled for openGL (has troubles in his 3d tests too) – depending on your videocard it has quite different results. Interesting about the software being so low. Also, apparantly the newest version of NME (which i havent downloaded as yet) does antialiasing on the opengl version. I should update nme.dll to reflect this because it does look a little bad unantialiased

  3. hosey

    Any ideas why I get…
    peepee/Member.hx:78: characters 2-6 : Unknown identifier : stop


  4. oooh… yes. I remember adding in stubs for some of the missing functions that MovieClip in neash didnt have (they dont really do anything yet tho-
    I’ll see how to fix it right now… should be easy. And thats why you shouldnt modify other peoples libraries ;P


  5. There are two issues with the current release of neash that need fixing. Just change the following lines:

    1/ in neash.display.MovieClip:
    add in some stubs for functions (just copy in the following lines)

    public function gotoAndPlay(frame:Dynamic, ?scene:String):Void { }
    public function gotoAndStop(frame:Dynamic, ?scene:String):Void { }

    public function stop(){}
    public function play(){}

    2/ in neash.display.DisplayObject:
    make getRotation method look as follows:

    public function GetRotation()
    {
    return mRotation * (180.0 / Math.PI);
    }

  6. robo

    hi,tonny
    current neash version seem to can’t use bitmapdata.draw();
    your game veison is neash 0.4,
    here is my test code:
    I don’t know where is wrong..
    /////////////////////////////////
    public function new()
    {
    super();
    flash.Lib.current.addChild(this);
    var square = new Sprite();
    var gfx = square.graphics;
    gfx.beginFill(0x0000ff);
    gfx.drawRect(-10,-10,20,20);
    gfx.moveTo(0,0);
    gfx.endFill();
    this.addChild(square);
    square.CreateBitmapCache();
    square.mCacheAsBitmap = true;
    square.DispatchCompleteEvent();
    var b = new BitmapData(100, 200, false, 0);
    b.graphics.beginBitmapFill(square.mCachedBitmap, null, true, true); //nothing show ..

    b.graphics.flush();

    var bit = new Bitmap(b);
    bit.x = 300;
    this.addChild(bit);

    }
    could you tell me why?thank you !

  7. Kaddaj

    Hello,

    yeh, I have also some problems with bitmapData.draw(). Anyone know whats wrong with it? :)

    - ML


  8. kaddaj>>
    bitmapData.draw() has not yet been implemented in any versions of neash i dont think. You use copypixels to copy in bitmapData from a loaded jpg, or use it as a texture for opengl, but the drawing of vector data to the bitmap doesnt yet work.

    robo>>
    using cacheAsBitmap would require the same rendering facility as the bitmapData.draw (i think) and so i’m guessing this doesnt work.

    Unfortunately at the moment, you need to load in pre-rendered bitmaps of your sprites for use in neash. You could also have a play with the SWF reading feaures – but this is not bitmap related (and a little experimental)

 

Leave a Reply

Our Friends:

Powered by haXe / poko cms | Copyright 2008-09 TouchMyPixel