HaxeFlixel / flixel

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

RotatedGraphic in CPP target. #171

Closed soarcn closed 11 years ago

soarcn commented 11 years ago

I notice that this is not happen in Flixel but other framework(like haxepunk), but I would really like to know how to deal that.

when load a PNG file with transparent background by using loadRotatedGraphic, the alpha info will lost, transparent area will be shown as grey area.

but with loadGraphic, working correct, is this a limitation of loadRotatedGraphic?

Beeblerox commented 11 years ago

@soarcn I don't quite understand. What do you mean by alpha info lost? Can you post some simple example code with loaded image showing your problem?

soarcn commented 11 years ago

sorry for my english, it means the transparent area will be shown as grey area. you can just use one simple PNG file (like bot.png in mode demo). I use following code to create the sprite

class Toss extends FlxSprite {

public function new(postion:Point = null )
{
    if (postion == null)
        postion = new Point(FlxG.width/2,FlxG.height/2);
    super(postion.x, postion.y);
    loadRotatedGraphic(Env.loadBitmap("toss.png"));

}
Beeblerox commented 11 years ago

@soarcn That's strange. I don't have such problems. Maybe you're using non 32-bit images? And what Env class is?

soarcn commented 11 years ago

yes, you are right, I change it to 32bit images, the defects fixed. Env come from the HXmine example which joshuagranick provide for the multi-resolution Adaptive (provide different set of images, choose the right one base on the dpi )