Compare commits

..

No commits in common. "d5531ce370cffad14f0e3a19800072aced1a645b" and "1940d01d9bbd463e325bd818b129161235d19dfa" have entirely different histories.

13 changed files with 44 additions and 69 deletions

7
.gitmodules vendored
View File

@ -1,6 +1,7 @@
[submodule "dependencies/imgui"]
path = dependencies/imgui
url = https://github.com/ocornut/imgui.git
branch = docking
[submodule "dependencies/resource_embedder"] [submodule "dependencies/resource_embedder"]
path = dependencies/resource_embedder path = dependencies/resource_embedder
url = https://timerix.ddns.net/git/Timerix/resource_embedder.git url = https://timerix.ddns.net/git/Timerix/resource_embedder.git
[submodule "dependencies/cimgui"]
path = dependencies/cimgui
url = https://github.com/cimgui/cimgui.git

View File

@ -9,7 +9,7 @@
"includePath": [ "includePath": [
"dependencies/include", "dependencies/include",
"dependencies/include/SDL2", "dependencies/include/SDL2",
"dependencies/cimgui/imgui", "dependencies/imgui",
"${default}" "${default}"
], ],
"cppStandard": "c++20" "cppStandard": "c++20"

View File

@ -4,7 +4,7 @@ A game engine or something, idk.
## Installation ## Installation
1. **Clone the repository.** 1. **Clone the repository.**
```sh ```sh
git clone --recurse-submodules --depth 1 https://timerix.ddns.net/git/Timerix/ougge.git git clone --recurse-submodules https://timerix.ddns.net/git/Timerix/ougge.git
``` ```
2. **Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild).** 2. **Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild).**
3. **Install [SDL2](https://github.com/libsdl-org/SDL) and [SDL2_image](https://github.com/libsdl-org/SDL_image).** 3. **Install [SDL2](https://github.com/libsdl-org/SDL) and [SDL2_image](https://github.com/libsdl-org/SDL_image).**

1
dependencies/cimgui vendored

@ -1 +0,0 @@
Subproject commit 5ba6ea3fc0b3901693f7982b878fa19bffd9c97b

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
DEP_WORKING_DIR='dependencies/cimgui'
DEP_PRE_BUILD_COMMAND=''
if [[ "$TASK" = *_dbg ]]; then
DEP_BUILD_COMMAND='cbuild -c ../cimgui.project.config build_shared_lib_dbg'
else
DEP_BUILD_COMMAND='cbuild -c ../cimgui.project.config build_shared_lib'
fi
DEP_POST_BUILD_COMMAND='rm -f cbuild.log'
DEP_CLEAN_COMMAND='cbuild clean -c ../cimgui.project.config'
DEP_STATIC_OUT_FILES=''
case $OS in
WINDOWS)
DEP_DYNAMIC_OUT_FILES="../bin/cimgui.dll"
;;
LINUX)
DEP_DYNAMIC_OUT_FILES="../bin/cimgui.so"
;;
*)
error "operating system $OS has no configuration variants"
;;
esac

1
dependencies/imgui vendored Submodule

@ -0,0 +1 @@
Subproject commit 7b6314f47d2aaa3758cfeeca66af34f5c9309ca4

