Skip to content

Commit

Permalink
remove bgfx to replace it with vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
LDprg committed Mar 15, 2024
1 parent fecc128 commit 14bf08e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 75 deletions.
20 changes: 0 additions & 20 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
bgfx = {
url = "https://github.com/JustEnoughMod/bgfx.meson";
ref = "main";
flake = false;
type = "git";
submodules = true;
};
dylib = {
url = "github:JustEnoughMod/dylib.meson";
flake = false;
Expand All @@ -19,7 +12,7 @@
};
};

outputs = { self, nixpkgs, pre-commit-hooks, bgfx, dylib, JustEnoughMod }:
outputs = { self, nixpkgs, pre-commit-hooks, dylib, JustEnoughMod }:
let
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
Expand All @@ -34,7 +27,7 @@

in {
overlays = forAllSystems (_: {
default = import ./overlay.nix { inherit bgfx dylib JustEnoughMod; };
default = import ./overlay.nix { inherit dylib JustEnoughMod; };
});

devShells = forAllSystems (system: {
Expand All @@ -49,7 +42,7 @@
nativeBuildInputs buildInputs;

LD_LIBRARY_PATH = pkgs.${system}.lib.makeLibraryPath
pkgs.${system}.JustEnoughModCore.buildInputs;
pkgs.${system}.JustEnoughModCore.libPath;
};
});

Expand Down
29 changes: 8 additions & 21 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ bgfx, dylib, JustEnoughMod, ... }:
{ dylib, JustEnoughMod, ... }:
final: _: {
JustEnoughModCore = with final;
clangStdenv.mkDerivation {
Expand All @@ -12,38 +12,27 @@ final: _: {

nativeBuildInputs =
[ clang-tools pkg-config meson ninja makeWrapper doxygen graphviz ];

buildInputs = [
SDL2
spdlog
wayland
libGL
vulkan-headers
vulkan-loader
wayland
wayland-protocols
wayland-scanner
libxkbcommon
xorg.libX11
xorg.libICE
xorg.libXi
xorg.libXScrnSaver
xorg.libXcursor
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXxf86vm
vulkan-validation-layers
];

libPath = [ SDL2 spdlog wayland libGL vulkan-loader ];

preConfigure = ''
mkdir -p subprojects
chmod 777 -R subprojects
cp -r ${JustEnoughMod} subprojects/JustEnoughMod
chmod 777 -R subprojects
cp -r ${bgfx} subprojects/JustEnoughMod/subprojects/bgfx
cp -r ${dylib} subprojects/JustEnoughMod/subprojects/dylib
chmod 777 -R subprojects
'';

Expand All @@ -56,9 +45,7 @@ final: _: {
cp libJustEnoughModCore.so $out/bin/Plugins
wrapProgram $out/bin/JustEnoughMod \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [ libGL vulkan-loader ]
}
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath libPath}
'';
};
}
25 changes: 2 additions & 23 deletions src/CorePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,9 @@ class CorePlugin : public Plugin {
#endif
}

void init() override {
bgfx::setDebug(BGFX_DEBUG_TEXT);
bgfx::setDebug(BGFX_DEBUG_STATS);
}

void update() override {
bgfx::dbgTextClear();

const bgfx::Stats *stats = bgfx::getStats();
void init() override {}

bgfx::dbgTextPrintf(
0, 1, 0x0f,
"Color can be changed with ANSI \x1b[9;me\x1b[10;ms\x1b[11;mc\x1b[12;ma\x1b[13;mp\x1b[14;me\x1b[0m code too.");

bgfx::dbgTextPrintf(
80, 1, 0x0f,
"\x1b[;0m \x1b[;1m \x1b[; 2m \x1b[; 3m \x1b[; 4m \x1b[; 5m \x1b[; 6m \x1b[; 7m \x1b[0m");
bgfx::dbgTextPrintf(
80, 2, 0x0f,
"\x1b[;8m \x1b[;9m \x1b[;10m \x1b[;11m \x1b[;12m \x1b[;13m \x1b[;14m \x1b[;15m \x1b[0m");

bgfx::dbgTextPrintf(0, 2, 0x0f, "Backbuffer %dW x %dH in pixels, debug text %dW x %dH in characters.",
stats->width, stats->height, stats->textWidth, stats->textHeight);
}
void update() override {}
};

JEM_PLUGIN_DEF(CorePlugin)

0 comments on commit 14bf08e

Please sign in to comment.