1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-27 01:03:35 +00:00

outline bullshit in progress

This commit is contained in:
Cameron Taylor 2021-03-24 18:41:54 -04:00
parent 985bd5374b
commit 180c3db3c4
7 changed files with 64 additions and 94 deletions

View file

@ -1,74 +0,0 @@
package;
import flixel.FlxG;
import flixel.addons.effects.chainable.FlxEffectSprite;
import flixel.addons.effects.chainable.FlxOutlineEffect;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.util.FlxColor;
import shaderslmfao.ColorSwap;
class ColorpickSubstate extends MusicBeatSubstate
{
var curSelected:Int = 0;
var grpNotes:FlxTypedGroup<Note>;
public function new()
{
super();
grpNotes = new FlxTypedGroup<Note>();
add(grpNotes);
for (i in 0...4)
{
var note:Note = new Note(0, i);
note.x = (100 * i) + i;
note.screenCenter(Y);
var _effectSpr:FlxEffectSprite = new FlxEffectSprite(note, [new FlxOutlineEffect(FlxOutlineMode.FAST, FlxColor.WHITE, 4, 1)]);
add(_effectSpr);
_effectSpr.y = 0;
_effectSpr.x = i * 80;
_effectSpr.antialiasing = true;
_effectSpr.setGraphicSize(Std.int(_effectSpr.width * 0.7));
_effectSpr.updateHitbox();
grpNotes.add(note);
}
}
override function update(elapsed:Float)
{
if (controls.BACK)
{
FlxG.state.closeSubState();
FlxG.state.openSubState(new OptionsSubState());
}
if (controls.UI_RIGHT_P)
curSelected += 1;
if (controls.UI_LEFT_P)
curSelected -= 1;
if (curSelected < 0)
curSelected = grpNotes.members.length - 1;
if (curSelected >= grpNotes.members.length)
curSelected = 0;
if (controls.UI_UP)
{
grpNotes.members[curSelected].colorSwap.update(elapsed * 0.3);
Note.arrowColors[curSelected] += elapsed * 0.3;
}
if (controls.UI_DOWN)
{
grpNotes.members[curSelected].colorSwap.update(-elapsed * 0.3);
Note.arrowColors[curSelected] += -elapsed * 0.3;
}
super.update(elapsed);
}
}

View file

@ -1,10 +1,15 @@
package;
import Controls.Control;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import polymod.Polymod;
#if desktop
import sys.FileSystem;
#end
class OptionsSubState extends MusicBeatSubstate
{
@ -72,13 +77,13 @@ class OptionsSubState extends MusicBeatSubstate
{
case "Colors":
FlxG.state.closeSubState();
FlxG.state.openSubState(new ColorpickSubstate());
case "Controls":
FlxG.state.closeSubState();
FlxG.state.openSubState(new ControlsSubState());
case "Mods":
FlxG.state.closeSubState();
FlxG.state.openSubState(new ModdingSubstate());
// FlxG.state.openSubState(new ModdingSubstate());
case "Back":
FlxG.switchState(new MainMenuState());
}

View file

@ -329,6 +329,9 @@ class TitleState extends MusicBeatState
skipIntro();
}
if (FlxG.keys.justPressed.SPACE)
swagShader.hasOutline = !swagShader.hasOutline;
if (controls.UI_LEFT)
{
swagShader.update(-elapsed * 0.1);

View file

@ -9,6 +9,9 @@ class ColorSwap
public var colorToReplace(default, set):FlxColor;
public var newColor(default, set):FlxColor;
public var daTime(default, set):Float;
public var hasOutline(default, set):Bool = false;
public var hueShit:Float = 0;
public function new():Void
@ -16,6 +19,7 @@ class ColorSwap
shader = new ColorSwapShader();
shader.uTime.value = [0];
shader.money.value = [0];
shader.awesomeOutline.value = [hasOutline];
}
public function update(elapsed:Float):Void
@ -32,6 +36,12 @@ class ColorSwap
return color;
}
function set_hasOutline(lol:Bool):Bool
{
shader.awesomeOutline.value = [lol];
return lol;
}
function set_daTime(daTime:Float):Float
{
return daTime;
@ -52,10 +62,13 @@ class ColorSwapShader extends FlxShader
uniform float uTime;
uniform float money;
uniform bool awesomeOutline;
const float offset = 1.0 / 128.0;
vec3 normalizeColor(vec3 color)
{
return vec3(
@ -96,6 +109,29 @@ class ColorSwapShader extends FlxShader
// money += swagColor[0];
color = vec4(hsv2rgb(vec3(swagColor[0], swagColor[1], swagColor[2])), swagColor[3]);
if (awesomeOutline)
{
// Outline bullshit?
vec2 size = vec2(3, 3);
if (color.a <= 0.5) {
float w = size.x / openfl_TextureSize.x;
float h = size.y / openfl_TextureSize.y;
if (flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x + w, openfl_TextureCoordv.y)).a != 0.
|| flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x - w, openfl_TextureCoordv.y)).a != 0.
|| flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x, openfl_TextureCoordv.y + h)).a != 0.
|| flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x, openfl_TextureCoordv.y - h)).a != 0.)
color = vec4(1.0, 1.0, 1.0, 1.0);
}
}
gl_FragColor = color;
@ -112,9 +148,7 @@ class ColorSwapShader extends FlxShader
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.8);
else
gl_FragColor = color;
}
*/
} */
}
')

View file

@ -29,10 +29,14 @@ class ColorsMenu extends ui.OptionsState.Page
var _effectSpr:FlxEffectSprite = new FlxEffectSprite(note, [new FlxOutlineEffect(FlxOutlineMode.FAST, FlxColor.WHITE, 4, 1)]);
add(_effectSpr);
_effectSpr.y = 0;
_effectSpr.x = i * 80;
_effectSpr.x = i * 130;
_effectSpr.antialiasing = true;
_effectSpr.setGraphicSize(Std.int(_effectSpr.width * 0.7));
_effectSpr.updateHitbox();
_effectSpr.scale.x = _effectSpr.scale.y = 0.7;
// _effectSpr.setGraphicSize();
_effectSpr.height = note.height;
_effectSpr.width = note.width;
// _effectSpr.updateHitbox();
grpNotes.add(note);
}
@ -40,12 +44,6 @@ class ColorsMenu extends ui.OptionsState.Page
override function update(elapsed:Float)
{
if (controls.BACK)
{
FlxG.state.closeSubState();
FlxG.state.openSubState(new OptionsSubState());
}
if (controls.UI_RIGHT_P)
curSelected += 1;
if (controls.UI_LEFT_P)

View file

@ -1,16 +1,15 @@
package;
package ui;
import Controls.Control;
import flixel.FlxG;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
#if cpp
import polymod.Polymod;
#if desktop
import sys.FileSystem;
#end
class ModdingSubstate extends MusicBeatSubstate
class ModMenu extends ui.OptionsState.Page
{
var grpMods:FlxTypedGroup<ModMenuItem>;
var enabledMods:Array<String> = [];

View file

@ -166,6 +166,10 @@ class OptionsMenu extends Page
add(items = new TextMenuList());
createItem("controls", function() switchPage(Controls));
createItem('colors', function() switchPage(Colors));
#if cpp
createItem('mods', function() switchPage(Mods));
#end
#if CAN_OPEN_LINKS
if (showDonate)
{
@ -263,4 +267,5 @@ enum PageName
Options;
Controls;
Colors;
Mods;
}