back2dos / tinkerbell

MIT License
83 stars 8 forks source link

question :Is that possible auto convert UInt to Int? #43

Closed sonygod closed 11 years ago

sonygod commented 11 years ago

such like this code

if flash

static public function createBitmap(Width:UInt, Height:UInt, Color:UInt, ?Unique:Bool = false, ?Key:String = null):BitmapData
#else
static public function createBitmap(Width:Int, Height:Int, Color:BitmapInt32, ?Unique:Bool = false, ?Key:String = null):BitmapData

every function need to write twice is waste.. I want width:@UInt, Height:@Uint,,is that possible? thanks.

back2dos commented 11 years ago

This should do the trick:

typedef MyInt = #if flash UInt #else Int #end;

static public function createBitmap(Width:MyInt, Height:MyInt, Color:MyInt, ?Unique:Bool = false, ?Key:String = null):BitmapData