瀏覽代碼

Support For 32bit on Windows And ImPlot APIs

Coldzer0 1 年之前
父節點
當前提交
d1c82640a6

+ 22 - 0
License-Chet.txt

@@ -0,0 +1,22 @@
+Copyright (c) 2018 by Erik van Bilsen
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 2 - 2
PasImGui_SDL2_OpenGL3_Demo/ImGui_SDL2_OpenGL3_Demo.dpr

@@ -258,7 +258,7 @@ Begin
   SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
   SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
   {$ELSE}
-  // GL 3.0 + GLSL 130
+  // GL 4.1 uses GLSL 4.10
   glsl_version := '#version 410';
   SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
   SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
@@ -305,7 +305,7 @@ Begin
 
   // Enable Logging
   ImGuiCtx := ImGui.GetCurrentContext();
-  ImGuiCtx^.LogType := ImGuiLogType_File;
+  ImGuiCtx^.LogType := ImGuiLogType_TTY;
   ImGuiCtx^.LogEnabled := True;
 
   // Enable Keyboard Controls

+ 5 - 5
PasImGui_SDL2_OpenGL3_Demo/ImGui_SDL2_OpenGL3_Demo.lpi

@@ -36,7 +36,7 @@
           </Target>
           <SearchPaths>
             <IncludeFiles Value="$(ProjOutDir);..\src"/>
-            <Libraries Value="..\libs\FPC\win32"/>
+            <Libraries Value="..\libs\static\win32"/>
             <OtherUnitFiles Value="..\src;..\impl;..\OpenGL3;..\SDL2-for-Pascal\units;..\examples"/>
             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
           </SearchPaths>
@@ -78,7 +78,7 @@
           </Target>
           <SearchPaths>
             <IncludeFiles Value="$(ProjOutDir);..\src"/>
-            <Libraries Value="..\libs\FPC\win32"/>
+            <Libraries Value="..\libs\static\win32"/>
             <OtherUnitFiles Value="..\src;..\impl;..\OpenGL3;..\SDL2-for-Pascal\units;..\examples"/>
             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
           </SearchPaths>
@@ -108,7 +108,7 @@
           </Target>
           <SearchPaths>
             <IncludeFiles Value="$(ProjOutDir);..\src"/>
-            <Libraries Value="..\libs\FPC\win64"/>
+            <Libraries Value="..\libs\static\win64"/>
             <OtherUnitFiles Value="..\src;..\impl;..\OpenGL3;..\SDL2-for-Pascal\units;..\examples"/>
             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
           </SearchPaths>
@@ -145,7 +145,7 @@
           </Target>
           <SearchPaths>
             <IncludeFiles Value="$(ProjOutDir);..\src"/>
-            <Libraries Value="..\libs\FPC\win64"/>
+            <Libraries Value="..\libs\static\win64"/>
             <OtherUnitFiles Value="..\src;..\impl;..\OpenGL3;..\SDL2-for-Pascal\units;..\examples"/>
             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
           </SearchPaths>
@@ -173,7 +173,7 @@
           </Target>
           <SearchPaths>
             <IncludeFiles Value="$(ProjOutDir);..\src"/>
-            <Libraries Value="..\libs\FPC\linux64"/>
+            <Libraries Value="..\libs\static\linux64"/>
             <OtherUnitFiles Value="..\src;..\impl;..\OpenGL3;..\SDL2-for-Pascal\units;..\examples"/>
             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
           </SearchPaths>

+ 28 - 17
PasImGui_SDL2_OpenGL3_Demo/ImGui_SDL2_OpenGL3_Demo.lps

@@ -10,8 +10,8 @@
         <Filename Value="ImGui_SDL2_OpenGL3_Demo.dpr"/>
         <IsPartOfProject Value="True"/>
         <IsVisibleTab Value="True"/>
-        <TopLine Value="233"/>
-        <CursorPos X="2" Y="235"/>
+        <TopLine Value="392"/>
+        <CursorPos Y="421"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
       </Unit0>
@@ -27,15 +27,14 @@
         <IsPartOfProject Value="True"/>
         <EditorIndex Value="-1"/>
         <TopLine Value="85"/>
