-
Notifications
You must be signed in to change notification settings - Fork 5
/
MovementForm.cs
53 lines (44 loc) · 1.11 KB
/
MovementForm.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TerraForm.Movement
{
public delegate void ChangePosition(float x, float y, float z);
public partial class MovementForm : Form
{
private float xPos = 0, yPos = 0, zPos = 0;
public event ChangePosition changePositionEvent;
public MovementForm()
{
InitializeComponent();
}
private void forceBtn_Click(object sender, EventArgs e)
{
if (changePositionEvent != null)
{
changePositionEvent( float.Parse(tbX.Text), float.Parse(tbY.Text), float.Parse(tbZ.Text) );
}
}
public void updatePosition(float x, float y, float z)
{
xPos = x;
yPos = y;
zPos = z;
//BeginInvoke(new MethodInvoker(Refresh));
}
private void MovementForm_Paint(object sender, PaintEventArgs e)
{
lblX.Text = xPos.ToString();
lblY.Text = yPos.ToString();
lblZ.Text = zPos.ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
Refresh();
}
}
}