public GUISpinBox AddSpinBox (string text, Rect rectangle, bool border, GUIElement parent, int id) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUISpinBox)NativeElement.GetObject(GuiEnv_AddSpinBox(_raw, text, rectangle.ToUnmanaged(), border, par, id), typeof(GUISpinBox)); }
public override void Initialize() { base.Initialize(); tex = Render.RenderData.BlankTexture; fade_tex = tex; rect = new Rect(0, 0, Ox.DataStore.Width, Ox.DataStore.Height); Ox.IO.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(IO_DownloadFileCompleted); CreateTimer(); }
public CustomElement(GUIEnvironment guienv, GUIElement parent, int id, Rect rect) : base(guienv, parent, id, rect) { driver = guienv.VideoDriver; // For some reason passing this as a parent parameter doesn't work. // Probably that's because initialization of the managed part // is not finished yet, so this points to elsewhere but a complete class text = guienv.AddStaticText(caption, rect, false, true, null, -1, false); // let's workaround this by calling addchild instantly AddChild(text); }
public IGUIElement (GUIEnvironment guienv, GUIElement parent, int id, Rect rect) { antigc1 = OnCallbackVoid; antigc2 = OnCallbackInt; antigc3 = OnCallbackIntptr; Initialize (CGE_CREATE(guienv.Raw, parent == null? guienv.RootElement.Raw : parent.Raw, id, rect.ToUnmanaged(), antigc1, antigc2, antigc3)); }
public void Draw2DImage(Texture image, Rect destRect, Rect sourceRect, Color[] color, bool useAlpha) { VideoDriver_Draw2DImageD(_raw, image.Raw, destRect.ToUnmanaged(), sourceRect.ToUnmanaged(), color[0].ToUnmanaged(), color[1].ToUnmanaged(), color[2].ToUnmanaged(), color[3].ToUnmanaged(), useAlpha); }
public void Draw2DImage(Texture image, Position2D destPos, Rect sourceRect, Color color, bool useAlpha) { VideoDriver_Draw2DImageB(_raw, image.Raw, destPos.ToUnmanaged(), sourceRect.ToUnmanaged(), color.ToUnmanaged(), useAlpha); }
/// <summary> /// Clips this rectangle with another one. /// </summary> public void ClipAgainst(Rect other) { if (other.LowerRightCorner.X < LowerRightCorner.X) LowerRightCorner.X = other.LowerRightCorner.X; if (other.LowerRightCorner.Y < LowerRightCorner.Y) LowerRightCorner.Y = other.LowerRightCorner.Y; if (other.UpperLeftCorner.X > UpperLeftCorner.X) UpperLeftCorner.X = other.UpperLeftCorner.X; if (other.UpperLeftCorner.Y > UpperLeftCorner.Y) UpperLeftCorner.Y = other.UpperLeftCorner.Y; // correct possible invalid rect resulting from clipping if (UpperLeftCorner.Y > LowerRightCorner.Y) UpperLeftCorner.Y = LowerRightCorner.Y; if (UpperLeftCorner.X > LowerRightCorner.X) UpperLeftCorner.X = LowerRightCorner.X; }
public GUIButton AddButtonW(Rect rectangle, GUIElement parent, int id, string text) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUIButton)NativeElement.GetObject(GuiEnv_AddButtonW(_raw, rectangle.ToUnmanaged(), par, id, text), typeof(GUIButton)); }
public void DrawW(string text, Position2D pos, Color color, bool hcenter, bool vcenter, Rect cliprect) { GUIFont_DrawW(_raw, text, pos.ToUnmanaged(), color.ToUnmanaged(), hcenter, vcenter, cliprect.ToUnmanaged()); }
public void Draw2DRectangle(Rect rectangle, Color color) { Draw2DRectangle(rectangle, color, color, color, color); }
public GUIScrollBar AddScrollBar(bool horizontal, Rect rectangle, GUIElement parent, int id) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUIScrollBar)NativeElement.GetObject(GuiEnv_AddScrollBar(_raw, horizontal, rectangle.ToUnmanaged(), par, id), typeof(GUIScrollBar)); }
public GUIListBox AddListBox(Rect rect, GUIElement parent, int id, bool drawBackground) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUIListBox)NativeElement.GetObject(GuiEnv_AddListBox(_raw, rect.ToUnmanaged(), par, id, drawBackground), typeof(GUIListBox)); }
public void ShowMessageWindow(string _message, bool _useCancelButton) { IsShowCursor = true; // remote message window. Remove((int)GUIElementIDS.GENERAL_MESSAGE_WINDOW); //------------------------------------------------- // window setting. //------------------------------------------------- Rect windowRect = new Rect( new Position2D(Reference.Viewer.Width / 2 - 150, Reference.Viewer.Height / 2 - 64), new Dimension2D(300, 128) ); string caption = " " + DialogText.MessageWindowCaption; int windowID = (int)GUIElementIDS.GENERAL_MESSAGE_WINDOW; GUIWindow wnd = Reference.GUIEnvironment.AddWindowW(windowRect, true, caption, parentElement, windowID); wnd.CloseButton.Visible = false; string[] messages = _message.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); //------------------------------------------------- // text area setting. //------------------------------------------------- Rect textRect = new Rect( new Position2D(4, 24), new Dimension2D(wnd.RelativePosition.dotNETRect.Width - 4, wnd.RelativePosition.dotNETRect.Height - BUTTON_DEFULT_HEIGHT - 24) ); GUIListBox listBox = Reference.GUIEnvironment.AddListBox(textRect, wnd, -1, false); listBox.Enabled = false; for (int i = 0; i < messages.Length; i++) listBox.AddItemW(messages[i]); //------------------------------------------------- // button setting. //------------------------------------------------- Rect buttonRect = new Rect( new Position2D(4, wnd.RelativePosition.dotNETRect.Height - BUTTON_DEFULT_HEIGHT), new Dimension2D(300 - 8, BUTTON_DEFULT_HEIGHT) ); int button00ID = (int)GUIElementIDS.GENERAL_MESSAGE_BUTTON00; int button01ID = (int)GUIElementIDS.GENERAL_MESSAGE_BUTTON01; string button00Text = "OK"; string button01Text = "Cancel"; GUIButton back00Btn; GUIButton back01Btn; if (_useCancelButton) { buttonRect.Width = buttonRect.Width / 2; back00Btn = Reference.GUIEnvironment.AddButtonW(buttonRect, wnd, button00ID, button00Text); buttonRect.X = buttonRect.Width; back01Btn = Reference.GUIEnvironment.AddButtonW(buttonRect, wnd, button01ID, button01Text); } else { back00Btn = Reference.GUIEnvironment.AddButtonW(buttonRect, wnd, button00ID, button00Text); } // Set focus. Reference.GUIEnvironment.SetFocus(back00Btn); }
public void ShowDebugWindow() { if (Reference.Viewer.IsVisibleDebutTab == false) return; //---------------------------------------------------------------------- // Remove window //---------------------------------------------------------------------- Remove((int)GUIElementIDS.DEBUG_WINDOW); //---------------------------------------------------------------------- // Set window //---------------------------------------------------------------------- Rect rect = new Rect(0, 0, Reference.VideoDriver.ViewPort.Width / 2, Reference.VideoDriver.ViewPort.Height); GUIWindow wnd = Reference.GUIEnvironment.AddWindowW( rect, false, " " + DialogText.Settings, parentElement, (int)GUIElementIDS.DEBUG_WINDOW); Texture tex = Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/window_settings.png"); if (tex != null) Reference.GUIEnvironment.AddImage(tex, new Position2D(5, 2), true, wnd, -1, ""); wnd.CloseButton.UseAlphaChannel = true; wnd.CloseButton.SetImage(closeButton); //---------------------------------------------------------------------- // Debug tab //---------------------------------------------------------------------- const int width = 16; const int height = 32; rect.X = width / 2; rect.Width = rect.Width - width; rect.Y = height; rect.Height = (int)(rect.Height * 2f) - (rect.Y / 2); if (Reference.Viewer.IsVisibleDebutTab) { debugTab = Reference.GUIEnvironment.AddTabControl(rect, wnd, true, true, (int)GUIElementIDS.DEBUG_DTAB_CONTROLLER); GUITab dt0 = debugTab.AddTab("SYS", -1); GUITab dt1 = debugTab.AddTab("NOD", -1); GUITab dt2 = debugTab.AddTab("USR", -1); GUITab dt3 = debugTab.AddTab("VIE", -1); GUITab dt4 = debugTab.AddTab("P-N", -1); GUITab dt5 = debugTab.AddTab("P-C", -1); GUITab dt6 = debugTab.AddTab("LMN", -1); GUITab dt7 = debugTab.AddTab("VOI", -1); debugListBoxList = new Dictionary<int, GUIListBox>(10); debugListBoxList.Add(0, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt0, -1, false)); debugListBoxList.Add(1, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt1, -1, false)); debugListBoxList.Add(2, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt2, -1, false)); debugListBoxList.Add(3, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt3, -1, false)); debugListBoxList.Add(4, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt4, -1, false)); debugListBoxList.Add(5, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt5, -1, false)); debugListBoxList.Add(6, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt6, -1, false)); debugListBoxList.Add(7, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt7, -1, false)); #if DEBUG_QUEUE GUITab dt8 = debugTab.AddTab("QUE", -1); debugListBoxList.Add(8, Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(0, 0), new Dimension2D(Reference.Viewer.Width / 2, Reference.Viewer.Height - 64)), dt8, -1, false)); #endif } }
public void ShowSettingWindow() { //---------------------------------------------------------------------- // Remove window //---------------------------------------------------------------------- Remove((int)GUIElementIDS.SETTING_WINDOW); //---------------------------------------------------------------------- // Set window //---------------------------------------------------------------------- Rect rect = new Rect(new Position2D(Reference.Viewer.Width / 2 - 150, Reference.Viewer.Height / 2 - 110), new Dimension2D(300, 220)); GUIWindow wnd = Reference.GUIEnvironment.AddWindowW(rect, false, " " + DialogText.Settings, parentElement, (int)GUIElementIDS.SETTING_WINDOW); Texture tex = Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/window_settings.png"); if (tex != null) Reference.GUIEnvironment.AddImage(tex, new Position2D(5, 2), true, wnd, -1, ""); wnd.CloseButton.UseAlphaChannel = true; wnd.CloseButton.SetImage(closeButton); //---------------------------------------------------------------------- // Set tab //---------------------------------------------------------------------- const int width = 4; const int height = 32; rect.X = width / 2; rect.Width = rect.Width - width; rect.Y = height; rect.Height = (int)(rect.Height * 2f) - (rect.Y / 2); GUITabControl tab = Reference.GUIEnvironment.AddTabControl(rect, wnd, true, true, -1); //---------------------------------------------------------------------- // Graphic tab //---------------------------------------------------------------------- GUITab t1 = tab.AddTabW(DialogText.General, -1); Rect t1Rect = new Rect(); t1Rect.X = 8; t1Rect.Y = 24; t1Rect.Width = 80; t1Rect.Height = 20 * 1; Reference.GUIEnvironment.AddStaticTextW(DialogText.SeaShader+":", t1Rect, false, false, t1, -1, false); t1Rect.X = t1Rect.X + t1Rect.Width; t1Rect.Width = 48; t1Rect.Height = 20 * 2; settingTab1SeaQualityList = Reference.GUIEnvironment.AddListBox(t1Rect, t1, -1, false); settingTab1SeaQualityList.AddItemW(DialogText.High); settingTab1SeaQualityList.AddItemW(DialogText.Low); settingTab1SeaQualityList.Selected = (Reference.Viewer.SeaQuality == Viewer.ShaderLevelType.High ? 0 : 1); t1Rect.X = 16 + t1Rect.X + t1Rect.Width; t1Rect.Width = 80; t1Rect.Height = 20 * 1; Reference.GUIEnvironment.AddStaticTextW(DialogText.SkyShader+":", t1Rect, false, false, t1, -1, false); t1Rect.X = t1Rect.X + t1Rect.Width; t1Rect.Width = 48; t1Rect.Height = 20 * 2; settingTab1SkyQualityList = Reference.GUIEnvironment.AddListBox(t1Rect, t1, -1, false); settingTab1SkyQualityList.AddItemW(DialogText.High); settingTab1SkyQualityList.AddItemW(DialogText.Low); settingTab1SkyQualityList.Selected = (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.High ? 0 : 1); t1Rect.X = 8; t1Rect.Y = t1Rect.Y + t1Rect.Height + 6; t1Rect.Width = 80; t1Rect.Height = 20 * 1; Reference.GUIEnvironment.AddStaticTextW(DialogText.Locale+":", t1Rect, false, false, t1, -1, false); t1Rect.X = t1Rect.X + t1Rect.Width; t1Rect.Width = 192; t1Rect.Height = 16 * 2; settingTab1Locale = Reference.GUIEnvironment.AddListBox(t1Rect, t1, -1, false); settingTab1Locale.AddItemW(DialogText.EN); if (Reference.Viewer.JapaneseEnabled) settingTab1Locale.AddItemW(DialogText.JP); settingTab1Locale.Selected = (Reference.Viewer.Locale == "en" ? 0 : 1); t1Rect.X = 8; t1Rect.Y = t1Rect.Y + t1Rect.Height + 16; t1Rect.Width = 278; t1Rect.Height = BUTTON_DEFULT_HEIGHT; Reference.GUIEnvironment.AddButtonW(t1Rect, t1, (int)GUIElementIDS.SETTING_TAB1_BUTTON00, "OK"); //---------------------------------------------------------------------- // Cache tab //---------------------------------------------------------------------- GUITab t2 = tab.AddTabW(DialogText.Cache, -1); Rect t2Rect = new Rect(new Position2D(8, 24), new Dimension2D(278, 64)); Reference.GUIEnvironment.AddStaticTextW(DialogText.CacheInformationMessage, t2Rect, false, true, t2, -1, false); t2Rect = new Rect(new Position2D(112, 88), new Dimension2D(278, 32)); Reference.GUIEnvironment.AddStaticTextW(DialogText.CacheUnitMessage, t2Rect, false, true, t2, -1, false); t2Rect = new Rect(new Position2D(224, 80), new Dimension2D(64, 32)); long cacheMB = Reference.Viewer.CacheManager.CacheMaxSize / (1000 * 1000); settingTab2CacheSize = Reference.GUIEnvironment.AddEditBox(cacheMB.ToString(), t2Rect, true, t2, -1); t2Rect = new Rect(new Position2D(8, 118), new Dimension2D(278, BUTTON_DEFULT_HEIGHT)); Reference.GUIEnvironment.AddButtonW(t2Rect, t2, (int)GUIElementIDS.SETTING_TAB2_BUTTON00, DialogText.Delete); //---------------------------------------------------------------------- // Information tab //---------------------------------------------------------------------- GUITab t3 = tab.AddTabW(DialogText.Information, -1); Reference.GUIEnvironment.AddImage(Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/logo.tga"), new Position2D(22, 24), false, t3, -1, string.Empty); Reference.GUIEnvironment.AddStaticTextW(DialogText.Version + ": " + Reference.Viewer.Version.ToString(), new Rect(new Position2D(22, 100), new Dimension2D(Reference.Viewer.Width - 8, 24)), false, true, t3, -1, false); Reference.GUIEnvironment.AddStaticTextW("Copyright (C) 2009 3Di, Inc.", new Rect(new Position2D(22, 120), new Dimension2D(Reference.Viewer.Width - 8, 24)), false, true, t3, -1, false); }
public static Rect From(Position2D upperL, Position2D lowerR) { Rect toR = new Rect(); toR.Set(upperL, lowerR); return toR; }
public bool ConstrainTo(Rect other) { if (other.Width < Width || other.Height < Height) return false; int diff = other.LowerRightCorner.X - LowerRightCorner.X; if (diff < 0) { LowerRightCorner.X += diff; UpperLeftCorner.X += diff; } diff = other.LowerRightCorner.Y - LowerRightCorner.Y; if (diff < 0) { LowerRightCorner.Y += diff; UpperLeftCorner.Y += diff; } diff = UpperLeftCorner.X - other.UpperLeftCorner.X; if (diff < 0) { LowerRightCorner.X -= diff; UpperLeftCorner.X -= diff; } diff = UpperLeftCorner.Y - other.UpperLeftCorner.Y; if (diff < 0) { LowerRightCorner.Y -= diff; UpperLeftCorner.Y -= diff; } return true; }
public void Draw2DImage(Texture image, Rect destRect, Rect sourceRect, Rect clipRect, Color color, bool useAlpha) { VideoDriver_Draw2DImageC(_raw, image.Raw, destRect.ToUnmanaged(), sourceRect.ToUnmanaged(), clipRect.ToUnmanaged(), color.ToUnmanaged(), color.ToUnmanaged(), color.ToUnmanaged(), color.ToUnmanaged(), useAlpha); }
public void Draw2DRectangle(Rect rectangle, Color leftUp, Color rightUp, Color leftDown, Color rightDown) { VideoDriver_Draw2DRectangle(_raw, rectangle.ToUnmanaged(), leftUp.ToUnmanaged(), rightUp.ToUnmanaged(), leftDown.ToUnmanaged(), rightDown.ToUnmanaged()); }
public GUITab AddTab(Rect rectangle, GUIElement parent, int id) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUITab)NativeElement.GetObject(GuiEnv_AddTab(_raw, rectangle.ToUnmanaged(), par, id), typeof(GUITab)); }
/// <summary> /// Ends the scene /// </summary> public void EndScene(IntPtr windowHandle, Rect sourceRect) { VideoDriver_EndSceneA(_raw, windowHandle.ToInt32(), sourceRect.ToUnmanaged()); }
public GUITabControl AddTabControl(Rect rectangle, GUIElement parent, bool fillBackground, bool hasBorder, int id) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUITabControl)NativeElement.GetObject(GuiEnv_AddTabControl(_raw, rectangle.ToUnmanaged(), par, fillBackground, hasBorder, id), typeof(GUITabControl)); }
public GUICheckBox AddCheckBox(bool ischecked, Rect rectangle, GUIElement parent, int id, string text) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUICheckBox)NativeElement.GetObject(GuiEnv_AddCheckBox(_raw, ischecked, rectangle.ToUnmanaged(), par, id, text), typeof(GUICheckBox)); }
public GUIWindow AddWindowW(Rect rectangle, bool modal, string text, GUIElement parent, int id) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUIWindow)NativeElement.GetObject(GuiEnv_AddWindowW(_raw, rectangle.ToUnmanaged(), modal, text, par, id), typeof(GUIWindow)); }
public void DrawW(string text, Rect rect, Color color, bool hcenter, bool vcenter) { GUIFont_DrawW(_raw, text, rect.ToUnmanaged(), color.ToUnmanaged(), hcenter, vcenter, null); }
public GUIEditBox AddEditBoxW(string text, Rect rectangle, bool border, GUIElement parent, int id) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); #if !LINUX return (GUIEditBox)NativeElement.GetObject(GuiEnv_AddEditBoxW(_raw, text, rectangle.ToUnmanaged(), border, par, id), typeof(GUIEditBox)); #else return (GUIEditBox)NativeElement.GetObject(GuiEnv_AddEditBox(_raw, text, rectangle.ToUnmanaged(), border, par, id), typeof(GUIEditBox)); #endif }
public GUIStaticText AddStaticTextW(string text, Rect rectangle, bool border, bool wordWrap, GUIElement parent, int id, bool fillBackground) { IntPtr par = (parent == null ? IntPtr.Zero : parent.Raw); return (GUIStaticText)NativeElement.GetObject(GuiEnv_AddStaticTextW(_raw, text, rectangle.ToUnmanaged(), border, wordWrap, par, id, fillBackground), typeof(GUIStaticText)); }
/// <summary> /// Returns if the rectangle collides with an other rectangle. /// </summary> public bool IsRectCollided(Rect other) { return (LowerRightCorner.Y > other.UpperLeftCorner.Y && UpperLeftCorner.Y < other.LowerRightCorner.Y && LowerRightCorner.X > other.UpperLeftCorner.X && UpperLeftCorner.X < other.LowerRightCorner.X); }
public override void Initialize() { base.Initialize(); rect = new Rect(0, 0, Ox.DataStore.Width, Ox.DataStore.Height); }
public void SetPressedImage(Texture image, Rect pos) { GUIButton_SetPressedImage(_raw, image.Raw, pos.ToUnmanaged()); }