forked from bastelfreak/crane2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.cs
More file actions
145 lines (125 loc) · 4.58 KB
/
Copy pathGUI.cs
File metadata and controls
145 lines (125 loc) · 4.58 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
using DemoOpenGLBasicsCS.movements;
using System;
using System.Windows.Forms;
using System.Threading;
namespace DemoOpenGLBasicsCS
{
public partial class GUI : Form
{
private TView oglView;
private Boolean buttonDown;
public GUI()
{
InitializeComponent();
oglView = new TView();
oglView.Dock = DockStyle.Fill;
panel.Controls.Add(oglView);
panel.Focus();
this.buttonDown = false; //needed for press the button and can hold it. It will be used in every button feature.
Update_positions();
}
private void Update_positions()
{
tbx_x.Text = Math.Round(oglView.Kran1.X, 3).ToString();
tbx_y.Text = Math.Round(oglView.Kran1.Y, 3).ToString();
tbx_z.Text = Math.Round(oglView.Kran1.Z, 3).ToString();
tbx_xz_movement.Text = Math.Round(oglView.Kran1.MovementfactorXZ, 3).ToString();
tbx_y_movement.Text = Math.Round(oglView.Kran1.MovementfactorY, 3).ToString();
tbx_tri_x.Text = Math.Round(Math.Cos(Math.PI * oglView.Kran1.Rotationangle / 180) * oglView.Kran1.Ropeposition, 3).ToString();
tbx_tri_y.Text = Math.Round(oglView.Kran1.Towerheight - oglView.Kran1.Ropelength, 3).ToString();
tbx_tri_z.Text = Math.Round(Math.Sin(Math.PI * oglView.Kran1.Rotationangle / 180) * oglView.Kran1.Ropeposition, 3).ToString();
tbx_alpha.Text = oglView.Kran1.Rotationangle.ToString();
tbx_rad.Text = Math.Round(oglView.Kran1.Radiant, 3).ToString();
tbx_boomlength.Text = Math.Round(oglView.Kran1.Boomlength, 3).ToString();
tbx_towerheight.Text = Math.Round(oglView.Kran1.Towerheight, 3).ToString();
tbx_ropelength.Text = Math.Round(oglView.Kran1.Ropelength, 3).ToString();
tbx_ropeposition.Text = Math.Round(oglView.Kran1.Ropeposition, 3).ToString();
}
private void Movement(interfaces.IMovement b)
{
//while (buttonDown)
//{
oglView.Kran1.setMovement(b);
oglView.Kran1.move();
oglView.Kran1.Draw();
oglView.Refresh();
oglView.Focus();
Update_positions();
Thread.Sleep(50);
Application.DoEvents();
//}
}
private void btn_links_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
buttonDown = true;
Movement(new Left());
}
}
private void btn_links_MouseUp(object sender, MouseEventArgs e)
{
buttonDown = false;
}
private void btn_rechts_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
buttonDown = true;
Movement(new Right());
}
}
private void btn_rechts_MouseUp(object sender, MouseEventArgs e)
{
buttonDown = false;
}
private void btn_ausleger_vor_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
buttonDown = true;
Movement(new Forth());
}
}
private void btn_ausleger_vor_MouseUp(object sender, MouseEventArgs e)
{
buttonDown = false;
}
private void btn_ausleger_zurueck_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
buttonDown = true;
Movement(new Back());
}
}
private void btn_ausleger_zurueck_MouseUp(object sender, MouseEventArgs e)
{
buttonDown = false;
}
private void btn_seil_hoch_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
buttonDown = true;
Movement(new Up());
}
}
private void btn_seil_hoch_MouseUp(object sender, MouseEventArgs e)
{
buttonDown = false;
}
private void btn_seil_runter_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
buttonDown = true;
Movement(new Down());
}
}
private void btn_seil_runter_MouseUp(object sender, MouseEventArgs e)
{
buttonDown = false;
}
}
}