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

Make FlxMouse._cursor public #2969

Merged
merged 5 commits into from
Nov 21, 2023
Merged

Make FlxMouse._cursor public #2969

merged 5 commits into from
Nov 21, 2023

Conversation

DetectiveBaldi
Copy link
Contributor

@DetectiveBaldi DetectiveBaldi commented Nov 20, 2023

Does exactly what the title says

@Geokureli
Copy link
Member

Please share an example of what you're trying to do, you should really never need to use the Bitmap class, and if you do you can easily get a bitmapData from it

@DetectiveBaldi
Copy link
Contributor Author

Please share an example of what you're trying to do, you should really never need to use the Bitmap class, and if you do you can easily get a bitmapData from it

I'm trying to change the bitmap's smoothing property. _cursor is not a public variable so it's just convenient to be able to pass in my own Bitmap so I can specify smoothing in the constructor. Something like:

var _customCursor:Bitmap = new Bitmap(BitmapData.fromFile('assets/images/CustomCursor.png'), null, true);
FlxG.mouse.load(_customCursor, 2);

@Geokureli
Copy link
Member

Geokureli commented Nov 20, 2023

would it be better to add a smoothing arg, or expose the bitmap instance, instead?

that would simplify your code down to

FlxG.mouse.load('assets/images/CustomCursor.png', 2, 0, 0, true);

or

FlxG.mouse.load('assets/images/CustomCursor.png', 2);
FlxG.mouse.cursor.smoothing = true;

or we could add a FlxG.mouse.antialiasing to match FlxSprite

@DetectiveBaldi
Copy link
Contributor Author

hmm, I think i'll go with making _cursor public, just incase you want to mess with Bitmap.pixelSnapping or other properties.

@DetectiveBaldi DetectiveBaldi changed the title support for passing in Bitmap in FlxMouse.load Make FlxMouse._cursor public Nov 20, 2023
@DetectiveBaldi
Copy link
Contributor Author

Alright, should be good to go

@Geokureli
Copy link
Member

there's one mistake, from the code I gave, commented above

@DetectiveBaldi
Copy link
Contributor Author

I see

@Geokureli
Copy link
Member

Added a deprecation warning to _cursor, which I forgot. Nightly CI jobs are failing in every branch, so don't worry about that, will merge in a bit

@Geokureli Geokureli merged commit c234196 into HaxeFlixel:dev Nov 21, 2023
11 of 16 checks passed
@DetectiveBaldi DetectiveBaldi deleted the bitmap branch November 21, 2023 16:53
Geokureli added a commit that referenced this pull request Nov 21, 2023
@Geokureli Geokureli added this to the 5.6.0 milestone Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants