Compare commits
15 Commits
099c3650a7
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
0fc34b42d4 | ||
|
de6826f7d3 | ||
|
ed7517080b | ||
|
3320e6c1e3 | ||
|
fee884ff32 | ||
|
d8d74c9a5e | ||
dc7d4a2e93 | |||
bbb419ed42 | |||
27b4374662 | |||
884033fe5c | |||
4e4b35703f | |||
6968d4403e | |||
b6ab400943 | |||
1dc4c850f4 | |||
7122e7ff62 |
35
.github/workflows/cd.yml
vendored
35
.github/workflows/cd.yml
vendored
@@ -7,17 +7,17 @@ on:
|
|||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: RelWidthDebInfo
|
||||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux-ubuntu:
|
linux-ubuntu:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||||
@@ -25,6 +25,10 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
run: ctest -C ${{env.BUILD_TYPE}}
|
||||||
|
|
||||||
- name: Determine tag name
|
- name: Determine tag name
|
||||||
id: tag
|
id: tag
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -32,24 +36,24 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||||
echo "name=${SHORT_HASH}" >> $GITHUB_OUTPUT
|
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||||
echo "name=${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Compress artifacts
|
- name: Compress artifacts
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
# TODO: simpler name?
|
# TODO: simpler name?
|
||||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64
|
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64
|
||||||
# TODO: do propper packing
|
# TODO: do propper packing
|
||||||
path: |
|
path: |
|
||||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64.tar.gz
|
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64.tar.gz
|
||||||
|
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
@@ -58,7 +62,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
# setup vs env
|
# setup vs env
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
@@ -78,10 +82,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||||
echo "name=${SHORT_HASH}" >> $GITHUB_OUTPUT
|
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||||
echo "name=${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Compress artifacts
|
- name: Compress artifacts
|
||||||
@@ -98,8 +102,7 @@ jobs:
|
|||||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64.zip
|
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64.zip
|
||||||
|
|
||||||
release:
|
release:
|
||||||
if: false
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }}
|
||||||
#if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }}
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -111,7 +114,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Determine tag name
|
- name: Determine tag name
|
||||||
id: tag
|
id: tag
|
||||||
@@ -120,10 +123,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||||
echo "name=${SHORT_HASH}" >> $GITHUB_OUTPUT
|
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||||
echo "name=${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
|
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
# setup vs env
|
# setup vs env
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
44
external/CMakeLists.txt
vendored
44
external/CMakeLists.txt
vendored
@@ -2,33 +2,6 @@ cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
|
|||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
#if (NOT TARGET solanaceae_util)
|
|
||||||
#FetchContent_Declare(solanaceae_util
|
|
||||||
#GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_util.git
|
|
||||||
#GIT_TAG master
|
|
||||||
#EXCLUDE_FROM_ALL
|
|
||||||
#)
|
|
||||||
#FetchContent_MakeAvailable(solanaceae_util)
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
if (NOT TARGET solanaceae_contact)
|
|
||||||
FetchContent_Declare(solanaceae_contact
|
|
||||||
GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_contact.git
|
|
||||||
GIT_TAG master
|
|
||||||
EXCLUDE_FROM_ALL
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(solanaceae_contact)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#if (NOT TARGET solanaceae_message3)
|
|
||||||
#FetchContent_Declare(solanaceae_message3
|
|
||||||
#GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_message3.git
|
|
||||||
#GIT_TAG master
|
|
||||||
#EXCLUDE_FROM_ALL
|
|
||||||
#)
|
|
||||||
#FetchContent_MakeAvailable(solanaceae_message3)
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
if (NOT TARGET solanaceae_plugin)
|
if (NOT TARGET solanaceae_plugin)
|
||||||
FetchContent_Declare(solanaceae_plugin
|
FetchContent_Declare(solanaceae_plugin
|
||||||
GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_plugin.git
|
GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_plugin.git
|
||||||
@@ -38,18 +11,6 @@ if (NOT TARGET solanaceae_plugin)
|
|||||||
FetchContent_MakeAvailable(solanaceae_plugin)
|
FetchContent_MakeAvailable(solanaceae_plugin)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#if (NOT TARGET oatpp)
|
|
||||||
#set(OATPP_INSTALL OFF CACHE BOOL "" FORCE)
|
|
||||||
#set(OATPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
||||||
#set(OATPP_LINK_TEST_LIBRARY OFF CACHE BOOL "" FORCE)
|
|
||||||
#FetchContent_Declare(oatpp
|
|
||||||
#GIT_REPOSITORY https://github.com/oatpp/oatpp.git
|
|
||||||
#GIT_TAG master
|
|
||||||
#EXCLUDE_FROM_ALL
|
|
||||||
#)
|
|
||||||
#FetchContent_MakeAvailable(oatpp)
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
if (NOT TARGET PureDOOM)
|
if (NOT TARGET PureDOOM)
|
||||||
add_subdirectory(./pure_doom)
|
add_subdirectory(./pure_doom)
|
||||||
endif()
|
endif()
|
||||||
@@ -57,14 +18,14 @@ endif()
|
|||||||
if (NOT TARGET imgui)
|
if (NOT TARGET imgui)
|
||||||
FetchContent_Declare(imgui
|
FetchContent_Declare(imgui
|
||||||
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
||||||
GIT_TAG d6cb3c9 # v1.90.1
|
GIT_TAG 5d4126876bc10396d4c6511853ff10964414c776 # v1.92.1
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
# imgui does not provide a cmake
|
# imgui does not provide a cmake
|
||||||
FetchContent_GetProperties(imgui)
|
FetchContent_GetProperties(imgui)
|
||||||
if(NOT imgui_POPULATED)
|
if(NOT imgui_POPULATED)
|
||||||
FetchContent_Populate(imgui)
|
FetchContent_MakeAvailable(imgui)
|
||||||
|
|
||||||
add_library(imgui STATIC
|
add_library(imgui STATIC
|
||||||
${imgui_SOURCE_DIR}/imgui.h
|
${imgui_SOURCE_DIR}/imgui.h
|
||||||
@@ -84,6 +45,7 @@ if (NOT TARGET imgui)
|
|||||||
)
|
)
|
||||||
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
|
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
|
||||||
target_compile_features(imgui PUBLIC cxx_std_11)
|
target_compile_features(imgui PUBLIC cxx_std_11)
|
||||||
|
target_compile_definitions(imgui PUBLIC IMGUI_USE_WCHAR32)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -1,9 +1,12 @@
|
|||||||
cmake_minimum_required(VERSION 3.9...3.24 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.9...3.24 FATAL_ERROR)
|
||||||
|
|
||||||
add_library(plugin_doom_imgui SHARED
|
add_library(plugin_doom_imgui MODULE
|
||||||
./plugin_doom_imgui.cpp
|
./plugin_doom_imgui.cpp
|
||||||
)
|
)
|
||||||
target_compile_features(plugin_doom_imgui PUBLIC cxx_std_17)
|
target_compile_features(plugin_doom_imgui PUBLIC cxx_std_17)
|
||||||
|
set_target_properties(plugin_doom_imgui PROPERTIES
|
||||||
|
C_VISIBILITY_PRESET hidden
|
||||||
|
)
|
||||||
target_link_libraries(plugin_doom_imgui PUBLIC
|
target_link_libraries(plugin_doom_imgui PUBLIC
|
||||||
solDOOM_imgui
|
solDOOM_imgui
|
||||||
solanaceae_plugin
|
solanaceae_plugin
|
||||||
|
@@ -33,10 +33,16 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
|||||||
try {
|
try {
|
||||||
//auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
|
//auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
|
||||||
auto* imguic = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiContext, ImGui::GetVersion());
|
auto* imguic = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiContext, ImGui::GetVersion());
|
||||||
auto* tu = PLUG_RESOLVE_INSTANCE(TextureUploaderI);
|
auto* imguimemaf = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiMemAllocFunc, ImGui::GetVersion());
|
||||||
|
auto* imguimemff = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiMemFreeFunc, ImGui::GetVersion());
|
||||||
|
// meh
|
||||||
|
auto* imguimemud = plug_resolveInstanceOptional<void*>(solana_api, "ImGuiMemUserData", ImGui::GetVersion());
|
||||||
|
|
||||||
|
ImGui::SetAllocatorFunctions(imguimemaf, imguimemff, imguimemud);
|
||||||
ImGui::SetCurrentContext(imguic);
|
ImGui::SetCurrentContext(imguic);
|
||||||
|
|
||||||
|
auto* tu = PLUG_RESOLVE_INSTANCE(TextureUploaderI);
|
||||||
|
|
||||||
// static store, could be anywhere tho
|
// static store, could be anywhere tho
|
||||||
// construct with fetched dependencies
|
// construct with fetched dependencies
|
||||||
g_doom_imgui = std::make_unique<DoomIMGUI>(*tu);
|
g_doom_imgui = std::make_unique<DoomIMGUI>(*tu);
|
||||||
|
@@ -27,12 +27,6 @@ void my_doom_gettime(int* sec, int* usec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//static const char* doom_argv[] {
|
|
||||||
//"self.exe",
|
|
||||||
//"-timedemo",
|
|
||||||
//"",
|
|
||||||
//};
|
|
||||||
|
|
||||||
Doom::Doom(
|
Doom::Doom(
|
||||||
TextureUploaderI& tu
|
TextureUploaderI& tu
|
||||||
) : _tu(tu) {
|
) : _tu(tu) {
|
||||||
@@ -56,8 +50,6 @@ Doom::Doom(
|
|||||||
// does not actually work
|
// does not actually work
|
||||||
doom_set_resolution(_width, _height);
|
doom_set_resolution(_width, _height);
|
||||||
|
|
||||||
// HATE
|
|
||||||
//doom_init(2, const_cast<char**>(doom_argv), 0);
|
|
||||||
doom_init(0, nullptr, 0);
|
doom_init(0, nullptr, 0);
|
||||||
|
|
||||||
std::vector<uint8_t> tmp_vec(4 * _width * _height, 0x00); // the api requires data for texture creation
|
std::vector<uint8_t> tmp_vec(4 * _width * _height, 0x00); // the api requires data for texture creation
|
||||||
@@ -75,9 +67,11 @@ float Doom::render(float time_delta) {
|
|||||||
|
|
||||||
doom_update();
|
doom_update();
|
||||||
|
|
||||||
|
// TODO: use RGB instead?
|
||||||
const uint8_t* new_image = doom_get_framebuffer(4);
|
const uint8_t* new_image = doom_get_framebuffer(4);
|
||||||
_tu.updateRGBA(_render_texture, new_image, 4 * _width * _height);
|
_tu.updateRGBA(_render_texture, new_image, 4 * _width * _height);
|
||||||
|
|
||||||
|
// TODO: allow more?
|
||||||
return 1.f/60.f;
|
return 1.f/60.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ class Doom {
|
|||||||
Doom(
|
Doom(
|
||||||
TextureUploaderI& tu
|
TextureUploaderI& tu
|
||||||
);
|
);
|
||||||
~Doom(void);
|
virtual ~Doom(void);
|
||||||
|
|
||||||
float render(float time_delta);
|
float render(float time_delta);
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ class Doom {
|
|||||||
//void doom_set_print(doom_print_fn print_fn);
|
//void doom_set_print(doom_print_fn print_fn);
|
||||||
//void doom_set_malloc(doom_malloc_fn malloc_fn, doom_free_fn free_fn);
|
//void doom_set_malloc(doom_malloc_fn malloc_fn, doom_free_fn free_fn);
|
||||||
//void doom_set_file_io(doom_open_fn open_fn,
|
//void doom_set_file_io(doom_open_fn open_fn,
|
||||||
//doom_close_fn close_fn,
|
//doom_close_fn close_fn,
|
||||||
//doom_read_fn read_fn,
|
//doom_read_fn read_fn,
|
||||||
//doom_write_fn write_fn,
|
//doom_write_fn write_fn,
|
||||||
//doom_seek_fn seek_fn,
|
//doom_seek_fn seek_fn,
|
||||||
//doom_tell_fn tell_fn,
|
//doom_tell_fn tell_fn,
|
||||||
//doom_eof_fn eof_fn);
|
//doom_eof_fn eof_fn);
|
||||||
//void doom_set_gettime(doom_gettime_fn gettime_fn);
|
//void doom_set_gettime(doom_gettime_fn gettime_fn);
|
||||||
//void doom_set_exit(doom_exit_fn exit_fn);
|
//void doom_set_exit(doom_exit_fn exit_fn);
|
||||||
//void doom_set_getenv(doom_getenv_fn getenv_fn);
|
//void doom_set_getenv(doom_getenv_fn getenv_fn);
|
||||||
|
@@ -93,20 +93,18 @@ float DoomIMGUI::render(float time_delta) {
|
|||||||
if (ImGui::Begin("doom", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::Begin("doom", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::SliderFloat("scale", &_size_scaler, 1.f, 5.f);
|
ImGui::SliderFloat("scale", &_size_scaler, 1.f, 5.f);
|
||||||
|
|
||||||
if (ImGui::IsWindowFocused()) {
|
const bool window_focused = ImGui::IsWindowFocused();
|
||||||
for (const auto& [imkey, dokey] : g_all_keys) {
|
for (const auto& [imkey, dokey] : g_all_keys) {
|
||||||
// TODO: unpress all keys on focus loss
|
if (window_focused && ImGui::IsKeyPressed(imkey, false)) {
|
||||||
if (ImGui::IsKeyPressed(imkey, false)) {
|
_doom.doomKeyDown(dokey);
|
||||||
_doom.doomKeyDown(dokey);
|
}
|
||||||
}
|
if (ImGui::IsKeyReleased(imkey)) {
|
||||||
if (ImGui::IsKeyReleased(imkey)) {
|
_doom.doomKeyUp(dokey);
|
||||||
_doom.doomKeyUp(dokey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doom_interval = _doom.render(time_delta);
|
doom_interval = _doom.render(time_delta);
|
||||||
ImGui::Image(reinterpret_cast<void*>(_doom.getTexID()), {_size_scaler * 320, _size_scaler * 200 * 1.2f});
|
ImGui::Image(_doom.getTexID(), {_size_scaler * 320, _size_scaler * 200 * 1.2f});
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ class DoomIMGUI {
|
|||||||
DoomIMGUI(
|
DoomIMGUI(
|
||||||
TextureUploaderI& tu
|
TextureUploaderI& tu
|
||||||
);
|
);
|
||||||
~DoomIMGUI(void);
|
virtual ~DoomIMGUI(void);
|
||||||
|
|
||||||
// render imgui
|
// render imgui
|
||||||
float render(float time_delta);
|
float render(float time_delta);
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
struct TextureUploaderI {
|
struct TextureUploaderI {
|
||||||
static constexpr const char* version {"2"};
|
static constexpr const char* version {"3"};
|
||||||
|
|
||||||
enum Filter {
|
enum Filter {
|
||||||
NEAREST,
|
NEAREST,
|
||||||
@@ -17,13 +17,30 @@ struct TextureUploaderI {
|
|||||||
// target?
|
// target?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Format {
|
||||||
|
RGBA,
|
||||||
|
//RGB,
|
||||||
|
|
||||||
|
IYUV,
|
||||||
|
YV12,
|
||||||
|
|
||||||
|
NV12,
|
||||||
|
NV21,
|
||||||
|
|
||||||
|
MAX
|
||||||
|
};
|
||||||
|
|
||||||
virtual ~TextureUploaderI(void) {}
|
virtual ~TextureUploaderI(void) {}
|
||||||
|
|
||||||
virtual uint64_t uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter = LINEAR, Access access = STATIC) = 0;
|
[[deprecated]] virtual uint64_t uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter = LINEAR, Access access = STATIC) = 0;
|
||||||
|
|
||||||
// keeps width height filter
|
// keeps width height filter
|
||||||
// TODO: wh instead of size?
|
// TODO: wh instead of size?
|
||||||
virtual bool updateRGBA(uint64_t tex_id, const uint8_t* data, size_t size) = 0;
|
[[deprecated]] virtual bool updateRGBA(uint64_t tex_id, const uint8_t* data, size_t size) = 0;
|
||||||
|
|
||||||
|
// use upload to create a texture, and update to update existing
|
||||||
|
virtual uint64_t upload(const uint8_t* data, uint32_t width, uint32_t height, Format format = RGBA, Filter filter = LINEAR, Access access = STATIC) = 0;
|
||||||
|
virtual bool update(uint64_t tex_id, const uint8_t* data, size_t size) = 0;
|
||||||
|
|
||||||
virtual void destroy(uint64_t tex_id) = 0;
|
virtual void destroy(uint64_t tex_id) = 0;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user