public class GUI_Sample : ScriptingSystem.MGUIDialog { public GUI_Sample() { // some basic MGUIDialog properties this.Location = new System.Drawing.Point(0, 0); this.Size = new System.Drawing.Size(610, 380); this.EnableCaption = true; this.Text = "Sample"; this.Draggable = true; this.EnableMouseInput = true; this.DrawBackground = true; // don't want to do this just yet, without the Event's function defined! this.DialogEvent += new SSystem_DialogEvent(dialog_DialogEvent); Visible = true; Enabled = true; } }
public class GUI_Sample : ScriptingSystem.MGUIDialog { // a simple button control ScriptingSystem.MGUIButton SampleButton; public GUI_Sample() { // some basic MGUIDialog properties this.Location = new System.Drawing.Point(0, 0); this.Size = new System.Drawing.Size(610, 380); this.EnableCaption = true; this.Text = "Sample"; this.Draggable = true; this.EnableMouseInput = true; this.DrawBackground = true; // don't want to do this just yet, without the Event's function defined! //this.DialogEvent += new SSystem_DialogEvent(dialog_DialogEvent); Visible = true; Enabled = true; // create the new button, set some basic properties, and add it to the dialog this.SampleButton = new ScriptingSystem.MGUIButton(); this.SampleButton.Location = new System.Drawing.Point(305, 190); this.SampleButton.Size = new System.Drawing.Size(140, 50); this.SampleButton.Text = "Sample Button"; this.Controls.Add(this.SampleButton); } }
using System; using System.Collections; using ScriptingSystem; public class GUI_Sample : ScriptingSystem.MGUIDialog { public GUI_Sample() { InitializeComponent(); Visible = true; Enabled = true; } private void InitializeComponent() { this.EnableCaption = true; this.EnableMouseInput = true; this.Location = new System.Drawing.Point(0, 0); this.Size = new System.Drawing.Size(270, 120); this.Text = "Dialog Caption"; } }
public class GUI_Sample : ScriptingSystem.MGUIDialog { private ScriptingSystem.MGUIButton CloseButton; // the Control ID's for this dialog's Event-Handled Controls enum ControlHandles { IDC_CLOSEBUTTON }; public GUI_Sample() { InitializeComponent(); this.EnableCaption = true; this.Draggable = true; this.EnableMouseInput = true; this.DrawBackground = true; // Register the Event Handling function this.DialogEvent += new SSystem_DialogEvent(dialog_DialogEvent); Visible = true; Enabled = true; // Set up this dialog's Controls' ControlIDs this.CloseButton.ControlID = (int)ControlHandles.IDC_CLOSEBUTTON; } // Registered as the dialog's Event Handling function in the dialog's contructor void dialog_DialogEvent(uint Event, int ControlID, MGUIControl Control) { switch ((ControlHandles)ControlID) { case ControlHandles.IDC_CLOSEBUTTON: // CloseButton pressed Event will hide the window Visible = false; break; } } private void InitializeComponent() { this.CloseButton = new ScriptingSystem.MGUIButton(); // // CloseButton // this.CloseButton.Location = new System.Drawing.Point(100, 55); this.CloseButton.Size = new System.Drawing.Size(70, 32); this.CloseButton.Text = "Close"; // // GUI_Sample // this.Controls.Add(this.CloseButton); this.EnableCaption = true; this.EnableMouseInput = true; this.Location = new System.Drawing.Point(0, 0); this.Size = new System.Drawing.Size(270, 120); this.Text = "Sample Dialog"; } }
void dialog_DialogEvent(uint Event, int ControlID, MGUIControl Control) { switch ((ControlHandles)ControlID) { case ControlHandles.IDC_LISTBOX1: this.StaticLabel.Text = ((MGUIListBox)Control).SelectedItemText; break; } }
public class GUI_VideoSettings : MVideoSettingsDialog { private const int IDC_CANCEL = 1; private const int IDC_OK = 2; public GUI_VideoSettings() { try { this.EnableCaption = true; this.Draggable = true; this.EnableMouseInput = true; this.DrawBackground = true; this.Text = "Video Settings"; this.DialogEvent += new SSystem_DialogEvent(dialog_DialogEvent); this.Size = new System.Drawing.Size(500, 500); Visible = false; Enabled = true; } catch (Exception ex) { this.Text = ex.StackTrace; } } void dialog_DialogEvent(uint Event, int ControlID, MGUIControl Control) { MGUISystem.HandleVideoSettingsCallback(Event, ControlID, Control); switch(Control.ControlID) { case IDC_CANCEL: Window.Visible = false; break; case IDC_OK: Window.Visible = false; break; } } }
public class GUI_MainMenu : ScriptingSystem.MGUIDialog { private GUI_NewGame DialogNewGame; private GUI_GraphicsOptions DialogGraphicsOptions; private GUI_GameOptions DialogGameOptions; private GUI_VideoSettings DialogVideoSettings; private GUI_MessageBox DialogMessageBox; ... public GUI_MainMenu() { ... DialogNewGame = new GUI_NewGame(); DialogGameOptions = new GUI_GameOptions(); DialogGraphicsOptions = new GUI_GraphicsOptions(); DialogVideoSettings = new GUI_VideoSettings(); DialogMessageBox = new GUI_MessageBox(); this.EnableCaption = true; this.Draggable = false; this.EnableMouseInput = true; this.DrawBackground = false; this.Text = "Reality Engine Eval Build " + MHelpers.RealityBuildVersion; this.DialogEvent += new SSystem_DialogEvent(dialog_DialogEvent); Visible = true; Enabled = true; } void dialog_DialogEvent(uint Event, int ControlID, MGUIControl Control) { switch(Control.ControlID) { case IDC_NEWGAME: DialogNewGame.Window.Visible = true; DialogNewGame.Window.BringToTop(); break; case IDC_VIDEOSETTINGS: DialogVideoSettings.Window.Visible = true; DialogVideoSettings.Window.BringToTop(); break; case IDC_GRAPHICSOPTIONS: DialogGraphicsOptions.Window.Visible = true; DialogGraphicsOptions.Window.BringToTop(); break; case IDC_GAMEOPTIONS: DialogGameOptions.Window.Visible = true; DialogGameOptions.Window.BringToTop(); break; case IDC_EXIT: MHelpers.ShutdownApp(); break; } } ... }
public override void OnRender() { if (!MGUISystem.DesktopVisible || !Minimized) return; this.RealityLogo.Location = new System.Drawing.Point(MCanvas.Width - this.RealityLogo.Size.X, 0); BackgroundTexture.uTile = 2.0f; BackgroundTexture.vTile = 2.0f; BackgroundTexture.uOff = 0; BackgroundTexture.vOff = -MHelpers.Seconds / 7.0f; MCanvas.Box(MHelpers.ColorFromRGBA(255, 255, 255, 70 + (int)Math.Abs((float)Math.Sin(MHelpers.Seconds) * 90.0f)), -2, -2, 1028, 772, BackgroundTexture, MBlendMode.MBLEND_SRCALPHA, MBlendMode.MBLEND_ONE); }