1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System;
- using NTERA.Console;
- using NTERA.Core;
- using NTERA.EmuEra;
- using NTERA.Engine;
- using NTERA.Engine.Runtime;
- namespace NTERA
- {
- public partial class formMain : Form
- {
- private readonly GameInstance instance = new GameInstance();
- public formMain()
- {
- InitializeComponent();
- //var scriptEngine = new EmuEraGameInstance();
- //var scriptEngine = new Engine();
- var eraFolder = Environment.GetEnvironmentVariable("ERA");
- if (eraFolder == null) {
- eraFolder = Environment.CurrentDirectory;
- }
- var scriptEngine = new EraRuntime(new JITCompiler(eraFolder));
- //Task.Factory.StartNew(() => instance.Run(new EraConsoleInstance(consoleControl1.Renderer, scriptEngine), scriptEngine));
- Task.Factory.StartNew(() => instance.Run(new EraConsoleInstance(consoleControl1.Renderer, scriptEngine), scriptEngine));
- }
- private void txtInput_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- instance.GiveInput(txtInput.Text);
- txtInput.Text = "";
- e.Handled = true;
- e.SuppressKeyPress = true;
- }
- }
- }
- }
|