summaryrefslogtreecommitdiff
path: root/modules/mono/glue/cs_files
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2018-04-18 15:52:12 -0500
committerAaron Franke <arnfranke@yahoo.com>2018-07-25 15:34:24 -0500
commite3368d692d39d33c657cf985e46a45d43fc31546 (patch)
tree2416bb3f8f1d3f8e6d6b6f32fa0e144098432510 /modules/mono/glue/cs_files
parente38051970c73713948544a96a27012b30d59d444 (diff)
[Mono] Fix Color incorrect ordering of int export methods, added 64-bit
[Mono] Fix Color incorrect ordering of int export methods, added 64-bit long export methods.
Diffstat (limited to 'modules/mono/glue/cs_files')
-rw-r--r--modules/mono/glue/cs_files/Color.cs83
-rwxr-xr-xmodules/mono/glue/cs_files/VERSION.txt2
2 files changed, 74 insertions, 11 deletions
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs
index e0d6d27840..1195071bd3 100644
--- a/modules/mono/glue/cs_files/Color.cs
+++ b/modules/mono/glue/cs_files/Color.cs
@@ -293,28 +293,80 @@ namespace Godot
return res;
}
- public int ToRgba32()
+ public int ToAbgr32()
{
- int c = (byte)(r * 255);
+ int c = (byte)Math.Round(a * 255);
c <<= 8;
- c |= (byte)(g * 255);
+ c |= (byte)Math.Round(b * 255);
c <<= 8;
- c |= (byte)(b * 255);
+ c |= (byte)Math.Round(g * 255);
c <<= 8;
- c |= (byte)(a * 255);
+ c |= (byte)Math.Round(r * 255);
+
+ return c;
+ }
+
+ public long ToAbgr64()
+ {
+ long c = (ushort)Math.Round(a * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(b * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(g * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(r * 65535);
return c;
}
public int ToArgb32()
{
- int c = (byte)(a * 255);
+ int c = (byte)Math.Round(a * 255);
+ c <<= 8;
+ c |= (byte)Math.Round(r * 255);
+ c <<= 8;
+ c |= (byte)Math.Round(g * 255);
+ c <<= 8;
+ c |= (byte)Math.Round(b * 255);
+
+ return c;
+ }
+
+ public long ToArgb64()
+ {
+ long c = (ushort)Math.Round(a * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(r * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(g * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(b * 65535);
+
+ return c;
+ }
+
+ public int ToRgba32()
+ {
+ int c = (byte)Math.Round(r * 255);
c <<= 8;
- c |= (byte)(r * 255);
+ c |= (byte)Math.Round(g * 255);
c <<= 8;
- c |= (byte)(g * 255);
+ c |= (byte)Math.Round(b * 255);
c <<= 8;
- c |= (byte)(b * 255);
+ c |= (byte)Math.Round(a * 255);
+
+ return c;
+ }
+
+ public long ToRgba64()
+ {
+ long c = (ushort)Math.Round(r * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(g * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(b * 65535);
+ c <<= 16;
+ c |= (ushort)Math.Round(a * 65535);
return c;
}
@@ -353,6 +405,17 @@ namespace Godot
r = (rgba & 0xFF) / 255.0f;
}
+ public Color(long rgba)
+ {
+ a = (rgba & 0xFFFF) / 65535.0f;
+ rgba >>= 16;
+ b = (rgba & 0xFFFF) / 65535.0f;
+ rgba >>= 16;
+ g = (rgba & 0xFFFF) / 65535.0f;
+ rgba >>= 16;
+ r = (rgba & 0xFFFF) / 65535.0f;
+ }
+
private static int _parse_col(string str, int ofs)
{
int ig = 0;
@@ -392,7 +455,7 @@ namespace Godot
private String _to_hex(float val)
{
- var v = (int) Mathf.Clamp(val * 255.0f, 0, 255);
+ int v = Mathf.RoundToInt(Mathf.Clamp(val * 255, 0, 255));
var ret = string.Empty;
diff --git a/modules/mono/glue/cs_files/VERSION.txt b/modules/mono/glue/cs_files/VERSION.txt
index 7ed6ff82de..1e8b314962 100755
--- a/modules/mono/glue/cs_files/VERSION.txt
+++ b/modules/mono/glue/cs_files/VERSION.txt
@@ -1 +1 @@
-5
+6