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

Safe alloc optimizations + usage of flixel math objects in PixelPerfectCollision function #1760

Closed
wants to merge 2 commits into from
Closed

Conversation

gamedevsam
Copy link
Contributor

No description provided.

@@ -15,6 +15,7 @@ class FlxPointer

private var _globalScreenX:Int = 0;
private var _globalScreenY:Int = 0;
private static var _cachedPoint:FlxPoint = new FlxPoint();
Copy link
Member

Choose a reason for hiding this comment

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

Should maybe just be _point? That's how it's called in most other classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to make it obvious that these are static cached values (to prevent confusion or accidental deletion), but I am open to changing this (or other classes) to better fit existing conventions.

It does introduce an issue with variables named dx, or _cachedFloat, where _cached clearly prefix helps with readability.

Copy link
Member

Choose a reason for hiding this comment

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

I was specifically talking about this FlxPoint var here. I agree that the floats would be quite even more confusing without the prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer to stick with the _cached convention, if there are _point variables that are static for caching purposes, we should rename it to _cachedPoint.

@Gama11 Gama11 added this to the 4.1.0 milestone Mar 2, 2016
…occurs if there are records to be processed.
@Gama11 Gama11 modified the milestones: 4.1.0, 4.2.0 Apr 22, 2016
@Gama11 Gama11 closed this in c52b534 Aug 21, 2016
@Gama11
Copy link
Member

Gama11 commented Aug 21, 2016

I partially merged this (mostly the parts that didn't have merge conflicts: FlxCollision and FlxPointer). I still really dislike the readability implications of caching basic types and didn't merge that part...

Aurel300 pushed a commit to larsiusprime/haxeflixel that referenced this pull request Apr 18, 2018
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