forked from sammyfreg/netImgui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Sample 'Disabled' to test program running with netImgui Disabled.
Few comments / window size corrections
- Loading branch information
Showing
7 changed files
with
156 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
//================================================================================================= | ||
// SAMPLE DISABLED | ||
//------------------------------------------------------------------------------------------------- | ||
// This sample demonstrate compiling your code with netImgui disabled but ImGui still active. | ||
// It relies on the Define 'NETIMGUI_ENABLED' assigned in the project properties. | ||
//================================================================================================= | ||
|
||
#include <NetImgui_Api.h> | ||
#include "..\Common\Sample.h" | ||
#include "..\Common\WarningDisable.h" | ||
|
||
namespace SampleClient | ||
{ | ||
//================================================================================================= | ||
// | ||
//================================================================================================= | ||
bool Client_Startup() | ||
{ | ||
if( !NetImgui::Startup() ) | ||
return false; | ||
|
||
// Can have more ImGui initialization here, like loading extra fonts. | ||
// ... | ||
|
||
return true; | ||
} | ||
|
||
//================================================================================================= | ||
// | ||
//================================================================================================= | ||
void Client_Shutdown() | ||
{ | ||
NetImgui::Shutdown(); | ||
} | ||
|
||
//================================================================================================= | ||
// Added a call to this function in 'ImGui_ImplDX11_CreateFontsTexture()', allowing us to | ||
// forward the Font Texture information to netImgui. | ||
//================================================================================================= | ||
void Client_AddFontTexture(uint64_t texId, void* pData, uint16_t width, uint16_t height) | ||
{ | ||
NetImgui::SendDataTexture(texId, pData, width, height, NetImgui::eTexFormat::kTexFmtRGBA8 ); | ||
} | ||
|
||
//================================================================================================= | ||
// Function used by the sample, to draw all ImGui Content | ||
//================================================================================================= | ||
const ImDrawData* Client_Draw() | ||
{ | ||
//--------------------------------------------------------------------------------------------- | ||
// (1) Start a new Frame | ||
//--------------------------------------------------------------------------------------------- | ||
NetImgui::NewFrame(); | ||
|
||
//----------------------------------------------------------------------------------------- | ||
// (2) Draw ImGui Content | ||
//----------------------------------------------------------------------------------------- | ||
ClientUtil_ImGuiContent_Common("SampleDisabled", false); | ||
ImGui::SetNextWindowPos(ImVec2(32,48), ImGuiCond_Once); | ||
ImGui::SetNextWindowSize(ImVec2(400,400), ImGuiCond_Once); | ||
if( ImGui::Begin("Sample Basic", nullptr) ) | ||
{ | ||
ImGui::TextColored(ImVec4(0.1, 1, 0.1, 1), "Compiling with netImgui Disabled."); | ||
ImGui::TextWrapped( "This shows being able to continue using ImGui normally, while netImgui code has been disabled. " | ||
"No connection with the remote netImgui will be possible since the client code is entirely ifdef out " | ||
"and the netImgui client API left with shell content calling Dear Imgui directly."); | ||
ImGui::NewLine(); | ||
ImGui::TextColored(ImVec4(0.1, 1, 0.1, 1), "Where are we drawing: "); | ||
ImGui::SameLine(); | ||
ImGui::TextUnformatted(NetImgui::IsDrawingRemote() ? "Remote Draw" : "Local Draw"); | ||
ImGui::NewLine(); | ||
ImGui::TextColored(ImVec4(0.1, 1, 0.1, 1), "Filler content"); | ||
ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); | ||
} | ||
ImGui::End(); | ||
|
||
//--------------------------------------------------------------------------------------------- | ||
// (3) Finish the frame, preparing the drawing data and... | ||
// (3a) Send the data to the netImGui server when connected | ||
//--------------------------------------------------------------------------------------------- | ||
NetImgui::EndFrame(); | ||
|
||
//--------------------------------------------------------------------------------------------- | ||
// (4) Forward to drawing data our local renderer when not remotely drawing | ||
//--------------------------------------------------------------------------------------------- | ||
return !NetImgui::IsConnected() ? NetImgui::GetDrawData() : nullptr; | ||
} | ||
|
||
} // namespace SampleClient |
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