-        <CursorPos X="23" Y="95"/>
-        <UsageCount Value="107"/>
+        <UsageCount Value="111"/>
       </Unit2>
       <Unit3>
         <Filename Value="..\src\PasImGui.Apis.pas"/>
         <IsPartOfProject Value="True"/>
         <EditorIndex Value="-1"/>
         <CursorPos X="14" Y="8"/>
-        <UsageCount Value="107"/>
+        <UsageCount Value="111"/>
       </Unit3>
       <Unit4>
         <Filename Value="..\impl\PasImGui.Backend.SDL2.pas"/>
@@ -43,7 +42,7 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="121"/>
         <CursorPos X="40" Y="124"/>
-        <UsageCount Value="107"/>
+        <UsageCount Value="111"/>
       </Unit4>
       <Unit5>
         <Filename Value="..\impl\PasImGui.Renderer.OpenGL3.pas"/>
@@ -51,7 +50,7 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="689"/>
         <CursorPos X="27" Y="703"/>
-        <UsageCount Value="111"/>
+        <UsageCount Value="115"/>
       </Unit5>
       <Unit6>
         <Filename Value="..\impl\glad_gl.pas"/>
@@ -59,7 +58,7 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="2456"/>
         <CursorPos X="56" Y="2472"/>
-        <UsageCount Value="107"/>
+        <UsageCount Value="111"/>
       </Unit6>
       <Unit7>
         <Filename Value="..\impl\glfw.pas"/>
@@ -68,13 +67,13 @@
         <WindowIndex Value="-1"/>
         <TopLine Value="-1"/>
         <CursorPos X="-1" Y="-1"/>
-        <UsageCount Value="107"/>
+        <UsageCount Value="111"/>
       </Unit7>
       <Unit8>
         <Filename Value="..\examples\CustomNodeGraph.pas"/>
         <IsPartOfProject Value="True"/>
         <EditorIndex Value="1"/>
-        <UsageCount Value="70"/>
+        <UsageCount Value="74"/>
         <Loaded Value="True"/>
       </Unit8>
       <Unit9>
@@ -84,7 +83,7 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="16"/>
         <CursorPos X="12" Y="37"/>
-        <UsageCount Value="70"/>
+        <UsageCount Value="74"/>
       </Unit9>
       <Unit10>
         <Filename Value="..\src\PasImGui.Utils.pas"/>
@@ -92,7 +91,7 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="61"/>
         <CursorPos Y="63"/>
-        <UsageCount Value="70"/>
+        <UsageCount Value="74"/>
       </Unit10>
       <Unit11>
         <Filename Value="..\src\PasImGui.ImPlot.pas"/>
@@ -100,7 +99,7 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="9"/>
         <CursorPos X="31" Y="25"/>
-        <UsageCount Value="45"/>
+        <UsageCount Value="49"/>
       </Unit11>
       <Unit12>
         <Filename Value="testwindow.pas"/>
@@ -341,7 +340,7 @@
       <Unit47>
         <Filename Value="..\src\PasImGui.pas"/>
         <EditorIndex Value="-1"/>
-        <TopLine Value="19"/>
+        <TopLine Value="115"/>
         <UsageCount Value="47"/>
       </Unit47>
       <Unit48>
@@ -480,8 +479,8 @@
       <Unit67>
         <Filename Value="..\src\PasImGui.Apis.inc"/>
         <EditorIndex Value="-1"/>
-        <TopLine Value="11258"/>
-        <CursorPos X="3" Y="2"/>
+        <TopLine Value="1013"/>
+        <CursorPos X="19" Y="1028"/>
         <UsageCount Value="18"/>
       </Unit67>
       <Unit68>
@@ -526,7 +525,7 @@
         <UsageCount Value="10"/>
       </Unit73>
     </Units>
-    <JumpHistory Count="16" HistoryIndex="15">
+    <JumpHistory Count="19" HistoryIndex="18">
       <Position1>
         <Filename Value="ImGui_SDL2_OpenGL3_Demo.dpr"/>
         <Caret Line="413" Column="48" TopLine="401"/>
