flixel icon indicating copy to clipboard operation
flixel copied to clipboard

lack of pixel perfect rendering

Open poisonHornGames opened this issue 11 months ago • 6 comments

the github gist hasn't worked for a while now, neither is there an official or easy way to do it

poisonHornGames avatar Mar 12 '24 12:03 poisonHornGames

I don't know of any, off-hand, We'd have to work with openfl/lime to make a new one

Geokureli avatar Mar 12 '24 13:03 Geokureli

pixel perfect graphics work on the flash target

https://github.com/HaxeFlixel/flixel/assets/155884736/1842a50f-cddd-4fbe-bede-b1dde8a88657

poisonHornGames avatar Mar 13 '24 20:03 poisonHornGames

i managed to make it work by changing with the hashlink target by changing line 702 in FlxG.hx "#if air" to "#if (air || desktop)" not sure if it's the correct solution but it works :)

poisonHornGames avatar Mar 13 '24 20:03 poisonHornGames

i managed to make it work by changing with the hashlink target by changing line 702 in FlxG.hx "#if air" to "#if (air || desktop)" not sure if it's the correct solution but it works :)

blitting is likely gonna have much worse performance, I do think there's a better solution but I don't know when I'll have time to try it out

Geokureli avatar Mar 14 '24 14:03 Geokureli

I tried re-creating the effect using shaders (in a fork I made) This is the shader I used:

private class PixelPerfectShader extends FlxShader
{
	@:glFragmentSource('
	#pragma header
	
	uniform vec2 screenSize;
	void main()
	{
		gl_FragColor = flixel_texture2D(bitmap, floor(openfl_TextureCoordv * screenSize)/screenSize);
	}
	')
	public function new()
	{
		super();
		screenSize.value = [ FlxG.width*2, FlxG.height*2 ];
	}
}

UncertainProd avatar Mar 16 '24 15:03 UncertainProd

Testing on Windows:

https://github.com/HaxeFlixel/flixel/assets/83609901/fc9314f6-5e36-4922-bf90-3d9fe8959be5

Adding the ShaderFilter to an FlxCamera's filters array should probably prevent the mouse pointer from getting pixelated too

UncertainProd avatar Mar 16 '24 15:03 UncertainProd