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
Added support for shader based scaling on Next #1826
Conversation
Does this still work with OpenFL legacy? I guess the old pull request can be closed? |
@@ -120,8 +120,8 @@ class FlxPointer | |||
*/ | |||
public inline function setGlobalScreenPositionUnsafe(newX:Float, newY:Float):Void | |||
{ | |||
_globalScreenX = Std.int(newX / FlxG.scaleMode.scale.x); | |||
_globalScreenY = Std.int(newY / FlxG.scaleMode.scale.y); | |||
_globalScreenX = Std.int(FlxG.scaleMode.mouseMultiplier.x * newX / FlxG.scaleMode.scale.x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is in FlxPointer
, it affects touches as well. Because of that, pointerMultiplier
is probably a better name than mouseMultiplier
.
It doesn't actually scale on legacy but it doesn't crash either. It just runs as BaseScaleMode. I suppose its possible to reimplement it the old way with a compiler conditional. I'll look into that right now. And yes the other one can be closed. |
Looks cool :) What's the use code, same as the other one? |
@larsiusprime Yup same as the other one! |
You don't have to update each file individually using GitHub's web UI, that seems very cumbersome. You can use a git client like SourceTree to push to your fork's branch. |
Btw, we have automated code style checks, yours doesn't match Flixel's in a few places: https://codeclimate.com/github/HaxeFlixel/flixel/pull/1826 Feel free to ignore the |
} | ||
|
||
override public function clone():BitmapFilter { | ||
return super.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method can probably be removed, considering it just calls super?
SourceTree is confusing af to start with, but it's super useful once you do. Alternatively, github also has a desktop client |
So I have a bunch of changes that improve on the classes I made that I'll push as soon as I'm back at the computer. It adds support for legacy and cleans up a lot of the styling issues. |
Ok I just pushed another commit that gets rid of all the internal openfl method overrides. It also gets rid of really weird funky math that was necessary in each shader in order to position the screen correctly. |
So, is this on hold because of openfl/openfl#1128? |
That issue was so recent and this PR has been sitting a while |
I don't see how that answers my question? :P |
Hang on I may have found a small bug. I'll run some tests tonight and get back to you guys soon. |
Oh I thought you were asking "Has this been on hold this whole time bc of this issue?" Is it the same result if openfl implements it, given that this is acting on a single DisplayObject (FlxGame) and openfl's would act on the visible stage/screen buffer? |
Ah, I should have said "is this now on hold". Well, there usually isn't too much going on in a flixel game that isn't part of |
No, I don't think this should be on hold; it's not clear whether OpenFL will agree it should be part of the core API (although I think it should) and this is working splendidly in DQ. Just noticed CI / codeclimate are failing, guess we can fix those up. |
Any news on this? |
@Tiago-Ling What is the android+next game scaling issue you mentioned? Is there another issue open for that? |
@JoeCreates Actually no issues opened, but it may be the situation for one - not directly related to the scaling though. The scaling problem is this:
The idea would be to use this scaling with shaders to alleviate this problem. One way to try this is to scale the game first using nearest neighbor to the desired integer (2x, 3x, etc) then apply the decimal part using a bilinear filter or something better than nn. This is what Shovel Knight does, according to openfl/openfl#1128 On the other hand, the problem which might need an issue is that i couldn't get |
Wasnt the first scaling issue always a problem even before next? I actually On 27 Jul 2016 12:27, "Tiago Ling Alexandre" notifications@github.com
|
In legacy the game scaling works fine here - in next i've experienced (i'll create an issue later if there isn't one already):
Nearest neighbor causes problems for non-integer scales - try scaling a pixel-art game to 1.15, 1.25 to see what i mean: some hard edges will be of different sizes and things will be uneven. This is a bigger problem for pixel-perfect fonts which will get terribly jagged and lose a lot of readability. |
I know, but if you scale more, say 3 or more times, those extra lines What I meant regarding lagacy was that legacy always used nearest On 27 Jul 2016 14:57, "Tiago Ling Alexandre" notifications@github.com
|
{ | ||
super(); | ||
|
||
if (Std.is(shader, Shader)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this unnecessary since we're leveraging Haxe's type system to ensure people send valid Shader types?
postProcess.setUniform("scaleY", scaleY); | ||
this.scaleX = scaleX; | ||
this.scaleY = scaleY; | ||
this.pointerMultiplier = new flixel.math.FlxPoint(1 / scaleX, 1 / scaleY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary memory allocation, just do: this.pointerMultiplier.set(1 / scaleX, 1 / scaleY);
This is a bit outdated by now and would have to be updated to support OpenFL 8. |
No description provided.