Last active
August 2, 2023 21:00
-
-
Save Geokureli/fbfb75a87037b1aa805f89302d2b684b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package states; | |
import flixel.util.FlxColor; | |
import flixel.FlxG; | |
import flixel.FlxSprite; | |
class DoNothingShaderTestState extends flixel.FlxState | |
{ | |
override function create() | |
{ | |
super.create(); | |
final rdm = FlxG.random; | |
// create random squares so we know the shader is working | |
for (i in 0...50) | |
{ | |
final sprite = new FlxSprite(); | |
sprite.x = rdm.int(0, FlxG.width); | |
sprite.y = rdm.int(0, FlxG.height); | |
sprite.makeGraphic(rdm.int(30, 100), rdm.int(30, 100), FlxColor.fromHSB(rdm.float(0, 360), 1, 1)); | |
add(sprite); | |
} | |
FlxG.camera.setFilters([new openfl.filters.ShaderFilter(new DoNothingShader())]); | |
} | |
override function update(elapsed) | |
{ | |
super.update(elapsed); | |
} | |
} | |
/** | |
* Just shows what is already there | |
*/ | |
class DoNothingShader extends flixel.system.FlxAssets.FlxShader | |
{ | |
@:glFragmentSource(' | |
#pragma header | |
void main() | |
{ | |
gl_FragColor = texture2D(bitmap, openfl_TextureCoordv); | |
} | |
') | |
public function new () { super(); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment