HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.98k stars 439 forks source link

FlxSprite.draw() crash with latest nme beta #176

Closed ragekit closed 11 years ago

ragekit commented 11 years ago

I've download the latest nme beta from repository (to manage multiple gamepad/gamestick on the mac). And my program doesn't build anymore : it says FlxSprite.draw() misses an argument. It's not critical, maybe it was just an error in nme repository, but i thought you should know before the next version of NME goes to release.

/usr/lib/haxe/lib/flixel/1,07/org/flixel/FlxSprite.hx:830: characters 2-79 : Invalid arguments /usr/lib/haxe/lib/flixel/1,07/org/flixel/FlxSprite.hx:830: characters 2-79 : Function 'draw' requires arguments : source, ?matrix, ?colorTransform, ?blendMode, ?clipRect, ?smoothing

EDIT : correction, the error is on _pixels which is a bitmapdata.

Beeblerox commented 11 years ago

@RageKit i think this is hxcpp related issue. Try to switch to hxcpp 2.10: haxelib set hxcpp 2.10

ragekit commented 11 years ago

Same thing with hxcpp 2.10 :/ i'll try to check with its beta version

EDIT : nope, same thing.

Beeblerox commented 11 years ago

I know there is the problem and will fix it after nme 3.5.0 will be fixed on haxelib. You just need to replace the line _pixels.draw(bitmapData, _matrix, null, brushBlend, null, Brush.antialiasing); with _pixels.draw(bitmapData, _matrix, null, Brush.blend, null, Brush.antialiasing);

photex commented 11 years ago

After updating that line in the flixelNME branch I can build my app just fine, but it bails at runtime:

lofi-ld25(7234,0xac46ca28) malloc: *** error for object 0x5bad40: pointer being freed was not allocated

I realize there is absolutely zero useful information here, but I just thought I'd toss this into the discussion. I tried this with the dev branch too and got the same result.

Beeblerox commented 11 years ago

@photex What operating system, Haxe, NME and HXCPP versions do you use?

photex commented 11 years ago

OS: OSX 10.8.2 (Latest XCode)

Haxe 2.10 HXCPP 2.10 NME 3.5.1

On Thu, Dec 27, 2012 at 11:27 PM, Zaphod notifications@github.com wrote:

@photex https://github.com/photex What operating system, Haxe, NME and HXCPP versions do you use?

— Reply to this email directly or view it on GitHubhttps://github.com/Beeblerox/HaxeFlixel/issues/176#issuecomment-11726884.

Beeblerox commented 11 years ago

@photex try to install latest version of flixel from haxelib and tell me if it will help or not, please

photex commented 11 years ago

@Beeblerox Sadly the same problem :(

lofi-ld25(15577,0xac46ca28) malloc: *** error for object 0x5485f0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug

Beeblerox commented 11 years ago

I'll try to search the source of your problem, but after New Year. Sorry

photex commented 11 years ago

No worries! Have a great new year. :)

From: "Zaphod" notifications@github.com To: "Beeblerox/HaxeFlixel" HaxeFlixel@noreply.github.com CC: "Chip Collier" photex@gmail.com Sent: December 29, 2012 10:31 PM Subject: Re: [HaxeFlixel] FlxSprite.draw() crash with latest nme beta (#176)

I'll try to search the source of your problem, but after New Year. Sorry

— Reply to this email directly or view it on GitHubhttps://github.com/Beeblerox/HaxeFlixel/issues/176#issuecomment-11761914.

Beeblerox commented 11 years ago

@photex I've started messing with your problem and I think that this is NME-related bug, since if I switch to nme 3.4.3 and change the line 833 in FlxSprite from:

_pixels.draw(bitmapData, _matrix, null, brushBlend, null, Brush.antialiasing);

to

_pixels.draw(bitmapData, _matrix, null, null, null, Brush.antialiasing);

(as a temp solution) then it compiles and works just fine. We need to dig deeper

Beeblerox commented 11 years ago

@photex I found that this is caused by sound caching code in LFRegistry::init() method

Beeblerox commented 11 years ago

@photex I think I finally found it! It is totally sound problem. You need to export sounds with at least 22050 Hz to WAV signed 16 bit PCM (I've done this with http://audacity.sourceforge.net/ - free sound editing tool)

Beeblerox commented 11 years ago

@photex I've posted about this bug at NME's forum: http://www.nme.io/community/forums/bugs/nme-353-problem-wav-files/

Beeblerox commented 11 years ago

@photex it was fixed on SVN. You can use latest build from http://www.nme.io/builds/ now

photex commented 11 years ago

Hey @Beeblerox thanks for the follow up. This is the weakest part of NME in my opinion. I specifically had to format the sounds as I had them to get them to even play correctly in NME 3.4.x. Thanks for going out of your way here.