aboutsummaryrefslogtreecommitdiffstatsci
path: root/Tests/GOLIBTest_deviceOffset.cs
blob: 96486db300a68e487af9f113c2ad51405b0cc8c6 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#define MONO_CAIRO_DEBUG_DISPOSE


using System;
using System.Runtime.InteropServices;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;

using System.Diagnostics;

//using GGL;
using go;
using System.Threading;


namespace test6
{
	class GOLIBTest_0 : OpenTKGameWindow
	{
		public GOLIBTest_0 ()
			: base(1024, 600,"test")
		{}

		GraphicObject g;
		Label l;

		protected override void OnLoad (EventArgs e)
		{
			base.OnLoad (e);
			g = LoadInterface("Interfaces/test0.goml");
			l = g.FindByName ("labCpt") as Label;
		}

		void onUp (object sender, MouseButtonEventArgs e)
		{
			decimal tmp = 0;
			if (!decimal.TryParse (l.Text, out tmp))
				return;
			
			tmp += 1;
			l.Text = tmp.ToString ();
		}
		void onDown (object sender, MouseButtonEventArgs e)
		{
			decimal tmp = 0;
			if (!decimal.TryParse (l.Text, out tmp))
				return;

			tmp -= 1;
			l.Text = tmp.ToString ();
		}

		protected override void OnKeyDown (KeyboardKeyEventArgs e)
		{
			switch (e.Key) {
			case Key.Left:
				g.Left++;
				break;
			case Key.Right:
				g.Left--;
				break;
			case Key.Up:
				g.Top--;
				break;
			case Key.Down:
				g.Top++;
				break;
			default:
				break;
			}
		}
		protected override void OnUpdateFrame (FrameEventArgs e)
		{
			base.OnUpdateFrame (e);
		}

		[STAThread]
		static void Main ()
		{
			Console.WriteLine ("starting example");

			using (GOLIBTest_0 win = new GOLIBTest_0( )) {
				win.Run (30.0);
			}
		}
	}
}