Skip to content

Commit

Permalink
Cleanup folders
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraVoves committed Apr 14, 2024
1 parent 04ee833 commit f15e120
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 190 deletions.
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ zig build
Minimal setup with GLFW for window and input.

```sh
cd examples
zig-out/bin/00-minimal
examples/zig-out/bin/00-minimal
```

| Key | Description |
Expand All @@ -106,8 +105,7 @@ zig-out/bin/00-minimal
Minimal setup for zgui/ImGui.

```sh
cd examples
zig-out/bin/01-zgui
examples/zig-out/bin/01-zgui
```

| Key | Description |
Expand All @@ -121,8 +119,7 @@ Basic usage of shader compile in runtime.
Try edit shaders in `zig-out/bin/shaders` and hit `r` to recompile.

```sh
cd examples
zig-out/bin/02-runtime-shaderc
examples/zig-out/bin/02-runtime-shaderc
```

| Key | Description |
Expand All @@ -136,8 +133,7 @@ zig-out/bin/02-runtime-shaderc
DebugDraw api usage example.

```sh
cd examples
zig-out/bin/03-debugdraw
examples/zig-out/bin/03-debugdraw
```

| Key | Description |
Expand All @@ -147,7 +143,6 @@ zig-out/bin/03-debugdraw

## License

Folders `libs`, `shaders`, `src/imgui_impl_bgfx` is copy&paste from [bgfx](https://github.com/bkaradzic/bgfx) for more
sell-contained experience and is licensed [by](https://github.com/bkaradzic/bgfx/blob/master/LICENSE)

Folders `libs`, `shaders` is copy&paste from [bgfx](https://github.com/bkaradzic/bgfx) for more sell-contained
experience and is licensed by [LICENSEE](https://github.com/bkaradzic/bgfx/blob/master/LICENSE)
Zig binding is licensed by [WTFPL](LICENSE)
19 changes: 10 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ pub fn build(b: *std.Build) !void {
// Bgfx imgui backend
// TODO: zig based
//
const bgfx_imgui_path = "libs/bgfx/examples/common/imgui/";
if (options.imgui_include) |include| {
bgfx.addIncludePath(.{ .path = include });
bgfx.addCSourceFiles(.{
.flags = &cxx_options,
.files = &[_][]const u8{
"src/imgui_impl_bgfx/imgui.cpp",
bgfx_imgui_path ++ "imgui.cpp",
},
});
}
Expand Down Expand Up @@ -275,11 +276,11 @@ pub fn build(b: *std.Build) !void {
combine_bin_h,
.{
.shaderType = .fragment,
.input = .{ .path = "src/imgui_impl_bgfx/fs_imgui_image.sc" },
.input = .{ .path = bgfx_imgui_path ++ "fs_imgui_image.sc" },
},
.{
.bin2c = "fs_imgui_image",
.output = "src/imgui_impl_bgfx/fs_imgui_image.bin.h",
.output = bgfx_imgui_path ++ "fs_imgui_image.bin.h",
.includes = &.{shader_includes},
},
);
Expand All @@ -292,11 +293,11 @@ pub fn build(b: *std.Build) !void {
combine_bin_h,
.{
.shaderType = .fragment,
.input = .{ .path = "src/imgui_impl_bgfx/fs_ocornut_imgui.sc" },
.input = .{ .path = bgfx_imgui_path ++ "fs_ocornut_imgui.sc" },
},
.{
.bin2c = "fs_ocornut_imgui",
.output = "src/imgui_impl_bgfx/fs_ocornut_imgui.bin.h",
.output = bgfx_imgui_path ++ "fs_ocornut_imgui.bin.h",
.includes = &.{shader_includes},
},
);
Expand All @@ -308,11 +309,11 @@ pub fn build(b: *std.Build) !void {
combine_bin_h,
.{
.shaderType = .vertex,
.input = .{ .path = "src/imgui_impl_bgfx/vs_imgui_image.sc" },
.input = .{ .path = bgfx_imgui_path ++ "vs_imgui_image.sc" },
},
.{
.bin2c = "vs_imgui_image",
.output = "src/imgui_impl_bgfx/vs_imgui_image.bin.h",
.output = bgfx_imgui_path ++ "vs_imgui_image.bin.h",
.includes = &.{shader_includes},
},
);
Expand All @@ -324,11 +325,11 @@ pub fn build(b: *std.Build) !void {
combine_bin_h,
.{
.shaderType = .vertex,
.input = .{ .path = "src/imgui_impl_bgfx/vs_ocornut_imgui.sc" },
.input = .{ .path = bgfx_imgui_path ++ "vs_ocornut_imgui.sc" },
},
.{
.bin2c = "vs_ocornut_imgui",
.output = "src/imgui_impl_bgfx/vs_ocornut_imgui.bin.h",
.output = bgfx_imgui_path ++ "vs_ocornut_imgui.bin.h",
.includes = &.{shader_includes},
},
);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
$input v_color0, v_texcoord0


#include <bgfx_shader.sh>
#include <shadelib.sh>
#include "../common.sh"

SAMPLER2D(s_tex, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <imgui/imgui_internal.h>

#include "imgui.h"
#include "bgfx_utils.h"
#include "../bgfx_utils.h"

#include "vs_ocornut_imgui.bin.h"
#include "fs_ocornut_imgui.bin.h"
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions libs/bgfx/examples/common/imgui/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright 2011-2024 Branimir Karadzic. All rights reserved.
# License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
#

include ../../../scripts/shader-embeded.mk

droidsans.ttf.h: ../../runtime/font/droidsans.ttf
@bin2c -f $(<) -o $(@) -n s_droidSansTtf

roboto_regular.ttf.h: ../../runtime/font/roboto-regular.ttf
@bin2c -f $(<) -o $(@) -n s_robotoRegularTtf

robotomono_regular.ttf.h: ../../runtime/font/robotomono-regular.ttf
@bin2c -f $(<) -o $(@) -n s_robotoMonoRegularTtf

icons_font_awesome.ttf.h: ../../runtime/font/fontawesome-webfont.ttf
@bin2c -f $(<) -o $(@) -n s_iconsFontAwesomeTtf

icons_kenney.ttf.h: ../../runtime/font/kenney-icon-font.ttf
@bin2c -f $(<) -o $(@) -n s_iconsKenneyTtf

fonts: droidsans.ttf.h \
roboto_regular.ttf.h \
robotomono_regular.ttf.h \
icons_font_awesome.ttf.h \
icons_kenney.ttf.h

rebuild: fonts
@make -s --no-print-directory clean all
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
$input a_position, a_texcoord0, a_color0
$output v_color0, v_texcoord0

#include <bgfx_shader.sh>
#include <shadelib.sh>
#include "../common.sh"

void main()
{
Expand Down
164 changes: 0 additions & 164 deletions src/imgui_impl_bgfx/bgfx_utils.h

This file was deleted.

0 comments on commit f15e120

Please sign in to comment.