Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8 from bgempire/gui-panel
Browse files Browse the repository at this point in the history
Gui panel
  • Loading branch information
joelgomes1994 authored Apr 3, 2022
2 parents 49f5734 + 8cb6ef7 commit 3cc713a
Show file tree
Hide file tree
Showing 85 changed files with 2,976 additions and 1,183 deletions.
23 changes: 16 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
__pycache__
*.py[cod]
*$py.class
*.ini

# Generated files
/BGArmor Panel*
.idea
.vscode
*.sav
/BGArmor*
/*.o
/source/*.o
/data.dat
/launcher/launcher.py
/source/tools/Windows/ResourceHacker.ini
/source/launcher/target
/bin
/release/tools/Windows/ResourceHacker.ini
/source/launcher/target

# Godot-specific ignores
.import/

# Imported translations (automatically generated from CSV files)
*.translation

# Mono-specific ignores
.mono/
data_*/
26 changes: 0 additions & 26 deletions Makefile

This file was deleted.

146 changes: 146 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import sys
import os
import subprocess
import shutil
import fnmatch
from pathlib import Path


curDir = Path(__file__).parent.absolute()
pythonExecutable = Path(sys.executable).absolute()


def main():
# type: () -> None

os.chdir(curDir.as_posix())

if sys.argv[-1] in operators.keys():
operators[sys.argv[-1]]()

else:
print("X Invalid command:", sys.argv[-1])
print("Available commands:", ", ".join([i for i in operators.keys()]))


def build(target):
# type: (str) -> None

toolchain = "i686-pc-windows-gnu" if target == "windows" else "i686-unknown-linux-gnu"
ext = ".exe" if target == "windows" else ""
launcherSourcePath = (curDir / "source/launcher").absolute()
sourceExe = (curDir / "source/launcher/target/{toolchain}/release/bgarmor{ext}".format(toolchain=toolchain, ext=ext)).absolute()
targetExe = (curDir / ("release/launcher/Launcher" + ext)).absolute()

print("> Started build for target:", toolchain)

if targetExe.exists():
print("> Deleted existing executable:", targetExe.as_posix())
targetExe.unlink()

os.chdir(launcherSourcePath.as_posix())
args = ["cargo", "build", "--target=" + toolchain, "--release"]
print("> Running cargo build:", " ".join(args))
subprocess.call(args)
os.chdir(curDir.as_posix())

print("> Copying executable to:", targetExe.as_posix())
shutil.copy2(sourceExe.as_posix(), targetExe.as_posix())

if target != "windows":
args = ["upx", "-5", targetExe.as_posix()]
print("> Running upx on executable:", " ".join(args))
subprocess.call(args)

print("> Done!")


def minify():
# type: () -> None

script = curDir / "source/scripts/minify_launcher.py"
subprocess.call([pythonExecutable.as_posix(), script.as_posix()])


def clean():
# type: () -> None

directory = curDir / "source/launcher/target"

if directory.exists():
print("> Deleting directory:", directory.as_posix())
shutil.rmtree(directory.as_posix())


def export(_target=None):
# type: (str) -> None

minify()

projectFile = (curDir / "project.godot").absolute()
exportPath = (curDir / "bin").absolute()

if not exportPath.exists():
exportPath.mkdir()
(exportPath / ".gdignore").touch()

targets = {
"Windows": "Windows Desktop",
"Linux": "Linux/X11",
}

if _target and _target in targets.keys():
targets = {_target: targets[_target]}

for target in targets.keys():
name = targets[target]
targetPath = (exportPath / target).absolute()

if targetPath.exists():
shutil.rmtree(targetPath.as_posix())

targetPath.mkdir()

print("> Exporting for target:", name)
args = ["godot", "--export-debug", name, "--no-window", projectFile.as_posix()]
print(" > Running Godot export:", " ".join(args))
subprocess.call(args)

print(" > Copying release files to:", targetPath.as_posix())
shutil.copytree((curDir / "release").as_posix(), (targetPath / "release").as_posix())

print(" > Deleting ignored files from:", targetPath.as_posix())
ignoredPatterns = [".gitignore", "__pycache__"]

for pattern in ignoredPatterns:
for folder, subfolders, files in os.walk(targetPath.as_posix()):
items = subfolders + files

for item in items:
curItem = (Path(folder) / item).absolute()

if fnmatch.fnmatch(curItem.name, pattern):

if curItem.is_file():
print(" > Deleted file:", curItem.as_posix())
curItem.unlink()

elif curItem.is_dir():
print(" > Deleted directory:", curItem.as_posix())
shutil.rmtree(curItem.as_posix())

print("> Done!")


operators = {
"clean": lambda: clean(),
"export": lambda: export(),
"export_windows": lambda: export("Windows"),
"export_linux": lambda: export("Linux"),
"launcher_windows": lambda: build("windows"),
"launcher_linux": lambda: build("linux"),
"minify": lambda: minify(),
} # type: dict[str, object]


main()
Binary file removed data/Example Game.blend
Binary file not shown.
Binary file removed data/LibPlayer.blend
Binary file not shown.
Binary file removed data/LibScenery.blend
Binary file not shown.
Binary file removed data/fonts/Graph-35-pix.ttf
Binary file not shown.
27 changes: 0 additions & 27 deletions data/scripts/hud.py

This file was deleted.

57 changes: 0 additions & 57 deletions data/scripts/minimap.py

This file was deleted.

78 changes: 0 additions & 78 deletions data/scripts/player.py

This file was deleted.

Binary file removed data/textures/map.png
Binary file not shown.
6 changes: 0 additions & 6 deletions engine/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions engine/Linux32/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions engine/Linux64/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions engine/Windows32/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions engine/Windows64/.gitignore

This file was deleted.

Loading

0 comments on commit 3cc713a

Please sign in to comment.