12
dependencies/imgui.config vendored Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
DEP_WORKING_DIR='dependencies/imgui'
DEP_PRE_BUILD_COMMAND=''
if [[ "$TASK" = *_dbg ]]; then
DEP_BUILD_COMMAND='cbuild -c ../imgui.project.config build_static_lib_dbg'
else
DEP_BUILD_COMMAND='cbuild -c ../imgui.project.config build_static_lib'
fi
DEP_POST_BUILD_COMMAND=''
DEP_CLEAN_COMMAND='cbuild clean -c ../imgui.project.config'
DEP_STATIC_OUT_FILES='../bin/libimgui.a'
DEP_DYNAMIC_OUT_FILES=''

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CBUILD_VERSION=2.2.1 CBUILD_VERSION=2.1.2
CONFIG_VERSION=1 CONFIG_VERSION=1
PROJECT="cimgui" PROJECT="imgui"
CMP_C="gcc" CMP_C="gcc"
CMP_CPP="g++" CMP_CPP="g++"
STD_C="c11" STD_C="c11"
@ -10,14 +10,13 @@ STD_CPP="c++11"
WARN_C="-Wall -Wno-discarded-qualifiers -Wno-unused-parameter" WARN_C="-Wall -Wno-discarded-qualifiers -Wno-unused-parameter"
WARN_CPP="-Wall -Wno-unused-parameter" WARN_CPP="-Wall -Wno-unused-parameter"
SRC_C="" SRC_C=""
SRC_CPP="imgui/imgui.cpp SRC_CPP="imgui.cpp
imgui/imgui_demo.cpp imgui_demo.cpp
imgui/imgui_draw.cpp imgui_draw.cpp
imgui/imgui_tables.cpp imgui_tables.cpp
imgui/imgui_widgets.cpp imgui_widgets.cpp
imgui/backends/imgui_impl_sdl2.cpp backends/imgui_impl_sdl2.cpp
imgui/backends/imgui_impl_sdlrenderer2.cpp backends/imgui_impl_sdlrenderer2.cpp"
cimgui.cpp"
# Directory with dependency configs. # Directory with dependency configs.
# See cbuild/example_dependency_configs # See cbuild/example_dependency_configs
@ -32,22 +31,20 @@ ENABLED_DEPENDENCIES=''
# └── profile/ - gcc *.gcda profiling info files # └── profile/ - gcc *.gcda profiling info files
OBJDIR="../obj" OBJDIR="../obj"
OUTDIR="../bin" OUTDIR="../bin"
STATIC_LIB_FILE="lib$PROJECT.a"
# header include directories # header include directories
INCLUDE="-I. -I./imgui -I../include/SDL2" INCLUDE="-I. -I../include/SDL2"
STATIC_LIB_FILE="$PROJECT.a"
# OS-specific options # OS-specific options
case "$OS" in case "$OS" in
WINDOWS) WINDOWS)
SHARED_LIB_FILE="$PROJECT.dll" EXEC_FILE="$PROJECT.exe"
LINKER_LIBS="-L../precompiled/$OS-$ARCH -l:SDL2.dll" SHARED_LIB_FILE="lib$PROJECT.dll"
DEFINE="-DIMGUI_API=__declspec(dllexport)"
;; ;;
LINUX) LINUX)
SHARED_LIB_FILE="$PROJECT.so" EXEC_FILE="$PROJECT"
LINKER_LIBS="-lSDL2" SHARED_LIB_FILE="lib$PROJECT.so"
DEFINE="-DIMGUI_API=__attribute__((__visibility__(\"default\")))"
;; ;;
*) *)
error "operating system $OS has no configuration variants" error "operating system $OS has no configuration variants"
@ -58,25 +55,25 @@ esac
case "$TASK" in case "$TASK" in
# creates shared library # creates shared library
build_shared_lib) build_shared_lib)
C_ARGS="-O2 -fpic -shared $DEFINE" C_ARGS="-O2 -fpic -flto -shared"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS -Wl,-soname,$SHARED_LIB_FILE" LINKER_ARGS="$CPP_ARGS -Wl,-soname,$SHARED_LIB_FILE"
PRE_TASK_SCRIPT= PRE_TASK_SCRIPT=
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
# creates shared library with debug symbols and no optimizations # creates shared library with debug symbols and no optimizations
build_shared_lib_dbg) build_shared_lib_dbg)
C_ARGS="-O0 -g3 -fpic -shared $DEFINE" C_ARGS="-O0 -g3 -fpic -shared"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS -Wl,-soname,$SHARED_LIB_FILE" LINKER_ARGS="$CPP_ARGS -Wl,-soname,$SHARED_LIB_FILE"
PRE_TASK_SCRIPT= PRE_TASK_SCRIPT=
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
# creates static library # creates static library
build_static_lib) build_static_lib)
C_ARGS="-O2 $DEFINE" C_ARGS="-O2"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
PRE_TASK_SCRIPT= PRE_TASK_SCRIPT=
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
@ -84,7 +81,7 @@ case "$TASK" in
;; ;;
# creates static library with debug symbols and no optimizations # creates static library with debug symbols and no optimizations
build_static_lib_dbg) build_static_lib_dbg)
C_ARGS="-O0 -g3 $DEFINE" C_ARGS="-O0 -g3"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
PRE_TASK_SCRIPT= PRE_TASK_SCRIPT=
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh

