-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/pthom/hello_imgui
- Loading branch information
Showing
13 changed files
with
262 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/hello_imgui/internal/backend_impls/backend_window_helper/null_window_helper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
#ifdef HELLOIMGUI_USE_NULL | ||
|
||
#include "backend_window_helper.h" | ||
#include "hello_imgui/internal/backend_impls/null_config.h" | ||
#include <thread> | ||
|
||
#ifdef _WIN32 | ||
#ifdef CreateWindow | ||
#undef CreateWindow | ||
#endif | ||
#endif | ||
|
||
|
||
namespace HelloImGui { namespace BackendApi | ||
{ | ||
class NullWindowHelper: public IBackendWindowHelper | ||
{ | ||
// Note: this is a fake class, it has no member | ||
// It is only a class in order to enforce a consistent API between backends. | ||
public: | ||
WindowPointer CreateWindow(AppWindowParams &appWindowParams, const BackendOptions& backendOptions) override { | ||
return nullptr; | ||
} | ||
|
||
std::vector<ScreenBounds> GetMonitorsWorkAreas() override { return NullConfig::GetMonitorsWorkAreas();} | ||
|
||
bool IsWindowIconified(WindowPointer window) override { return false; } | ||
void RaiseWindow(WindowPointer window) override {} | ||
|
||
ScreenBounds GetWindowBounds(WindowPointer window) override { return {}; } | ||
void SetWindowBounds(WindowPointer window, ScreenBounds windowBounds) override {} | ||
|
||
void WaitForEventTimeout(double timeout_seconds) override { | ||
std::this_thread::sleep_for(std::chrono::milliseconds((int)(timeout_seconds * 1000))); | ||
} | ||
|
||
ImVec2 GetWindowScaleFactor(WindowPointer window) override { return NullConfig::GetWindowScaleFactor(); } | ||
float GetWindowSizeDpiScaleFactor(WindowPointer window) override { return NullConfig::GetWindowSizeDpiScaleFactor(); } | ||
|
||
void HideWindow(WindowPointer window) override {} | ||
void ShowWindow(WindowPointer window) override {} | ||
bool IsWindowHidden(WindowPointer window) override { return false; } | ||
|
||
}; | ||
}} // namespace HelloImGui { namespace BackendApi | ||
|
||
#endif // #ifdef HELLOIMGUI_USE_NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "hello_imgui/screen_bounds.h" | ||
#include "imgui.h" | ||
#include <vector> | ||
|
||
namespace HelloImGui | ||
{ | ||
namespace NullConfig | ||
{ | ||
ScreenBounds GetScreenBounds() | ||
{ | ||
ScreenBounds bounds; | ||
bounds.size = {1920, 1080}; | ||
bounds.position = {0, 0}; | ||
return {bounds}; | ||
} | ||
|
||
std::vector<ScreenBounds> GetMonitorsWorkAreas() | ||
{ | ||
return {GetScreenBounds()}; | ||
} | ||
|
||
ImVec2 GetWindowScaleFactor() { return {1.f, 1.f}; } | ||
float GetWindowSizeDpiScaleFactor() { return 1.f; } | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifdef HELLOIMGUI_HAS_NULL | ||
#include "rendering_null.h" | ||
|
||
|
||
namespace HelloImGui | ||
{ | ||
RenderingCallbacksPtr CreateBackendCallbacks_Null() | ||
{ | ||
auto callbacks = std::make_shared<RenderingCallbacks>(); | ||
|
||
callbacks->Impl_NewFrame_3D = [] {}; | ||
|
||
callbacks->Impl_RenderDrawData_To_3D = [] {}; | ||
|
||
callbacks->Impl_ScreenshotRgb_3D = []() { return ImageBuffer{}; }; | ||
|
||
callbacks->Impl_Frame_3D_ClearColor = [](ImVec4) {}; | ||
|
||
callbacks->Impl_Shutdown_3D = [] {}; | ||
|
||
callbacks->Impl_CreateFontTexture = [] {}; | ||
callbacks->Impl_DestroyFontTexture = [] {}; | ||
|
||
return callbacks; | ||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
#ifdef HELLOIMGUI_HAS_NULL | ||
|
||
#include "hello_imgui/internal/backend_impls/rendering_callbacks.h" | ||
|
||
namespace HelloImGui | ||
{ | ||
RenderingCallbacksPtr CreateBackendCallbacks_Null(); | ||
} | ||
|
||
#endif |
Oops, something went wrong.