diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2012-11-04 01:15:26 +0000 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2013-01-04 20:29:36 +0000 |
commit | 190a33fc1a17a675b57737cb80571d7be9986359 (patch) | |
tree | 1dbdb5178d18b50d5d63ede5eec43d23b43ea48f | |
parent | 7e42974ec072355d1a59747115899db058d7bd30 (diff) | |
download | cogl-190a33fc1a17a675b57737cb80571d7be9986359.tar.gz |
cogl-sharp: Expose Display
-rw-r--r-- | cogl-sharp/Display.cs | 73 | ||||
-rw-r--r-- | cogl-sharp/Makefile.am | 2 | ||||
-rw-r--r-- | cogl-sharp/_Context.cs | 9 | ||||
-rw-r--r-- | cogl-sharp/_Display.cs | 19 | ||||
-rwxr-xr-x | cogl-sharp/parse-gir.py | 6 |
5 files changed, 109 insertions, 0 deletions
diff --git a/cogl-sharp/Display.cs b/cogl-sharp/Display.cs new file mode 100644 index 00000000..b9205e8d --- /dev/null +++ b/cogl-sharp/Display.cs @@ -0,0 +1,73 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * This library 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; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authors: + * Damien Lespiau <damien.lespiau@intel.com> + */ +using System; +using System.Runtime.InteropServices; + +namespace Cogl +{ + public partial class Display : Cogl.Object + { + public Display(IntPtr h) : base(h) {} + + [DllImport("cogl2.dll")] + private static extern IntPtr cogl_display_new(IntPtr renderer, + IntPtr template); + + public Display() + { + handle = cogl_display_new(IntPtr.Zero, IntPtr.Zero); + } + + public Display(Renderer renderer, OnScreenTemplate template) + { + IntPtr r, t; + + if (renderer == null) + r = IntPtr.Zero; + else + r = renderer.Handle; + + if (template == null) + t = IntPtr.Zero; + else + t = template.Handle; + + handle = cogl_display_new(r, t); + } + + [DllImport("cogl2.dll")] + private static extern bool cogl_display_setup(IntPtr display, + out IntPtr error); + + public void Setup() + { + IntPtr error; + + cogl_display_setup(handle, out error); + if (error != IntPtr.Zero) + throw new Cogl.Exception(error); + } + } +} diff --git a/cogl-sharp/Makefile.am b/cogl-sharp/Makefile.am index 60a060df..5c3fff9e 100644 --- a/cogl-sharp/Makefile.am +++ b/cogl-sharp/Makefile.am @@ -14,6 +14,8 @@ sources = \ ColorMask.cs \ Context.cs \ _Context.cs \ + Display.cs \ + _Display.cs \ Driver.cs \ Exception.cs \ FrameBuffer.cs \ diff --git a/cogl-sharp/_Context.cs b/cogl-sharp/_Context.cs index 7a17cb0f..c97638b3 100644 --- a/cogl-sharp/_Context.cs +++ b/cogl-sharp/_Context.cs @@ -6,5 +6,14 @@ namespace Cogl { public partial class Context { + [DllImport("cogl2.dll")] + public static extern IntPtr cogl_context_get_display(IntPtr o); + + public Display GetDisplay() + { + IntPtr p = cogl_context_get_display(handle); + return new Display(p); + } + } } diff --git a/cogl-sharp/_Display.cs b/cogl-sharp/_Display.cs new file mode 100644 index 00000000..40d0c6e3 --- /dev/null +++ b/cogl-sharp/_Display.cs @@ -0,0 +1,19 @@ +/* This file has been generated by parse-gir.py, do not hand edit */ +using System; +using System.Runtime.InteropServices; + +namespace Cogl +{ + public partial class Display + { + [DllImport("cogl2.dll")] + public static extern IntPtr cogl_display_get_renderer(IntPtr o); + + public Renderer GetRenderer() + { + IntPtr p = cogl_display_get_renderer(handle); + return new Renderer(p); + } + + } +} diff --git a/cogl-sharp/parse-gir.py b/cogl-sharp/parse-gir.py index b6cc13b4..2a2d73dd 100755 --- a/cogl-sharp/parse-gir.py +++ b/cogl-sharp/parse-gir.py @@ -25,6 +25,7 @@ enum_types = ( # object types to dump (.gir names) object_types = ( "Context", + "Display", "Framebuffer", "Onscreen", "OnscreenTemplate", @@ -47,6 +48,11 @@ hand_written_types = ( # maps from .gir names to cogl-sharp types/methods name_overrides = { + 'Display': { + 'handwritten': ( + 'setup' + ), + }, 'Framebuffer': { 'class': 'FrameBuffer', 'methods': { |