View File

@ -6,7 +6,4 @@ if [[ "$TASK" = *_dbg ]]; then
fi fi
DEP_BUILD_COMMAND=$"dotnet build src-csharp.sln -o bin -c $CS_CONFIGURATION" DEP_BUILD_COMMAND=$"dotnet build src-csharp.sln -o bin -c $CS_CONFIGURATION"
DEP_CLEAN_COMMAND='rm -rf bin obj' DEP_CLEAN_COMMAND='rm -rf bin obj'
DEP_OTHER_OUT_FILES='bin/Ougge.dll DEP_OTHER_OUT_FILES='bin/Ougge.dll'
bin/Tomlyn.dll
bin/Hexa.NET.ImGui.dll
bin/HexaGen.Runtime.dll'

View File

@ -15,7 +15,7 @@ SRC_CPP="$(find src -name '*.cpp')"
# See cbuild/example_dependency_configs # See cbuild/example_dependency_configs
DEPENDENCY_CONFIGS_DIR='dependencies' DEPENDENCY_CONFIGS_DIR='dependencies'
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space. # List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
ENABLED_DEPENDENCIES='precompiled resources cimgui src-csharp' ENABLED_DEPENDENCIES='precompiled resources imgui src-csharp'
# OBJDIR structure: # OBJDIR structure:
# ├── objects/ - Compiled object files. Cleans on each call of build task # ├── objects/ - Compiled object files. Cleans on each call of build task
@ -27,7 +27,7 @@ OUTDIR="bin"
STATIC_LIB_FILE="lib$PROJECT.a" STATIC_LIB_FILE="lib$PROJECT.a"
# header include directories # header include directories
INCLUDE="-I./dependencies/cimgui/imgui -I./dependencies/include -I./dependencies/include/SDL2" INCLUDE="-I./dependencies/imgui -I./dependencies/include -I./dependencies/include/SDL2"
# OS-specific options # OS-specific options
case "$OS" in case "$OS" in

View File

@ -1,5 +1,4 @@
using System; using System;
using Hexa.NET.ImGui;
namespace Ougge; namespace Ougge;
@ -12,8 +11,5 @@ public class ExampleComponent : Component
public override void Update(double deltaTime) public override void Update(double deltaTime)
{ {
Console.WriteLine($"C# deltaTime {deltaTime} object id {Owner.Id}"); Console.WriteLine($"C# deltaTime {deltaTime} object id {Owner.Id}");
ImGui.Begin("C# WINDOW");
ImGui.Text("Hello from ExampleComponent!");
ImGui.End();
} }
} }

View File

@ -65,8 +65,7 @@ public class GameObject
if(Components.ContainsKey(t)) if(Components.ContainsKey(t))
return false; return false;
Component component = (Component?)Activator.CreateInstance(t, this) Component component = (Component)Activator.CreateInstance(t, this);
?? throw new Exception($"can't create instance of class {t.FullName}");
Components.Add(t, component); Components.Add(t, component);
return true; return true;
} }

View File

@ -6,10 +6,5 @@
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<DebugType>embedded</DebugType> <DebugType>embedded</DebugType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Hexa.NET.ImGui" Version="2.2.7" />
<PackageReference Include="Tomlyn" Version="0.19.0" />
</ItemGroup>
</Project> </Project>