Skip to content

Commit

Permalink
Merge pull request #55 from sammyfreg/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
sammyfreg authored Dec 30, 2023
2 parents 33c2cd0 + 051d8cd commit e4217aa
Show file tree
Hide file tree
Showing 75 changed files with 38,548 additions and 3,112 deletions.
47 changes: 28 additions & 19 deletions Build/GenerateCompatibilityTest.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@echo off
setlocal enabledelayedexpansion
cls
pushd %~dp0

::-----------------------------------------------------------------------------------
:: SETTINGS
::-----------------------------------------------------------------------------------
:: List of offical Dear ImGui (from official depot)
set VERSIONS=(v1.71 v1.72 v1.73 v1.74 v1.75 v1.76 v1.77 v1.78 v1.79, v1.80, v1.81, v1.82, v1.83, v1.84, v1.85, v1.86, v1.87, v1.88, v1.89.1, v1.89.2, v1.89.3, v1.89.4, v1.89.5)
set VERSIONS=(v1.71 v1.72 v1.73 v1.74 v1.75 v1.76 v1.77 v1.78 v1.79, v1.80, v1.81, v1.82, v1.83, v1.84, v1.85, v1.86, v1.87, v1.88, v1.89.1, v1.89.2, v1.89.3, v1.89.4, v1.89.5, v1.89.6, v1.89.7, v1.89.7-docking, v1.89.8, v1.89.8-docking, v1.89.9, v1.89.9-docking, v1.90, v1.90-docking)

:: List of custom Dear ImGui releases (from own depot)
set EXTRA_VERSIONS=(dock-1-76, dock-1-80, dock-1-89)
Expand All @@ -27,43 +28,47 @@ echo Used to test compatibility against multiple version of Dear ImGui
echo ================================================================================
echo.

if not exist %IMGUI_DIR% goto SkipDelete
echo.
echo --------------------------------------------------------------------------------
echo Clearing Releases
echo --------------------------------------------------------------------------------
echo Removing: %IMGUI_DIR%
rmdir /s /q %IMGUI_DIR%
:: Only download new release

:: if not exist %IMGUI_DIR% goto SkipDelete
:: echo.
:: echo --------------------------------------------------------------------------------
:: echo Clearing Releases
:: echo --------------------------------------------------------------------------------
:: echo Removing: %IMGUI_DIR%
:: rmdir /s /q %IMGUI_DIR%


:SkipDelete
mkdir %IMGUI_DIR%
if not exist %IMGUI_DIR% (
mkdir %IMGUI_DIR%
)

