generated from Joalor64GH/HaxeFlixel-Template
-
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.
- Loading branch information
1 parent
a896eb8
commit 67f82d4
Showing
8 changed files
with
126 additions
and
53 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,57 @@ | ||
package objects; | ||
|
||
import flixel.system.FlxAssets.FlxShader; | ||
|
||
class ColorSwap { | ||
public var shader(default, null):ColorSwapShader = new ColorSwapShader(); | ||
public var r(default, set):Float = 255; | ||
public var g(default, set):Float = 0; | ||
public var b(default, set):Float = 0; | ||
|
||
private function set_r(value:Float) { | ||
r = value; | ||
shader.red.value = [r/255]; | ||
return r; | ||
} | ||
|
||
private function set_g(value:Float) { | ||
g = value; | ||
shader.green.value = [g/255]; | ||
return g; | ||
} | ||
|
||
private function set_b(value:Float) { | ||
b = value; | ||
shader.blue.value = [b/255]; | ||
return b; | ||
} | ||
|
||
public function new() { | ||
r = 255/255; | ||
g = 0/255; | ||
b = 0/255; | ||
} | ||
} | ||
|
||
class ColorSwapShader extends FlxShader { | ||
@:glFragmentSource(' | ||
#pragma header | ||
|
||
uniform float red; | ||
uniform float green; | ||
uniform float blue; | ||
|
||
void main() { | ||
|
||
vec4 col = flixel_texture2D(bitmap, openfl_TextureCoordv); | ||
// Get difference to use for falloff if required | ||
float diff = col.r - ((col.g + col.b) / 2.0); | ||
gl_FragColor = vec4(((col.g + col.b) / 2.0) + (red * diff), col.g + (green * diff), col.b + (blue * diff), col.a); | ||
} | ||
') | ||
public function new() { | ||
super(); | ||
} | ||
} |
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,22 @@ | ||
package objects; | ||
|
||
class NoteColors { | ||
public static var noteColors:Array<Array<Int>> = SaveData.settings.notesRGB; | ||
|
||
public static final defaultColors:Array<Array<Int>> = [ | ||
[221, 0, 255], | ||
[0, 128, 255], | ||
[0, 215, 54], | ||
[255, 0, 106] | ||
]; | ||
|
||
public static function setNoteColor(note:Int, color:Array<Int>):Void { | ||
noteColors[note] = color;; | ||
SaveData.settings.notesRGB[note] = color; | ||
SaveData.saveSettings(); | ||
} | ||
|
||
public static function getNoteColor(note:Int):Array<Int> { | ||
return noteColors[note]; | ||
} | ||
} |
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