Browse Source

Changing the LICENSE to MIT & Types update

- Adding operator overloading for ImVec2
Coldzer0 1 year ago
parent
commit
686a5dcc3b
1 changed files with 22 additions and 5 deletions
  1. 22 5
      src/PasImGui.Types.pas

+ 22 - 5
src/PasImGui.Types.pas

@@ -4,13 +4,12 @@
   Copyright (C) 2023 Coldzer0 <Coldzer0 [at] protonmail.ch>
   Copyright (C) 2023 Coldzer0 <Coldzer0 [at] protonmail.ch>
 
 
   This program is free software: you can redistribute it and/or modify
   This program is free software: you can redistribute it and/or modify
-  it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by
-  the Free Software Foundation, version 3 of the License.
+  it under the terms of the MIT License.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU LESSER GENERAL PUBLIC LICENSE for more details.
+  MIT License for more details.
 }
 }
 
 
 Unit PasImGui.Types;
 Unit PasImGui.Types;
@@ -30,6 +29,12 @@ Uses
 Const
 Const
   FLT_MAX : Single = 3.40282347e+038; // This is the same as in compiled cimgui
   FLT_MAX : Single = 3.40282347e+038; // This is the same as in compiled cimgui
 
 
+  IM_COL32_R_SHIFT = 0;
+  IM_COL32_G_SHIFT = 8;
+  IM_COL32_B_SHIFT = 16;
+  IM_COL32_A_SHIFT = 24;
+  IM_COL32_A_MASK  = $FF000000;
+
 // Main Types
 // Main Types
 Type
 Type
   T30Bits = 0..1073741823;
   T30Bits = 0..1073741823;
@@ -380,6 +385,8 @@ Type
   ImVec2 = Record
   ImVec2 = Record
     x, y: Single;
     x, y: Single;
     constructor New(const _x, _y: Single);
     constructor New(const _x, _y: Single);
+    class operator Add(lhs,rhs : ImVec2) : ImVec2;
+    class operator Subtract(lhs,rhs : ImVec2) : ImVec2;
   End;
   End;
   PImVec2 = ^ImVec2;
   PImVec2 = ^ImVec2;
 
 
@@ -393,7 +400,7 @@ Type
   { ImVec4 }
   { ImVec4 }
   ImVec4 = Record
   ImVec4 = Record
     x, y, z, w: Single;
     x, y, z, w: Single;
-    constructor New(const _x, _y, _z, _w: Single);
+    constructor New(const _x, _y, _z : Single; _w: Single = 1.0);
   End;
   End;
   PImVec4 = ^ImVec4;
   PImVec4 = ^ImVec4;
 
 
@@ -2475,6 +2482,16 @@ Begin
   Self.y := _y;
   Self.y := _y;
 End;
 End;
 
 
+class operator ImVec2.Add(lhs, rhs: ImVec2): ImVec2;
+begin
+  Result := ImVec2.new(lhs.x + rhs.x, lhs.y + rhs.y);
+end;
+
+class operator ImVec2.Subtract(lhs, rhs: ImVec2): ImVec2;
+begin
+  Result := ImVec2.new(lhs.x - rhs.x, lhs.y - rhs.y);
+end;
+
 { ImVec3 }
 { ImVec3 }
 
 
 constructor ImVec3.New(const _x, _y, _z: Single);
 constructor ImVec3.New(const _x, _y, _z: Single);
@@ -2486,7 +2503,7 @@ end;
 
 
 { ImVec4 }
 { ImVec4 }
 
 
-constructor ImVec4.New(const _x, _y, _z, _w: Single);
+constructor ImVec4.New(const _x, _y, _z: Single; _w: Single);
 begin
 begin
   Self.x := _x;
   Self.x := _x;
   Self.y := _y;
   Self.y := _y;