@@ -591,6 +590,18 @@
         <Filename Value="ImGui_SDL2_OpenGL3_Demo.dpr"/>
         <Caret Line="278" Column="81" TopLine="37"/>
       </Position16>
+      <Position17>
+        <Filename Value="ImGui_SDL2_OpenGL3_Demo.dpr"/>
+        <Caret Line="270" Column="42" TopLine="8"/>
+      </Position17>
+      <Position18>
+        <Filename Value="ImGui_SDL2_OpenGL3_Demo.dpr"/>
+        <Caret Line="50" Column="14" TopLine="81"/>
+      </Position18>
+      <Position19>
+        <Filename Value="ImGui_SDL2_OpenGL3_Demo.dpr"/>
+        <Caret Line="403" Column="31" TopLine="392"/>
+      </Position19>
     </JumpHistory>
     <RunParams>
       <FormatVersion Value="2"/>

二進制
PasImGui_SDL2_OpenGL3_Demo/Linux64/ImGui_SDL2_OpenGL3_Demo


二進制
PasImGui_SDL2_OpenGL3_Demo/Win32/ImGui_SDL2_OpenGL3_Demo.exe


二進制
PasImGui_SDL2_OpenGL3_Demo/Win64/ImGui_SDL2_OpenGL3_Demo.exe


+ 18 - 3
README.md

@@ -10,6 +10,10 @@ The Binding is based on [cimgui](https://github.com/cimgui/cimgui)
 
 #### Running on Windows
 
+##### ImPlot
+<img src="screenshots/impot.png">
+<br>
+
 ##### FreePascal
 <img src="screenshots/fonts.png">
 <br>
@@ -21,6 +25,9 @@ The Binding is based on [cimgui](https://github.com/cimgui/cimgui)
 #### Running on Linux (FreePascal)
 <img src="screenshots/linux.jpg">
 
+##### ImPlot
+<img src="screenshots/implot_linux.jpg">
+
 ## Building
 - Tested with FreePascal 3.2 and later.
 - Tested with Delphi 12.0
@@ -31,18 +38,21 @@ Check the demo project for more info.
 
 ### TODO
 - Add missing APIs to our `ImGui Class`
+- Add missing APIs to our `ImPlot Class`
 - Add record helpers for some records like `ImGuiIO` & all `ImVector_xxx` records
-- Add Support for [cimplot](https://github.com/cimgui/cimplot)
-- Add Support for [cimnodes](https://github.com/cimgui/cimnodes)
-- Add Support for [cimnodes_r](https://github.com/cimgui/cimnodes_r)
+- Add Support for [cimnodes](https://github.com/cimgui/cimnodes) or [cimnodes_r](https://github.com/cimgui/cimnodes_r)
 - Test on Mac
 
+### In Progress
+- Added APIs for [cimplot](https://github.com/cimgui/cimplot)
+
 ## Acknowledgements & Resources :
 
 #### Inspired by the work of David Pethes [imgui-pas](https://github.com/dpethes/imgui-pas) 
 
 
 #### Used Projects :
+- [Chet](https://github.com/neslib/Chet)
 - [cimgui](https://github.com/cimgui/cimgui)
 - [imgui-pas](https://github.com/dpethes/imgui-pas)
 - [SDL2 Project](https://github.com/libsdl-org/SDL/tree/SDL2)
@@ -52,6 +62,11 @@ Check the demo project for more info.
 - [ChatGPT](https://chat.openai.com)
 
 ### Change log
+##### 29/11/2023
+- A Full rework for the APIs 
+- Adding ImPlot Support ( APIs Still in progress )
+- Support windows 32bit
+
 ##### 17/11/2023
 - Allow static linking on windows with FPC ( no static for Delphi :P )
 - And wrote the entire `OpenGL3 renderer` in `Pure-Pascal` 

+ 1 - 1
SDL2-for-Pascal/units/sdl2.pas

@@ -93,7 +93,7 @@ interface
   {$ENDIF}
 
 {$IfNDef DYNAMIC_LINK}
-  {$LinkLib SDL2}
+  {$LinkLib 'libSDL2.a'}
 {$ELSE}
 const
 

二進制
screenshots/implot_linux.jpg


二進制
screenshots/impot.png