generated from ShadowMario/FNF-PsychEngine
-
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
Showing
12 changed files
with
406 additions
and
280 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,45 @@ | ||
package funkin.backend; | ||
|
||
@:access(funkin.backend.system.MusicBeatState) | ||
class ShaderBackend extends flixel.system.FlxAssets.FlxShader | ||
{ // all shaders to be added to dis thing | ||
public function new() | ||
/** | ||
* All non runtime shaders should extend from this abstract class. | ||
*/ | ||
@:access(funkin.backend.system.MusicBeatState._shaderGroup) | ||
abstract class ShaderBackend extends flixel.system.FlxAssets.FlxShader | ||
{ | ||
/** | ||
* Constructor function. | ||
*/ | ||
public function new():Void | ||
{ | ||
/** | ||
* Call the parent constructor | ||
*/ | ||
super(); | ||
|
||
if (cast FlxG.state is MusicBeatState) | ||
/** | ||
* Check if the current state is an instance of MusicBeatState | ||
*/ | ||
if (Std.is(flixel.FlxG.state, MusicBeatState)) | ||
{ | ||
final state:Dynamic = FlxG.state; | ||
if(state.shaderGroup == null) | ||
state.shaderGroup = []; | ||
trace('pushed shader'); | ||
state.shaderGroup.push(this); | ||
/** | ||
* Grabs the current state from `FlxG.state`. | ||
*/ | ||
final currentState:MusicBeatState = cast(flixel.FlxG.state, MusicBeatState); | ||
|
||
/** | ||
* If `_shaderGroup` equals null set it to `[]`. | ||
*/ | ||
currentState._shaderGroup ??= []; | ||
|
||
/** | ||
* Pushes `this` to `_shadeGroup`. | ||
*/ | ||
currentState._shaderGroup.push(this); | ||
} | ||
} | ||
|
||
private function update(elapsed:Float):Void{} | ||
/** | ||
* Update function. | ||
*/ | ||
@:dox(hide) function update(elapsed:Float):Void {} | ||
} |
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
76 changes: 76 additions & 0 deletions
76
source/funkin/backend/objects/editers/FileReferenceCustom.hx
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,76 @@ | ||
package funkin.backend.objects.editers; | ||
|
||
import lime.ui.FileDialog; | ||
import openfl.net.FileFilter; | ||
import lime.ui.FileDialogType; | ||
import openfl.net.FileReference; | ||
|
||
//Only way I could find to keep the path after saving a file | ||
class FileReferenceCustom extends FileReference | ||
{ | ||
@:allow(backend.FileDialogHandler) | ||
var _trackSavedPath:String; | ||
override function saveFileDialog_onSelect(path:String):Void | ||
{ | ||
_trackSavedPath = path; | ||
super.saveFileDialog_onSelect(path); | ||
} | ||
|
||
public function browseEx(browseType:FileDialogType = OPEN, ?defaultName:String, ?title:String = null, ?typeFilter:Array<FileFilter> = null):Bool | ||
{ | ||
__data = null; | ||
__path = null; | ||
|
||
#if desktop | ||
var filter = null; | ||
|
||
if (typeFilter != null) | ||
{ | ||
var filters = []; | ||
|
||
for (type in typeFilter) | ||
{ | ||
filters.push(StringTools.replace(StringTools.replace(type.extension, "*.", ""), ";", ",")); | ||
} | ||
|
||
filter = filters.join(";"); | ||
} | ||
|
||
var openFileDialog = new FileDialog(); | ||
openFileDialog.onCancel.add(openFileDialog_onCancel); | ||
openFileDialog.onSelect.add(openFileDialog_onSelect); | ||
openFileDialog.browse(browseType, filter, defaultName, title); | ||
return true; | ||
#elseif (js && html5) | ||
var filter = null; | ||
if (typeFilter != null) | ||
{ | ||
var filters = []; | ||
for (type in typeFilter) | ||
{ | ||
filters.push(StringTools.replace(StringTools.replace(type.extension, "*.", "."), ";", ",")); | ||
} | ||
filter = filters.join(","); | ||
} | ||
if (filter != null) | ||
{ | ||
__inputControl.setAttribute("accept", filter); | ||
} | ||
__inputControl.onchange = function() | ||
{ | ||
var file = __inputControl.files[0]; | ||
modificationDate = Date.fromTime(file.lastModified); | ||
creationDate = modificationDate; | ||
size = file.size; | ||
type = "." + Path.extension(file.name); | ||
name = Path.withoutDirectory(file.name); | ||
__path = file.name; | ||
dispatchEvent(new Event(Event.SELECT)); | ||
} | ||
__inputControl.click(); | ||
return true; | ||
#end | ||
|
||
return false; | ||
} | ||
} |
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.