aboutsummaryrefslogtreecommitdiffstatsci
path: root/Tests/GOLIBTest_5.cs
blob: 349549ec67c39f87a7bfdec0d1eb4330afd8d600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Runtime.InteropServices;
using OpenTK;
using OpenTK.Graphics.OpenGL;

using System.Diagnostics;

//using GGL;
using Crow;
using System.Threading;
using System.Collections.Generic;


namespace test
{
	class GOLIBTest_5 : OpenTKGameWindow
	{
		public GOLIBTest_5 ()
			: base(1024, 600,"test5")
		{}

		GraphicObject c;
		List<GraphicObject> gl = new List<GraphicObject>();
		List<Label> ll = new List<Label>();
		protected override void OnLoad (EventArgs e)
		{
			base.OnLoad (e);

			c = LoadInterface("Interfaces/test5.goml");
			gl.Add (c.FindByName ("g0"));
			ll.Add (c.FindByName ("lab0")as Label);
		}

		int cpt;
		protected override void OnUpdateFrame (FrameEventArgs e)
		{
			if (cpt > 100)
				cpt = 0;
			else
				cpt++;

			foreach (Label l in ll) {
				l.Text = cpt.ToString ();
			}
			foreach (GraphicObject o in gl) {
				Color a = (Color)o.Background;
				if (a.A > 1)
					a.A = 0;
				else
					a.A += 0.05;
				//a.A = 0.5;
				o.Background = a;
				o.Width = cpt + 10;
			}
			base.OnUpdateFrame (e);
		}

		[STAThread]
		static void Main ()
		{
			using (GOLIBTest_5 win = new GOLIBTest_5( )) {
				win.Run (30.0);
			}
		}
	}
}