Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficient FlxKey#toString, FlxTileblock#setTile, overridable FlxState#open/close #1300

Merged
merged 10 commits into from
Sep 20, 2014

Conversation

JoeCreates
Copy link
Member

A few changes, here:

  • I removed the map value iteration from FlxKey#toString seeing as that is very memory intensive. The method I have used requires an extra map, which seems a bit repetitive, but definitely better at runtime.
  • I made the stamp sprite persist in FlxTileblock so that a setTile() method could be added. Really, in the long run, I think HaxeFlixel would benefit from something more like HaxePunk's TiledImage, which can have the texture offset and clipped to a specific rectangle, also with animation, and simply a better FlxTilemap for when more control is needed over specific tiles (Right now the fact that it is not a FlxSprite and had all it's own rendering makes it incredibly limited).
  • I found a situation where I needed to be able to override FlxState#open/close, so I made them non-inline, which will have negligible performance impact given how infrequently they are called.

@@ -6,7 +6,7 @@ package flixel.input.keyboard;
@:enum
abstract FlxKey(Int) from Int to Int
{
public static var keyNameMap:Map<String, FlxKey> = [
public static var fromStringMap:Map<String, FlxKey> = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... this is getting a bit excessive with two maps, should probably use a macro for this. The FlxColor macro already does something very similar.

Btw, FlxAndroidKey would need the same fix.

@Gama11 Gama11 merged commit 1b447a9 into HaxeFlixel:dev Sep 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants