potential hashlink + neko support
This commit is contained in:
+15
-6
@@ -99,7 +99,17 @@
|
||||
<define name="ALLOW_MULTITASKING" />
|
||||
|
||||
<!-- Comment this out to disable updates !-->
|
||||
<define name="UPDATE_CHECKING" />
|
||||
<define name="UPDATE_CHECKING" unless="web || hl || neko"/>
|
||||
|
||||
<!-- Comment this out to disable Discord RPC !-->
|
||||
<define name="DISCORD_RPC" unless="web || hl || neko"/>
|
||||
|
||||
<!-- Comment this out to disable GitHub API integration !-->
|
||||
<define name="GITHUB_API" unless="web || hl"/>
|
||||
|
||||
<!-- Comment this off to prevent additional classes from being compiled.
|
||||
Reduces compilation time at the cost of limited HScript flexibility. !-->
|
||||
<define name="COMPILE_ALL_CLASSES" />
|
||||
|
||||
<!-- Comment this out to disable titlescreen.xml !-->
|
||||
<haxedef name="TITLESCREEN_XML" />
|
||||
@@ -120,11 +130,12 @@
|
||||
<haxedef name="USE_ADAPTED_ASSETS" />
|
||||
|
||||
<!-- Comment this out to disable video cutscene support, in case of compilation errors. !-->
|
||||
<define name="VIDEO_CUTSCENES" unless="web || linux" />
|
||||
<define name="VIDEO_CUTSCENES" unless="web || linux || hl" />
|
||||
|
||||
|
||||
<haxedef name="VIDEO_CUTSCENES" if="VIDEO_CUTSCENES" />
|
||||
<haxedef name="UPDATE_CHECKING" if="UPDATE_CHECKING" />
|
||||
<haxedef name="DISCORD_RPC" if="DISCORD_RPC" />
|
||||
<haxeflag name="--macro" value="funkin.macros.StdDeprecationsRemover.init()" />
|
||||
<!-- _______________________________ Libraries ______________________________ -->
|
||||
|
||||
@@ -136,7 +147,7 @@
|
||||
<haxedev set='webgl' />
|
||||
|
||||
<haxelib name="hscript-improved" />
|
||||
<haxelib name="linc_discord-rpc" if="desktop"/>
|
||||
<haxelib name="linc_discord-rpc" if="DISCORD_RPC"/>
|
||||
|
||||
<haxelib name="markdown" />
|
||||
|
||||
@@ -144,9 +155,7 @@
|
||||
|
||||
<!-- _________________________________ HScript classes _______________________________ -->
|
||||
|
||||
<!-- Comment this off to prevent additional classes from being compiled.
|
||||
Reduces compilation time at the cost of limited HScript flexibility. !-->
|
||||
<define name="COMPILE_ALL_CLASSES" />
|
||||
|
||||
|
||||
<section if="COMPILE_ALL_CLASSES">
|
||||
<haxeflag name="-dce" value="no" />
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1791
|
||||
1793
|
||||
@@ -26,6 +26,8 @@ class CharacterEditor extends WindowContent {
|
||||
* ANIMATION TAB
|
||||
*/
|
||||
public var animsDropDown:DropDown;
|
||||
public var animNameInput:InputBox;
|
||||
public var animPrefixInput:InputBox;
|
||||
|
||||
public override function create() {
|
||||
super.create();
|
||||
@@ -77,15 +79,37 @@ class CharacterEditor extends WindowContent {
|
||||
|
||||
var labels:Array<WindowText> = [];
|
||||
var label:WindowText = null;
|
||||
|
||||
labels.push(label = new WindowText(10, 10, 0, "Animations"));
|
||||
animsDropDown = new DropDown(10, label.y + label.height, [], function(id) {
|
||||
char.playAnim(animList[id].name, true);
|
||||
animsDropDown = new DropDown(10, label.y + label.height, 380, [], function(id) {
|
||||
changeAnim(id);
|
||||
});
|
||||
|
||||
labels.push(label = new WindowText(10, animsDropDown.y + animsDropDown.height + 10, 0, "Animation Name"));
|
||||
refreshAnims();
|
||||
animNameInput = new InputBox(10, label.y + label.height, 380, "");
|
||||
|
||||
labels.push(label = new WindowText(10, animNameInput.y + animNameInput.height + 10, 0, "Animation Prefix"));
|
||||
animPrefixInput = new InputBox(10, label.y + label.height, 380, "");
|
||||
|
||||
// labels.push(label = new WindowText(10, animNameInput.y + animNameInput.height + 10, 0, "Animation Prefix"));
|
||||
// animPrefixInput = new InputBox(10, label.y + label.height, 380, "");
|
||||
|
||||
for(spr in [animsDropDown])
|
||||
for(l in labels)
|
||||
tabView.tabs[0].add(l);
|
||||
|
||||
for(spr in [animsDropDown, animNameInput, ])
|
||||
tabView.tabs[0].add(spr);
|
||||
|
||||
refreshAnims();
|
||||
}
|
||||
|
||||
public function changeAnim(id:Int) {
|
||||
var anim = animList[id];
|
||||
if (anim == null) return;
|
||||
char.playAnim(anim.name, true);
|
||||
|
||||
animNameInput.text = anim.name;
|
||||
animPrefixInput.text = anim.name;
|
||||
}
|
||||
|
||||
public function refreshAnims() {
|
||||
|
||||
@@ -8,7 +8,7 @@ class DropDown extends Button {
|
||||
public var onChange:Int->Void;
|
||||
public var options:Array<String>;
|
||||
|
||||
public function new(x:Float, y:Float, options:Array<String>, onChange:Int->Void, curId:Int = 0, ?normalButton:ThemeData, ?hoverButton:ThemeData, ?pressedButton:ThemeData, ?disabledButton:ThemeData) {
|
||||
public function new(x:Float, y:Float, w:Float, options:Array<String>, onChange:Int->Void, curId:Int = 0, ?normalButton:ThemeData, ?hoverButton:ThemeData, ?pressedButton:ThemeData, ?disabledButton:ThemeData) {
|
||||
super(x, y, "", onClick, normalButton, hoverButton, pressedButton, disabledButton);
|
||||
this.options = options;
|
||||
onSelectionChange(curId);
|
||||
|
||||
@@ -9,7 +9,15 @@ import lime.app.Application;
|
||||
class InputBox extends Button {
|
||||
public var index:Int = 0;
|
||||
|
||||
public function new(x:Float, y:Float, w:Float, t:String, onChange:Void->Void) {
|
||||
public var text(get, set):String;
|
||||
private inline function set_text(t:String):String
|
||||
return label.text = t;
|
||||
private inline function get_text():String
|
||||
return label.text;
|
||||
|
||||
public var onChange:Void->Void;
|
||||
|
||||
public function new(x:Float, y:Float, w:Float, t:String, ?onChange:Void->Void) {
|
||||
super(x, y, t, function() {
|
||||
setIndex(label.text.length);
|
||||
});
|
||||
@@ -19,26 +27,41 @@ class InputBox extends Button {
|
||||
Application.current.window.onTextInput.add(onTextInput);
|
||||
}
|
||||
|
||||
|
||||
private function onKeyDown(event:KeyboardEvent) {
|
||||
if (!this.hasFocus()) return;
|
||||
switch(event.keyCode) {
|
||||
case Keyboard.CONTROL | Keyboard.SHIFT:
|
||||
// nothing
|
||||
case Keyboard.ESCAPE:
|
||||
this.loseFocus();
|
||||
case Keyboard.LEFT:
|
||||
changeIndex(-1);
|
||||
case Keyboard.RIGHT:
|
||||
changeIndex(1);
|
||||
case Keyboard.HOME:
|
||||
setIndex(0);
|
||||
case Keyboard.END:
|
||||
setIndex(text.length);
|
||||
case Keyboard.DELETE:
|
||||
text = text.substr(0, index) + text.substring(index + 1, text.length);
|
||||
onTextInput("");
|
||||
case Keyboard.BACKSPACE:
|
||||
text = text.substr(0, index - 1) + text.substring(index, text.length);
|
||||
index--;
|
||||
onTextInput("");
|
||||
case Keyboard.ENTER | Keyboard.NUMPAD_ENTER:
|
||||
onTextInput("\n");
|
||||
default:
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
private function onTextInput(input:String) {
|
||||
if (!this.hasFocus()) return;
|
||||
|
||||
|
||||
text = text.substr(0, index) + input + text.substring(index, text.length);
|
||||
|
||||
if (onChange != null)
|
||||
onChange();
|
||||
}
|
||||
|
||||
public inline function changeIndex(change:Int) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import flixel.group.FlxSpriteGroup;
|
||||
import funkin.options.Options;
|
||||
import funkin.scripting.Script;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
#end
|
||||
import funkin.system.Section.SwagSection;
|
||||
@@ -423,7 +423,7 @@ class PlayState extends MusicBeatState
|
||||
new ComboRating(1, "S++", 0xFF44FFFF),
|
||||
];
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
// Discord RPC variables
|
||||
public var difficultyText:String = "";
|
||||
public var iconRPC:String = "";
|
||||
@@ -469,7 +469,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
Conductor.setupSong(SONG);
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
// TODO: Scriptable custom RPC
|
||||
iconRPC = (dad != null && dad.icon != null) ? dad.icon : SONG.player2;
|
||||
|
||||
@@ -992,7 +992,7 @@ class PlayState extends MusicBeatState
|
||||
startTimer.active = true;
|
||||
paused = false;
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
if (startTimer.finished)
|
||||
{
|
||||
DiscordClient.changePresence(detailsText, SONG.song + " (" + difficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
|
||||
@@ -1012,7 +1012,7 @@ class PlayState extends MusicBeatState
|
||||
override public function onFocus():Void
|
||||
{
|
||||
scripts.call("onFocus");
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
if (health > 0 && !paused)
|
||||
{
|
||||
if (Conductor.songPosition > 0.0)
|
||||
@@ -1036,7 +1036,7 @@ class PlayState extends MusicBeatState
|
||||
override public function onFocusLost():Void
|
||||
{
|
||||
scripts.call("onFocusLost");
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
if (health > 0 && !paused)
|
||||
{
|
||||
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + difficultyText + ")", iconRPC);
|
||||
@@ -1091,7 +1091,7 @@ class PlayState extends MusicBeatState
|
||||
// TODO: Update Discord Status
|
||||
public function updateDiscordStatus() {
|
||||
// TODO: Cancellable Discord Update Presence
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
// Song duration in a float, useful for the time left feature
|
||||
songLength = inst.length;
|
||||
|
||||
@@ -1130,7 +1130,7 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
FlxG.switchState(new ChartingState());
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
DiscordClient.changePresence("Chart Editor", null, null, true);
|
||||
#end
|
||||
}
|
||||
@@ -1309,7 +1309,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
openSubState(new GameOverSubstate(boyfriend.x, boyfriend.y, character, gameOverSong, lossSFX, retrySFX));
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
// Game Over doesn't get his own variable because it's only used here
|
||||
DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + difficultyText + ")", iconRPC);
|
||||
#end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.github;
|
||||
|
||||
#if GITHUB_API
|
||||
import haxe.Json;
|
||||
import haxe.Exception;
|
||||
import haxe.Http;
|
||||
@@ -89,4 +90,45 @@ class GitHub {
|
||||
url = Reflect.field(obj, "documentation_url");
|
||||
return new GitHubException(msg, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
import haxe.Json;
|
||||
import haxe.Exception;
|
||||
|
||||
class GitHub {
|
||||
/**
|
||||
* Gets all the releases from a specific GitHub repository using the GitHub API.
|
||||
* @param user
|
||||
* @param repository
|
||||
* @return Releases
|
||||
*/
|
||||
public static function getReleases(user:String, repository:String, ?onError:Exception->Void):Array<GitHubRelease> {
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function getContributors(user:String, repository:String, ?onError:Exception->Void):Array<GitHubContributor> {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters all releases gotten by `getReleases`
|
||||
* @param releases Releases
|
||||
* @param keepPrereleases Whenever to keep Pre-Releases.
|
||||
* @param keepDrafts Whenever to keep Drafts.
|
||||
* @return Filtered releases.
|
||||
*/
|
||||
public static inline function filterReleases(releases:Array<GitHubRelease>, keepPrereleases:Bool = true, keepDrafts:Bool = false)
|
||||
return releases;
|
||||
|
||||
public static function __requestOnGitHubServers(url:String) {
|
||||
return null;
|
||||
}
|
||||
public static function __requestBytesOnGitHubServers(url:String) {
|
||||
return null;
|
||||
}
|
||||
private static function __parseGitHubException(obj:Dynamic):GitHubException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#end
|
||||
@@ -1,7 +1,7 @@
|
||||
package funkin.menus;
|
||||
|
||||
import haxe.io.Path;
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
#end
|
||||
import flash.text.TextField;
|
||||
@@ -62,7 +62,7 @@ class FreeplayState extends MusicBeatState
|
||||
songList = FreeplaySonglist.get();
|
||||
songs = songList.songs;
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
// Updating Discord Rich Presence
|
||||
DiscordClient.changePresence("In the Menus", null);
|
||||
#end
|
||||
|
||||
@@ -2,7 +2,7 @@ package funkin.menus;
|
||||
|
||||
import funkin.ui.FunkinText;
|
||||
import funkin.options.Options;
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
#end
|
||||
import flixel.FlxG;
|
||||
@@ -43,7 +43,7 @@ class MainMenuState extends MusicBeatState
|
||||
{
|
||||
super.create();
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
// Updating Discord Rich Presence
|
||||
DiscordClient.changePresence("In the Menus", null);
|
||||
#end
|
||||
|
||||
@@ -10,7 +10,6 @@ import lime.app.Future;
|
||||
import lime.app.Promise;
|
||||
import lime.media.AudioBuffer;
|
||||
import lime.graphics.Image;
|
||||
import lime.net.HTTPRequest;
|
||||
import lime.text.Font;
|
||||
import lime.utils.AssetType;
|
||||
import lime.utils.Bytes;
|
||||
|
||||
@@ -10,7 +10,6 @@ import lime.app.Future;
|
||||
import lime.app.Promise;
|
||||
import lime.media.AudioBuffer;
|
||||
import lime.graphics.Image;
|
||||
import lime.net.HTTPRequest;
|
||||
import lime.text.Font;
|
||||
import lime.utils.AssetType;
|
||||
import lime.utils.Bytes;
|
||||
|
||||
@@ -85,6 +85,8 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
"CODENAME_BUILD" => funkin.macros.BuildCounterMacro.getBuildNumber(),
|
||||
"desktop" => #if desktop true #else false #end,
|
||||
"windows" => #if windows true #else false #end,
|
||||
"hl" => #if hl true #else false #end,
|
||||
"neko" => #if neko true #else false #end,
|
||||
"linux" => #if linux true #else false #end,
|
||||
"macos" => #if macos true #else false #end,
|
||||
"android" => #if android true #else false #end,
|
||||
|
||||
@@ -23,13 +23,13 @@ import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
|
||||
import flixel.addons.transition.TransitionData;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.math.FlxRect;
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
import sys.thread.Thread;
|
||||
#end
|
||||
import lime.app.Application;
|
||||
|
||||
#if sys
|
||||
import sys.thread.Thread;
|
||||
import sys.io.File;
|
||||
#end
|
||||
// TODO: REMOVE TEST
|
||||
@@ -188,7 +188,7 @@ class Main extends Sprite
|
||||
WindowsAPI.setDarkMode(true);
|
||||
|
||||
|
||||
#if desktop
|
||||
#if DISCORD_RPC
|
||||
DiscordClient.initialize();
|
||||
|
||||
Application.current.onExit.add (function (exitCode) {
|
||||
|
||||
Reference in New Issue
Block a user