PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/Samples/ExampleToolForm/Program.cs

#
C# | 53 lines | 38 code | 5 blank | 10 comment | 2 complexity | dc5cf67e5a8b4b3a081039dbf97c2425 MD5 | raw file
 1using System;
 2using Delta.Engine;
 3using Delta.Platforms.Windows;
 4using Delta.Utilities.Datatypes;
 5using Delta.InputSystem;
 6using Delta.Rendering.Basics.Fonts;
 7using Delta.Rendering.Basics.Drawing;
 8
 9namespace Delta.Tools.ExampleToolForm
10{
11	/// <summary>
12	/// Program, will start the tool.
13	/// </summary>
14	public static class Program
15	{
16		#region Main
17		/// <summary>
18		/// Initializes the ExampleForm and starts the whole editor!
19		/// </summary>
20		[STAThread]
21		static void Main()
22		{
23			using (ExampleForm form = new ExampleForm())
24			{
25				// Make sure to use our editor window for the engine.
26				WindowsApplication.SetEditorForm(form, form.viewportPanel);
27
28				// Add something to render
29				Application.BackgroundColor = Color.CornflowerBlue;
30
31				float wheelValue = 0.0f;
32				// And start the application the normal way (it will show the editor)
33				Application.Start(delegate
34				{
35					// Line from top left up to bottom right in quadratic space
36					Line.Draw(new Point(0, 0), new Point(1, 1), Color.Red);
37					Font.Default.Draw("Mouse position=" + Input.Mouse.Position,
38						ScreenSpace.DrawArea);
39
40					float wheelDelta = Input.Mouse.ScrollWheelDelta;
41					if (wheelDelta != 0)
42					{
43						wheelValue += wheelDelta;
44					} // if
45
46					Font.Default.Draw("Mouse wheelValue= '" + wheelValue + "'",
47						Rectangle.FromCenter(new Point(0.5f, 0.65f), Size.Half));
48				});
49			}
50		}
51		#endregion
52	}
53}