Преглед изворни кода

Moved Color to types file.

Kapendev пре 1 година
родитељ
комит
c499b694a7
3 измењених фајлова са 32 додато и 38 уклоњено
  1. 1 1
      generating.md
  2. 5 37
      source/raylib/package.d
  3. 26 0
      source/raylib/raylib_types.d

+ 1 - 1
generating.md

@@ -14,7 +14,7 @@ Run the following command from the `raylib/src` directory. Note: path/to/raylib-
 
 ```
 dstep raylib.h raymath.h rlgl.h rcamera.h -o path/to/raylib-d/source/raylib --space-after-function-name=false \
-    --skip Vector2 --skip Vector3 --skip Vector4 --skip Quaternion --skip Matrix --skip Rectangle \
+    --skip Vector2 --skip Vector3 --skip Vector4 --skip Quaternion --skip Matrix --skip Rectangle --skip Color \
     --skip RL_MALLOC --skip RL_CALLOC --skip RL_REALLOC --skip RL_FREE
 ```
 

+ 5 - 37
source/raylib/package.d

@@ -174,43 +174,11 @@ extern (D) auto CLITERAL(T)(auto ref T type)
 // Matrix fourth row (4 components)
 
 // Color, 4 components, R8G8B8A8 (32bit)
-struct Color
-{
-    ubyte r; // Color red value
-    ubyte g; // Color green value
-    ubyte b; // Color blue value
-    ubyte a = 255; // Color alpha value
-
-    @safe @nogc nothrow:
-
-    this(ubyte r, ubyte g, ubyte b, ubyte a) {
-        this.r = r;
-        this.g = g;
-        this.b = b;
-        this.a = a;
-    }
-
-    this(ubyte r, ubyte g, ubyte b) {
-        this(r, g, b, 255);
-    }
-
-    this(ubyte[4] rgba) {
-        this(rgba[0], rgba[1], rgba[2], rgba[3]);
-    }
-
-    this(ubyte[3] rgb) {
-        this(rgb[0], rgb[1], rgb[2], 255);
-    }
-
-    this(uint rgba) {
-        this(
-            (rgba & 0xFF000000) >> 24,
-            (rgba & 0xFF0000) >> 16,
-            (rgba & 0xFF00) >> 8,
-            (rgba & 0xFF),
-        );
-    }
-}
+
+// Color red value
+// Color green value
+// Color blue value
+// Color alpha value
 
 // Rectangle, 4 components
 

+ 26 - 0
source/raylib/raylib_types.d

@@ -104,6 +104,32 @@ struct Rectangle
     }
 }
 
+// Color type, R8G8B8A8 (32bit)
+struct Color
+{
+    ubyte r;
+    ubyte g;
+    ubyte b;
+    ubyte a = 255;
+
+    @safe @nogc nothrow:
+
+    this(ubyte r, ubyte g, ubyte b, ubyte a = 255) {
+        this.r = r;
+        this.g = g;
+        this.b = b;
+        this.a = a;
+    }
+
+    this(ubyte[4] rgba) {
+        this(rgba[0], rgba[1], rgba[2], rgba[3]);
+    }
+
+    this(ubyte[3] rgb) {
+        this(rgb[0], rgb[1], rgb[2], 255);
+    }
+}
+
 enum Colors
 {
     // Some Basic Colors