internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw) { byte retval = _aglSetDrawable(ctx, draw); if (retval == 0) { AglError err = GetError(); throw new Exception(ErrorString(err)); } }
internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device) { byte retval = _aglSetFullScreen(ctx, width, height, freq, device); if (retval == 0) { AglError err = GetError(); Debug.Print("AGL Error: {0}", err); Debug.Indent(); Debug.Print(ErrorString(err)); Debug.Unindent(); throw new MacOSException(err, ErrorString(err)); } }
internal static void CheckReturnValue(byte code, string function) { if (code != 0) { return; } AglError errCode = aglGetError(); if (errCode == AglError.NoError) { return; } string error = new String((sbyte *)aglErrorString(errCode)); throw new MacOSException((OSStatus)errCode, String.Format( "AGL Error from function {0}: {1} {2}", function, errCode, error)); }
internal static string ErrorString(AglError code) { return(Marshal.PtrToStringAnsi(_aglErrorString(code))); }
private static extern IntPtr _aglErrorString(AglError code);
[DllImport(agl, EntryPoint = "aglErrorString")] static extern IntPtr _aglErrorString(AglError code);
internal static string ErrorString(AglError code) { return Marshal.PtrToStringAnsi(_aglErrorString(code)); }
[DllImport(agl,EntryPoint="aglErrorString")] static extern IntPtr _aglErrorString(AglError code);
[DllImport(agl)] static extern IntPtr aglErrorString(AglError code);
static extern IntPtr aglErrorString(AglError code);