Skip to content

Commit

Permalink
experimental character selection screen
Browse files Browse the repository at this point in the history
also did a few other minor changes here, and i gave angy fox some dialogue cuz

yes.
  • Loading branch information
CharlesCatYT committed Feb 15, 2024
1 parent 34e9877 commit 179fc61
Show file tree
Hide file tree
Showing 49 changed files with 24,113 additions and 930 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Build Game
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [main, experimental, in-the-morning]
branches: [main, experimental, character-selector]
pull_request:
branches: [main, experimental, in-the-morning]
branches: [main, experimental, character-selector]

# For release builds
workflow_call:
Expand Down
Binary file added assets/shared/images/charSelectGuide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shared/images/credits/altertoriel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions cmd/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package;

import commands.*;

class Main {
public static var commands:Array<Command> = [];

public static function initCommands() {
commands = [
{
names: ["setup"],
doc: "Setups (or updates) all libraries required for the engine/mod.",
func: Update.main,
dDoc: "This command runs through all libraries in hmm.json, and install them.\nIf they're already installed, they will be updated."
},
{
names: ["help", null],
doc: "Shows help. Pass a command name to get additional help.",
func: help,
dDoc: "Usage: help <cmd>\n\nFor example, use \"foxa help test\" to get additional help on the test command."
},
{
names: ["test"],
doc: "Creates a non final test build, then runs it.",
func: Compiler.test,
dDoc: "Usage: test <optional args>\n" +
"\nThis will create a quick debug build binded to the source then run it, which means:" +
"\n- The assets WON'T be copied over - Assets will be read from the game's source." +
"\n- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets." +
"\n- This build will also use the mods folder from the source directory." +
"\n\nIf you want a full build which contains all assets, run \"foxa release\" or \"foxa test-release\"." +
"\nAdditional arguments will be sent to the Lime compiler."
},
{
names: ["build"],
doc: "Creates a non final test build, without running it.",
func: Compiler.build,
dDoc: "Usage: build <optional arguments>\n" +
"\nThis will create a quick debug build binded to the source then run it, which means:" +
"\n- The assets WON'T be copied over - Assets will be read from the game's source." +
"\n- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets." +
"\n- This build will also use the mods folder from the source directory." +
"\n\nIf you want a full build which contains all assets, run \"foxa release\" or \"foxa test-release\"." +
"\nAdditional arguments will be sent to the Lime compiler."
},
{
names: ["release"],
doc: "Creates a final non debug build, containing all assets.",
func: Compiler.release,
dDoc: "Usage: release <optional arguments>\n" +
"\nThis will create a final ready-for-release build, which means this build will be able to be release on websites such as GameBanana without worrying about source-dependant stuff."
},
{
names: ["test-release"],
doc: "Creates a final non debug build, containing all assets.",
func: Compiler.testRelease,
dDoc: "Usage: release <optional arguments>\n" +
"\nThis will create and run a final ready-for-release build, which means this build will be able to be release on websites such as GameBanana without worrying about source-dependant stuff."
}
];
}

public static function main() {
initCommands();
var args = Sys.args();
var commandName = args.shift();
if (commandName != null)
commandName = commandName.toLowerCase();
for(c in commands) {
if (c.names.contains(commandName)) {
c.func(args);
return;
}
}
}

public static function help(args:Array<String>) {
var cmdName = args.shift();
if (cmdName != null) {
cmdName = cmdName.toLowerCase();

var matchingCommand = null;
for(c in commands) if (c.names.contains(cmdName)) {
matchingCommand = c;
break;
}

if (matchingCommand == null) {
Sys.println('help - Command named ${cmdName} not found.');
return;
}

Sys.println('${matchingCommand.names.join(", ")}');
Sys.println("---");
Sys.println(matchingCommand.dDoc);

return;
}
// shows help
Sys.println("Vs.Foxa / Alleyway Engine Command Line utility");
Sys.println('Available commands (${commands.length}):\n');
for(line in commands) {
Sys.println('${line.names.join(", ")} - ${line.doc}');
}
}
}

