-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
untested but yeah psych 1.0a is coming so
- Loading branch information
1 parent
3147b3b
commit 6952de5
Showing
10 changed files
with
164 additions
and
86 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package backend; | ||
|
||
import backend.ClientPrefs; | ||
import openfl.filters.ColorMatrixFilter; | ||
|
||
@:access(flixel.FlxGame) | ||
class ColorBlindness extends ColorMatrixFilter { | ||
public var enabledFilter:Bool = true; | ||
|
||
public function new(filterType:String) { | ||
enabledFilter = filterType.toUpperCase() != "NONE"; | ||
|
||
if (!enabledFilter) return; | ||
|
||
var filter:Array<Float> = []; | ||
switch (filterType.toUpperCase()) { | ||
case "DEUTERANOPIA": | ||
filter = [ | ||
0.43, 0.72, -.15, 0, 0, | ||
0.34, 0.57, 0.09, 0, 0, | ||
-.02, 0.03, 1, 0, 0, | ||
0, 0, 0, 1, 0, | ||
]; | ||
case "PROTANOPIA": | ||
filter = [ | ||
0.20, 0.99, -.19, 0, 0, | ||
0.16, 0.79, 0.04, 0, 0, | ||
0.01, -.01, 1, 0, 0, | ||
0, 0, 0, 1, 0, | ||
]; | ||
case "TRITANOPIA": | ||
filter = [ | ||
0.97, 0.11, -.08, 0, 0, | ||
0.02, 0.82, 0.16, 0, 0, | ||
0.06, 0.88, 0.18, 0, 0, | ||
0, 0, 0, 1, 0, | ||
]; | ||
default: | ||
} | ||
super(filter); | ||
} | ||
|
||
public static function setColorFilter() { | ||
if (FlxG.game._filters == null) FlxG.game._filters = []; | ||
if (FlxG.game._filters.contains(Main.colorFilter)) FlxG.game._filters.remove(Main.colorFilter); | ||
|
||
Main.colorFilter = new ColorBlindness(ClientPrefs.data.colorFilter); | ||
if (ClientPrefs.data.colorFilter != "NONE") FlxG.game._filters.push(Main.colorFilter); | ||
/*else FlxG.game.setFilters([]);*/ | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.