Added some more flags
This commit is contained in:
@@ -151,7 +151,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
public static function getDefaultPreprocessors():Map<String, Dynamic> {
|
||||
var defines = funkin.backend.system.macros.DefinesMacro.defines;
|
||||
defines.set("CODENAME_ENGINE", true);
|
||||
defines.set("CODENAME_VER", Application.current.meta.get('version'));
|
||||
defines.set("CODENAME_VER", Flags.VERSION);
|
||||
defines.set("CODENAME_BUILD", 2675); // 2675 being the last build num before it was removed
|
||||
defines.set("CODENAME_COMMIT", Flags.COMMIT_NUMBER);
|
||||
return defines;
|
||||
|
||||
@@ -19,7 +19,8 @@ class CustomShader extends FunkinShader {
|
||||
* @param name Name of the frag and vert files.
|
||||
* @param glslVersion GLSL version to use. Defaults to `120`.
|
||||
*/
|
||||
public function new(name:String, glslVersion:String = "120") {
|
||||
public function new(name:String, glslVersion:String = null) {
|
||||
if (glslVersion == null) glslVersion = Flags.DEFAULT_GLSL_VERSION;
|
||||
var fragShaderPath = Paths.fragShader(name);
|
||||
var vertShaderPath = Paths.vertShader(name);
|
||||
var fragCode = Assets.exists(fragShaderPath) ? Assets.getText(fragShaderPath) : null;
|
||||
|
||||
@@ -26,7 +26,7 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
|
||||
public var onGLUpdate:FlxTypedSignal<Void->Void> = new FlxTypedSignal<Void->Void>();
|
||||
public var onProcessGLData:FlxTypedSignal<(String, String)->Void> = new FlxTypedSignal<(String, String)->Void>();
|
||||
|
||||
public var glslVer:String = "120";
|
||||
public var glslVer:String = Flags.DEFAULT_GLSL_VERSION;
|
||||
public var fileName:String = "FunkinShader";
|
||||
public var fragFileName:String = "FunkinShader";
|
||||
public var vertFileName:String = "FunkinShader";
|
||||
@@ -42,7 +42,8 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
|
||||
* @param vert Vertex source (pass `null` to use default)
|
||||
* @param glslVer Version of GLSL to use (defaults to 120)
|
||||
*/
|
||||
public override function new(frag:String, vert:String, glslVer:String = "120") {
|
||||
public override function new(frag:String, vert:String, glslVer:String = null) {
|
||||
if (glslVer == null) glslVer = Flags.DEFAULT_GLSL_VERSION;
|
||||
if (frag == null) frag = ShaderTemplates.defaultFragmentSource;
|
||||
if (vert == null) vert = ShaderTemplates.defaultVertexSource;
|
||||
this.glFragmentSource = frag;
|
||||
|
||||
@@ -64,6 +64,8 @@ class CommandLineHandler {
|
||||
Main.noCwdFix = true;
|
||||
case "-livereload":
|
||||
// do nothing
|
||||
case "-verbose":
|
||||
// do nothing
|
||||
default:
|
||||
Sys.println("Unknown command");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,11 @@ class Flags {
|
||||
public static var COMMIT_NUMBER:Int = GitCommitMacro.commitNumber;
|
||||
public static var COMMIT_HASH:String = GitCommitMacro.commitHash;
|
||||
public static var COMMIT_MESSAGE:String = 'Commit $COMMIT_NUMBER ($COMMIT_HASH)';
|
||||
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v${Application.current.meta.get('version')}';
|
||||
|
||||
@:lazy public static var TITLE:String = Application.current.meta.get('title');
|
||||
@:lazy public static var VERSION:String = Application.current.meta.get('version');
|
||||
|
||||
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v$VERSION';
|
||||
|
||||
public static var REPO_NAME:String = "CodenameEngine";
|
||||
public static var REPO_OWNER:String = "CodenameCrew";
|
||||
@@ -142,6 +146,14 @@ class Flags {
|
||||
public static var DEFAULT_PAUSE_SCRIPT:String = "";
|
||||
@:also(funkin.game.GameOverSubstate.script)
|
||||
public static var DEFAULT_GAMEOVER_SCRIPT:String = "";
|
||||
|
||||
public static var URL_WIKI:String = "https://codename-engine.com/";
|
||||
public static var URL_EDITOR_FALLBACK:String = "https://www.youtube.com/watch?v=9Youam7GYdQ";
|
||||
public static var URL_FNF_ITCH:String = "https://ninja-muffin24.itch.io/funkin";
|
||||
|
||||
public static var DEFAULT_GLSL_VERSION:String = "120";
|
||||
@:also(funkin.backend.utils.HttpUtil.userAgent)
|
||||
public static var USER_AGENT:String = 'request';
|
||||
// -- End of Codename's Default Flags --
|
||||
|
||||
/**
|
||||
|
||||
@@ -174,8 +174,6 @@ class Main extends Sprite
|
||||
}
|
||||
|
||||
public static function refreshAssets() @:privateAccess {
|
||||
WindowUtils.resetTitle();
|
||||
|
||||
var game = FlxG.game;
|
||||
var daSndTray = Type.createInstance(game._customSoundTray = funkin.menus.ui.FunkinSoundTray, []);
|
||||
var index:Int = game.numChildren - 1;
|
||||
|
||||
@@ -59,6 +59,7 @@ class MainState extends FlxState {
|
||||
Flags.load();
|
||||
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx
|
||||
MusicBeatTransition.script = Flags.DEFAULT_TRANSITION_SCRIPT;
|
||||
WindowUtils.resetTitle();
|
||||
Main.refreshAssets();
|
||||
DiscordUtil.init();
|
||||
EventsData.reloadEvents();
|
||||
|
||||
@@ -21,7 +21,7 @@ class MemoryCounter extends Sprite {
|
||||
label.autoSize = LEFT;
|
||||
label.x = 0;
|
||||
label.y = 0;
|
||||
label.text = "FPS";
|
||||
label.text = "MEM";
|
||||
label.multiline = label.wordWrap = false;
|
||||
label.defaultTextFormat = new TextFormat(Framerate.fontName, 12, -1);
|
||||
label.selectable = false;
|
||||
|
||||
@@ -29,6 +29,14 @@ class GitCommitMacro {
|
||||
* Returns the current commit date + time
|
||||
**/
|
||||
public static var commitDate(get, never):Date;
|
||||
/**
|
||||
* Returns the current branch name
|
||||
**/
|
||||
public static var currentBranch(get, never):String;
|
||||
/**
|
||||
* Returns if there are uncommitted changes
|
||||
**/
|
||||
public static var hasUncommittedChanges(get, never):Bool;
|
||||
|
||||
// GETTERS
|
||||
#if REGION
|
||||
@@ -46,6 +54,11 @@ class GitCommitMacro {
|
||||
return __getCommitAuthor();
|
||||
private static inline function get_commitDate()
|
||||
return __getCommitDate();
|
||||
|
||||
private static inline function get_currentBranch()
|
||||
return __getCurrentBranch();
|
||||
private static inline function get_hasUncommittedChanges()
|
||||
return __getHasUncommittedChanges();
|
||||
#end
|
||||
|
||||
// INTERNAL MACROS
|
||||
@@ -149,5 +162,35 @@ class GitCommitMacro {
|
||||
return macro Date.fromString("1970-01-01T00:00:00"); // failed to parse date
|
||||
#end
|
||||
}
|
||||
|
||||
private static macro function __getCurrentBranch() {
|
||||
#if display
|
||||
return macro $v{"-"};
|
||||
#else
|
||||
try {
|
||||
var process = new Process("git", ["rev-parse", "--abbrev-ref", "HEAD"], false);
|
||||
if (process.exitCode() != 0)
|
||||
throw 'Could not fetch current branch';
|
||||
|
||||
return macro $v{process.stdout.readLine().toString()};
|
||||
} catch(e) {}
|
||||
return macro $v{"-"}
|
||||
#end
|
||||
}
|
||||
|
||||
private static macro function __getHasUncommittedChanges() {
|
||||
#if display
|
||||
return macro $v{false};
|
||||
#else
|
||||
try {
|
||||
var process = new Process("git", ["status", "--porcelain"], false);
|
||||
if (process.exitCode() != 0)
|
||||
throw 'Could not fetch current branch';
|
||||
|
||||
return macro $v{process.stdout.readLine().toString() != ""};
|
||||
} catch(e) {}
|
||||
return macro $v{false}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -151,7 +151,4 @@ class HashLinkFixer {
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
#else
|
||||
class HashLinkFixer {
|
||||
}
|
||||
#end
|
||||
@@ -9,9 +9,6 @@ import sys.FileSystem;
|
||||
using funkin.backend.system.github.GitHub;
|
||||
|
||||
class UpdateUtil {
|
||||
public static final repoOwner:String = "YoshiCrafter29";
|
||||
public static final repoName:String = "CodenameTestRepo";
|
||||
|
||||
public static function init() {
|
||||
// deletes old bak file if it exists
|
||||
#if sys
|
||||
@@ -22,12 +19,12 @@ class UpdateUtil {
|
||||
}
|
||||
|
||||
public static function checkForUpdates():UpdateCheckCallback {
|
||||
var curTag = 'v${Application.current.meta.get('version')}';
|
||||
var curTag = 'v${Flags.VERSION}';
|
||||
trace(curTag);
|
||||
|
||||
var error = false;
|
||||
|
||||
var newUpdates = __doReleaseFiltering(GitHub.getReleases(repoOwner, repoName, function(e) {
|
||||
var newUpdates = __doReleaseFiltering(GitHub.getReleases(Flags.REPO_NAME, Flags.REPO_OWNER, function(e) {
|
||||
error = true;
|
||||
}), curTag);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import haxe.Http;
|
||||
|
||||
class HttpUtil
|
||||
{
|
||||
public static var userAgent:String = "request";
|
||||
public static var userAgent:String = Flags.USER_AGENT;
|
||||
public static function requestText(url:String)
|
||||
{
|
||||
var r = null;
|
||||
|
||||
@@ -45,7 +45,7 @@ class WindowUtils {
|
||||
* Resets the window title to the application name and resets the prefix and suffix.
|
||||
**/
|
||||
public static inline function resetTitle() {
|
||||
title = Lib.application.meta["name"];
|
||||
title = Flags.TITLE;
|
||||
resetAffixes();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class EditorPicker extends MusicBeatSubstate {
|
||||
id: "wiki",
|
||||
state: null,
|
||||
onClick: function() {
|
||||
CoolUtil.openURL("https://codename-engine.com/");
|
||||
CoolUtil.openURL(Flags.URL_WIKI);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -124,7 +124,7 @@ class EditorPicker extends MusicBeatSubstate {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
CoolUtil.openURL("https://www.youtube.com/watch?v=9Youam7GYdQ");
|
||||
CoolUtil.openURL(Flags.URL_EDITOR_FALLBACK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class CreditsMain extends TreeMenu {
|
||||
optionsTree.add(Type.createInstance(CreditsCodename, []));
|
||||
}));
|
||||
items.push(new TextOption("Friday Night Funkin'", "Select this to open the itch.io page of the original game to donate!", function() {
|
||||
CoolUtil.openURL("https://ninja-muffin24.itch.io/funkin");
|
||||
CoolUtil.openURL(Flags.URL_FNF_ITCH);
|
||||
}));
|
||||
|
||||
main = new OptionsScreen('Credits', 'The people who made this possible!', items);
|
||||
|
||||
Reference in New Issue
Block a user