diff options
| -rw-r--r-- | Tests/GOLIBTest_0.cs | 4 | ||||
| -rw-r--r-- | Tests/GOLIBTest_4.cs | 4 | ||||
| -rw-r--r-- | Tests/GOLIBTest_5.cs | 4 | ||||
| -rw-r--r-- | Tests/GOLIBTest_Listbox.cs | 9 | ||||
| -rw-r--r-- | src/Interface.cs | 38 | ||||
| -rwxr-xr-x | src/OpenTKGameWindow.cs | 13 |
6 files changed, 10 insertions, 62 deletions
diff --git a/Tests/GOLIBTest_0.cs b/Tests/GOLIBTest_0.cs index 88cd45e9..a41cdb41 100644 --- a/Tests/GOLIBTest_0.cs +++ b/Tests/GOLIBTest_0.cs @@ -22,13 +22,13 @@ namespace test6 : base(1024, 600,"test")
{}
- Border g;
+ GraphicObject g;
Label l;
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- LoadInterface("Interfaces/test0.goml", out g);
+ g = LoadInterface("Interfaces/test0.goml");
l = g.FindByName ("labCpt") as Label;
}
diff --git a/Tests/GOLIBTest_4.cs b/Tests/GOLIBTest_4.cs index 8adb5064..c1f2e0ad 100644 --- a/Tests/GOLIBTest_4.cs +++ b/Tests/GOLIBTest_4.cs @@ -66,7 +66,7 @@ namespace test }
#endregion
- Group c,c2;
+ GraphicObject c;
ProgressBar pb, pb2;
Label labMousePos, labPb, labF, labA, labH, labFps, labFpsMin, labFpsMax, labV,
labUpdate;
@@ -83,7 +83,7 @@ namespace test {
base.OnLoad (e);
- LoadInterface("Interfaces/test4.goml", out c);
+ c = LoadInterface("Interfaces/test4.goml");
//LoadInterface("golibtests/test4.xml", out c2);
//c2.HorizontalAlignment = HorizontalAlignment.Left;
//c2.VerticalAlignment = VerticalAlignment.Top;
diff --git a/Tests/GOLIBTest_5.cs b/Tests/GOLIBTest_5.cs index 1969bcf1..d5a8a343 100644 --- a/Tests/GOLIBTest_5.cs +++ b/Tests/GOLIBTest_5.cs @@ -20,14 +20,14 @@ namespace test : base(1024, 600,"test5")
{}
- Container c;
+ GraphicObject c;
List<GraphicObject> gl = new List<GraphicObject>();
List<Label> ll = new List<Label>();
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- LoadInterface("Interfaces/test5.goml", out c);
+ c = LoadInterface("Interfaces/test5.goml");
gl.Add (c.FindByName ("g0"));
ll.Add (c.FindByName ("lab0")as Label);
}
diff --git a/Tests/GOLIBTest_Listbox.cs b/Tests/GOLIBTest_Listbox.cs index 815acfd2..f3064dd1 100644 --- a/Tests/GOLIBTest_Listbox.cs +++ b/Tests/GOLIBTest_Listbox.cs @@ -80,24 +80,17 @@ namespace test // "string 2",
// "string 3"
// };
- ListBox g;
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- LoadInterface("Interfaces/test_Listbox.goml", out g);
+ LoadInterface("Interfaces/test_Listbox.goml");
// TestList [1].Field = "test string";
// ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", null, TestList));
}
- protected override void OnRenderFrame (FrameEventArgs e)
- {
- GL.Clear (ClearBufferMask.ColorBufferBit);
- base.OnRenderFrame (e);
- SwapBuffers ();
- }
protected override void OnUpdateFrame (FrameEventArgs e)
{
diff --git a/src/Interface.cs b/src/Interface.cs index 63160cf5..2fea548a 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -87,6 +87,7 @@ namespace go } return stream; } + public static GraphicObject Load(string path, object hostClass = null) { string root = "Object"; @@ -112,42 +113,7 @@ namespace go stream.Dispose (); return tmp; } - public static void Load<T>(string file, out T result, object hostClass = null) - { - GOMLResolutionStack.Push(new List<DynAttribute>()); - - XmlSerializerNamespaces xn = new XmlSerializerNamespaces(); - xn.Add("", ""); - XmlSerializer xs = new XmlSerializer(typeof(T)); - - using (Stream s = new FileStream(file, FileMode.Open)) - { - result = (T)xs.Deserialize(s); - } - - if (hostClass == null) - return; - - resolveGOML (hostClass); - -// while (Bindings.Count > 0) { -// DynAttribute binding = Bindings [0]; -// Bindings.RemoveAt (0); -// CompilerServices.ResolveBinding (binding, hostClass); -// } -// foreach (DynAttribute binding in Bindings) { -//// Type tSource = binding.Source.GetType (); -//// if (!tSource.GetInterfaces ().Any (i => i.Name == "IValueChange")){ -//// Debug.WriteLine ("Binding source does not implement IValueChange."); -//// continue; -//// } -// //MemberInfo mi = binding.Source.GetType ().GetMember (binding.MemberName); -// CompilerServices.CreateBinding (binding, hostClass); -// } -// Bindings.Clear (); - } - - public static GraphicObject Load(Stream stream, Type type, object hostClass = null) + static GraphicObject Load(Stream stream, Type type, object hostClass = null) { GraphicObject result; GOMLResolutionStack.Push(new List<DynAttribute>()); diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index fa68cb89..355ae304 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -313,18 +313,6 @@ namespace go #endregion
#region loading
- public void LoadInterface<T>(string path, out T result)
- {
- Interface.Load<T> (path, out result, this);
- AddWidget (result as GraphicObject);
- }
- public T LoadInterface<T> (string Path)
- {
- T result;
- Interface.Load<T> (Path, out result, this);
- AddWidget (result as GraphicObject);
- return result;
- }
public GraphicObject LoadInterface (string path)
{
GraphicObject tmp = Interface.Load (path, this);
@@ -340,6 +328,7 @@ namespace go {
GL.Clear (ClearBufferMask.ColorBufferBit);
}
+
#region Game win overrides
protected override void OnUpdateFrame(FrameEventArgs e)
{
|