typedef Command = {
var names:Array<String>;
var func:Array<String>->Void;
var ?doc:String;
var ?dDoc:String;
}
39 changes: 39 additions & 0 deletions cmd/commands/Compiler.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package commands;

class Compiler {
public static function test(args:Array<String>) {
__build(args, ["test", getBuildTarget(), "-D", "TEST_BUILD"]);
}
public static function build(args:Array<String>) {
__build(args, ["build", getBuildTarget(), "-D", "TEST_BUILD"]);
}
public static function release(args:Array<String>) {
__build(args, ["build", getBuildTarget()]);
}
public static function testRelease(args:Array<String>) {
__build(args, ["test", getBuildTarget()]);
}

private static function __build(args:Array<String>, arg:Array<String>) {
for(a in args)
arg.push(a);
Sys.command("lime", arg);
}

private static function getBuildTarget() {
return switch(Sys.systemName()) {
case "Windows":
"windows";
case "MacOS":
"macos";
case "Mac":
"mac";
case "Android":
"android";
case "Linux":
"linux";
case def:
def.toLowerCase();
}
}
}
72 changes: 72 additions & 0 deletions cmd/commands/Update.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package commands;

import haxe.Json;
import sys.io.File;
import sys.io.Process;
import sys.FileSystem;

class Update {
public static function main(args:Array<String>) {
prettyPrint("Preparing installation...");

// to prevent messing with currently installed libs
if (!FileSystem.exists('.haxelib'))
FileSystem.createDirectory('.haxelib');

// brief explanation: first we parse a json containing the library names, data, and such
final libs:Array<Library> = Json.parse(File.getContent('./hmm.json')).dependencies;

// now we loop through the data we currently have
for (data in libs) {
// and install the libraries, based on their type
switch (data.type) {
case "install", "haxelib": // for libraries only available in the haxe package manager
var version:String = data.version == null ? "" : data.version;
prettyPrint("Installing library...");
Sys.command('haxelib --quiet install ${data.name} ${version}');
case "git": // for libraries that contain git repositories
var ref:String = data.ref == null ? "" : data.ref;
prettyPrint("Installing library from GitHub...");
Sys.command('haxelib --quiet git ${data.name} ${data.url} ${data.ref}');
default: // and finally, throw an error if the library has no type
Sys.println('[FOXA ERROR!]: Unable to resolve library of type "${data.type}" for library "${data.name}"');
}
}

var proc = new Process('haxe --version');
proc.exitCode(true);
var haxeVer = proc.stdout.readLine();
if (haxeVer != "4.2.5") {
// check for outdated haxe
var curHaxeVer = [for(v in haxeVer.split(".")) Std.parseInt(v)];
var requiredHaxeVer = [4, 2, 5];
for(i in 0...requiredHaxeVer.length) {
if (curHaxeVer[i] < requiredHaxeVer[i]) {
prettyPrint("!! WARNING !!");
Sys.println("Your current Haxe version is outdated.");
Sys.println('You\'re using ${haxeVer}, while the required version is 4.2.5.');
Sys.println('The engine may not compile with your current version of Haxe.');
Sys.println('So, we recommend upgrading to 4.2.5.');
break;
} else if (curHaxeVer[i] > requiredHaxeVer[i]) {
prettyPrint("!! WARNING !!"
+ "\nHaxeFlixel has incompability issues with the latest version of Haxe, 4.3.0 and above, due to macros."
+ "\nProceeding will cause compilation issues related to macros. (ex: cannot access flash package in macro)");
Sys.println('');
Sys.println('We recommend downgrading back to 4.2.5.');
break;
}
}
}
}

public static function prettyPrint(text:String) {
var header = "══════";
for(i in 0...(text.length-(text.lastIndexOf("\n")+1)))
header += "";
Sys.println("");
Sys.println('$header');
Sys.println('$text');
Sys.println('$header');
}
}
1 change: 1 addition & 0 deletions cmd/warning.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
THIS COMMAND LINE UTILITY IS EXPRIMENTAL, SOME THINGS MAY BUG OUT!
Loading

0 comments on commit 179fc61

Please sign in to comment.