[cogl/wip/cogl-sharp: 42/51] cogl-sharp: Expose Display
- From: Damien Lespiau <dlespiau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/cogl-sharp: 42/51] cogl-sharp: Expose Display
- Date: Sat, 5 Jan 2013 16:51:49 +0000 (UTC)
commit 190a33fc1a17a675b57737cb80571d7be9986359
Author: Damien Lespiau <damien lespiau intel com>
Date: Sun Nov 4 01:15:26 2012 +0000
cogl-sharp: Expose Display
cogl-sharp/Display.cs | 73 +++++++++++++++++++++++++++++++++++++++++++++++
cogl-sharp/Makefile.am | 2 +
cogl-sharp/_Context.cs | 9 ++++++
cogl-sharp/_Display.cs | 19 ++++++++++++
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 0000000..b9205e8
--- /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 60a060d..5c3fff9 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 7a17cb0..c97638b 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 0000000..40d0c6e
--- /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 b6cc13b..2a2d73d 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': {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]