echo.
echo --------------------------------------------------------------------------------
echo Downloading and extracting Dear ImGui Releases
echo --------------------------------------------------------------------------------
pushd %IMGUI_DIR%
for %%v in %VERSIONS% do (

for %%v in %VERSIONS% do (
echo Extracting: %%v
set IMGUI_FILE=%%v.tar.gz
set IMGUI_FILEPATH="https://github.com/ocornut/imgui/archive/!IMGUI_FILE!"
echo !IMGUI_FILEPATH!
curl -LJ !IMGUI_FILEPATH! --output !IMGUI_FILE!
if not exist !IMGUI_FILE! curl -LJ !IMGUI_FILEPATH! --output !IMGUI_FILE!
tar -xzf !IMGUI_FILE!
::del !IMGUI_FILE!
echo.
)
for %%v in %EXTRA_VERSIONS% do (

for %%v in %EXTRA_VERSIONS% do (
echo Extracting: %%v
set IMGUI_FILE=%%v.zip
set IMGUI_FILEPATH="https://raw.githubusercontent.com/wiki/sammyfreg/netImgui/ImguiVersions/!IMGUI_FILE!"
echo !IMGUI_FILE!
curl -LJ !IMGUI_FILEPATH! --output !IMGUI_FILE!
if not exist !IMGUI_FILE! curl -LJ !IMGUI_FILEPATH! --output !IMGUI_FILE!
tar -xzf !IMGUI_FILE!
del !IMGUI_FILE!
echo.
)
popd

:SkipDownload
echo.
echo --------------------------------------------------------------------------------
echo Generating Sharpmake config for compatibility projects
echo --------------------------------------------------------------------------------
Expand All @@ -89,6 +94,8 @@ echo Dear ImGui Older versions fetched
echo Please regenerate the projects to have them included in compiling tests
echo --------------------------------------------------------------------------------
pause

popd
exit /b %errorlevel%

:: Take a Imgui install path, and make it into a NetImgui project name
Expand All @@ -99,3 +106,5 @@ exit /b %errorlevel%
set NetImguiName=%NetImguiName:.=_%
set NetImguiName=ProjectCompatibility_%NetImguiName%
exit /b 0


5 changes: 4 additions & 1 deletion Build/netImgui.sharpmake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public override void ConfigureAll(Configuration conf, NetImguiTarget target)
}

// Test compiling netImgui with the Disabled Define
[Sharpmake.Generate] public class ProjectNetImgui_Disabled : ProjectNetImgui {
[Sharpmake.Generate] public class ProjectNetImgui_Disabled : ProjectNetImgui
{
public ProjectNetImgui_Disabled() : base(NetImguiTarget.GetPath(ProjectImgui.sDefaultPath)) { Name = "NetImguiLib (Disabled)"; }

public override void ConfigureAll(Configuration conf, NetImguiTarget target)
Expand Down Expand Up @@ -148,6 +149,7 @@ public override void ConfigureAll(Configuration conf, NetImguiTarget target)
// Standard samples
//-------------------------------------------------------------------------
[Sharpmake.Generate] public class ProjectSample_Basic : ProjectSample { public ProjectSample_Basic() : base("SampleBasic"){} }
[Sharpmake.Generate] public class ProjectSample_FontDPI : ProjectSample { public ProjectSample_FontDPI() : base("SampleFontDPI"){} }
[Sharpmake.Generate] public class ProjectSample_DualUI : ProjectSample { public ProjectSample_DualUI() : base("SampleDualUI"){} }
[Sharpmake.Generate] public class ProjectSample_Textures : ProjectSample { public ProjectSample_Textures() : base("SampleTextures"){} }
[Sharpmake.Generate] public class ProjectSample_NewFrame : ProjectSample { public ProjectSample_NewFrame() : base("SampleNewFrame"){} }
Expand Down Expand Up @@ -277,6 +279,7 @@ public static void AddSampleProjects(Configuration conf, NetImguiTarget target)
{
string SolutionFolder = "Samples";
conf.AddProject<ProjectSample_Basic>(target, false, SolutionFolder);
conf.AddProject<ProjectSample_FontDPI>(target, false, SolutionFolder);
conf.AddProject<ProjectSample_DualUI>(target, false, SolutionFolder);
conf.AddProject<ProjectSample_NewFrame>(target, false, SolutionFolder);
conf.AddProject<ProjectSample_Compression>(target, false, SolutionFolder);
Expand Down
2 changes: 1 addition & 1 deletion Build/shared.sharpmake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public virtual void ConfigureAll(Configuration conf, NetImguiTarget target)
conf.Output = mIsExe ? Project.Configuration.OutputType.Exe : Project.Configuration.OutputType.Lib;

conf.IncludePaths.Add(NetImguiTarget.GetPath(ProjectImgui.sDefaultPath) + @"\backends");

conf.IncludePaths.Add(NetImguiTarget.GetPath(@"\Code\Client"));
if ( target.Compiler == Compiler.Clang ){
conf.Options.Add(Options.Vc.General.PlatformToolset.ClangCL);
conf.AdditionalCompilerOptions.Add("-Wno-unused-command-line-argument"); //Note: Latest Clang doesn't support '/MP' (multiprocessor build) option, creating a compile error
Expand Down
34 changes: 21 additions & 13 deletions Code/Client/NetImgui_Api.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
//! @Name : NetImgui
//=================================================================================================
//! @author : Sammy Fatnassi
//! @date : 2023/05/04
//! @version : v1.9
//! @date : 2023/12/2
//! @version : v1.9.7
//! @Details : For integration info : https://github.com/sammyfreg/netImgui/wiki
//=================================================================================================
#define NETIMGUI_VERSION "1.9" // Version Release 1.9
#define NETIMGUI_VERSION_NUM 10900
#define NETIMGUI_VERSION "1.9.7" // Update to samples, texture creation fix
#define NETIMGUI_VERSION_NUM 10907



Expand Down Expand Up @@ -108,9 +108,16 @@ namespace NetImgui
//=================================================================================================
// List of texture format supported
//=================================================================================================
enum eTexFormat {
kTexFmtA8,
kTexFmtRGBA8,
enum eTexFormat {
kTexFmtA8,
kTexFmtRGBA8,

// Support of 'user defined' texture format.
// Implementation must be added on both client and Server code.
// Search for TEXTURE_CUSTOM_SAMPLE for example implementation.
kTexFmtCustom,

//
kTexFmt_Count,
kTexFmt_Invalid=kTexFmt_Count
};
Expand All @@ -125,9 +132,10 @@ enum eCompressionMode {
};

//-------------------------------------------------------------------------------------------------
// Thread start function
// Function typedefs
//-------------------------------------------------------------------------------------------------
typedef void ThreadFunctPtr(void threadedFunction(void* pClientInfo), void* pClientInfo);
typedef void (*ThreadFunctPtr)(void threadedFunction(void* pClientInfo), void* pClientInfo);
typedef void (*FontCreationFuncPtr)(float PreviousDPIScale, float NewDPIScale);

//=================================================================================================
// Initialize the Network Library
Expand Down Expand Up @@ -156,8 +164,8 @@ NETIMGUI_API void Shutdown();
// threadFunction : User provided function to launch new networking thread.
// Use 'DefaultStartCommunicationThread' by default (relying on 'std::thread').
//=================================================================================================
NETIMGUI_API bool ConnectToApp(const char* clientName, const char* serverHost, uint32_t serverPort=kDefaultServerPort, ThreadFunctPtr threadFunction=0);
NETIMGUI_API bool ConnectFromApp(const char* clientName, uint32_t clientPort=kDefaultClientPort, ThreadFunctPtr threadFunction=0);
NETIMGUI_API bool ConnectToApp(const char* clientName, const char* serverHost, uint32_t serverPort=kDefaultServerPort, ThreadFunctPtr threadFunction=0, FontCreationFuncPtr FontCreateFunction = 0);
NETIMGUI_API bool ConnectFromApp(const char* clientName, uint32_t clientPort=kDefaultClientPort, ThreadFunctPtr threadFunction=0, FontCreationFuncPtr FontCreateFunction = 0);

//=================================================================================================
// Request a disconnect from the NetImguiServer application
Expand All @@ -182,7 +190,7 @@ NETIMGUI_API bool IsConnectionPending(void);
NETIMGUI_API bool IsDrawing(void);

//=================================================================================================
// True when we are currently drawinf on the NetImguiServer application
// True when we are currently drawing on the NetImguiServer application
// Means that we are between NewFrame() and EndFrame() of drawing for remote application
//=================================================================================================
NETIMGUI_API bool IsDrawingRemote(void);
Expand All @@ -191,7 +199,7 @@ NETIMGUI_API bool IsDrawingRemote(void);
// Send an updated texture used by imgui, to the NetImguiServer application
// Note: To remove a texture, set pData to nullptr
//=================================================================================================
NETIMGUI_API void SendDataTexture(ImTextureID textureId, void* pData, uint16_t width, uint16_t height, eTexFormat format);
NETIMGUI_API void SendDataTexture(ImTextureID textureId, void* pData, uint16_t width, uint16_t height, eTexFormat format, uint32_t dataSize=0);

//=================================================================================================
// Start a new Imgui Frame and wait for Draws commands, using ImContext that was active on connect.
Expand Down
Loading

0 comments on commit e4217aa

Please sign in to comment.