Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono] Improvements to GD.cs: PascalCasing and real_t #20337

Merged
merged 1 commit into from
Jul 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions modules/mono/glue/cs_files/GD.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System;
#if REAL_T_IS_DOUBLE
using real_t = System.Double;
#else
using real_t = System.Single;
#endif

// TODO: Add comments describing what this class does. It is not obvious.

Expand All @@ -16,22 +21,22 @@ public static object Convert(object what, int type)
return NativeCalls.godot_icall_Godot_convert(what, type);
}

public static float Db2Linear(float db)
public static real_t Db2Linear(real_t db)
{
return (float)Math.Exp(db * 0.11512925464970228420089957273422);
return (real_t)Math.Exp(db * 0.11512925464970228420089957273422);
}

public static float Dectime(float value, float amount, float step)
public static real_t DecTime(real_t value, real_t amount, real_t step)
{
float sgn = value < 0 ? -1.0f : 1.0f;
float val = Mathf.Abs(value);
real_t sgn = Mathf.Sign(value);
real_t val = Mathf.Abs(value);
val -= amount * step;
if (val < 0.0f)
val = 0.0f;
if (val < 0)
val = 0;
return val * sgn;
}

public static FuncRef Funcref(Object instance, string funcname)
public static FuncRef FuncRef(Object instance, string funcname)
{
var ret = new FuncRef();
ret.SetInstance(instance);
Expand All @@ -49,9 +54,9 @@ public static Object InstanceFromId(int instanceId)
return NativeCalls.godot_icall_Godot_instance_from_id(instanceId);
}

public static double Linear2Db(double linear)
public static real_t Linear2Db(real_t linear)
{
return Math.Log(linear) * 8.6858896380650365530225783783321;
return (real_t)(Math.Log(linear) * 8.6858896380650365530225783783321);
}

public static Resource Load(string path)
Expand All @@ -69,22 +74,22 @@ public static void PrintStack()
Print(System.Environment.StackTrace);
}

public static void Printerr(params object[] what)
public static void PrintErr(params object[] what)
{
NativeCalls.godot_icall_Godot_printerr(what);
}

public static void Printraw(params object[] what)
public static void PrintRaw(params object[] what)
{
NativeCalls.godot_icall_Godot_printraw(what);
}

public static void Prints(params object[] what)
public static void PrintS(params object[] what)
{
NativeCalls.godot_icall_Godot_prints(what);
}

public static void Printt(params object[] what)
public static void PrintT(params object[] what)
{
NativeCalls.godot_icall_Godot_printt(what);
}
Expand Down Expand Up @@ -183,7 +188,7 @@ public static string Var2Str(object var)
return NativeCalls.godot_icall_Godot_var2str(var);
}

public static WeakRef Weakref(Object obj)
public static WeakRef WeakRef(Object obj)
{
return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
}
Expand Down
2 changes: 1 addition & 1 deletion modules/mono/glue/cs_files/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4
5