public MainWindow() { InitializeComponent(); MdiClient mdi = null; int ExStyle; foreach (Control ctl in Controls) { if (ctl is MdiClient) { mdi = (MdiClient)ctl; mdi.BackColor = Color.FromArgb(95, 95, 95); ExStyle = GetWindowLong(mdi.Handle, GWL_EXSTYLE); ExStyle ^= WS_EX_CLIENTEDGE; SetWindowLong(mdi.Handle, GWL_EXSTYLE, ExStyle); SetWindowPos(mdi.Handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); } } ToolStripSystemRenderer TSSR = new MenuRenderer(); menuMain.Renderer = TSSR; statusMain.Renderer = TSSR; Show(); }
public IMenuBuilder <T> ItemsDynamic(Action <IMenuBuilder <T> > addAct) { if (menu.Count != 0) { var mi = menu.Peek(); var newBuilder = new MenuBuilder <T>(); newBuilder.dynamic = true; var dynIndex = mi.DropDownItems.Count; mi.DropDownItems.Add("-"); mi.DropDownOpening += (o, e) => { newBuilder.dynamicIndex = dynIndex; mi.DropDownItems.OfType <ToolStripItem>() .ToList() .Where(i => i.Tag == null || ((Tag)i.Tag).Data != null) .ForEach(i => mi.DropDownItems.Remove(i)); ((MenuBuilder <T>)newBuilder).Start((T)(Object)menuStrip); newBuilder.menu.Push(mi); addAct(newBuilder); newBuilder.Finish(); var size = MenuRenderer.MeasureDropDown(mi.DropDown); mi.DropDown.Height = size.Height + Dpi.ScaleY(5); mi.DropDown.Width = size.Width; }; } return(this); }
public override void Initialize() { Logger.Debug("Cheat Menu Mod is intializing..."); Events.OnGameUpdated += OnGameUpdated; MenuRenderer.Text = "Cheat Menu"; MenuRenderer .SetDefaultSkin() .SetSize(400, 500) //Basic Cheats .AddCheckBox("Toggle Doors", (b, c) => this.ToggleDoors(c)) .AddCheckBox("God Mode", (b, c) => this.MakeGod(c)) .AddTextBox("Max Health", (t, c) => this.SetHealth(t, true)) .AddTextBox("Current Health", (t, c) => this.SetHealth(t, false)) .AddTextBox("Bombs", (t, c) => this.SetBombs(t)) .AddTextBox("Keys", (t, c) => this.SetKeys(t)) .AddTextBox("Gold", (t, c) => this.SetGold(t)) .AddTextBox("Thorium", (t, c) => this.SetThorium(t)) .AddButton("Give Curse", (c) => this.GiveCurse()) .AddButton("Give Blessing", (c) => this.GiveBlessing()) .AddButton("Remove Curse", (c) => this.RemoveCurse()) .AddButton("Spawn Relic", (c) => CheatMenuExtensions.SpawnRelic(this)) //Debug outputs .AddButton("Print equipment", (c) => PrintActiveItems()) .AddButton("Print All Entities", (c) => PrintEntities()); SetupSpawners(); }
internal void Initialize(IApp app) { this.app = app; contextMenu = new ContextMenuStrip(); contextMenu.Items.Add("Remove Bookmark", null, (o, e) => RemoveBookmark(lastNodeClick)); MenuRenderer.ApplySkin(contextMenu); this.sciMap = new Dictionary <ScintillaControl, Object>(); this.nodeMap = new Dictionary <Document, TreeNode>(); this.treeView = new BufferedTreeView(); this.treeView.Font = Fonts.Text; this.treeView.BorderStyle = BorderStyle.None; this.treeView.ShowLines = false; this.treeView.BeforeExpand += TreeViewBeforeExpand; this.treeView.NodeMouseClick += NodeMouseClick; this.treeView.ItemHeight = Dpi.ScaleY(18); var img = new ImageList(); img.ColorDepth = ColorDepth.Depth32Bit; img.TransparentColor = Color.Magenta; img.ImageSize = new Size(16, 16); img.Images.Add("Folder", Bitmaps.Load <NS>("Folder")); img.Images.Add("Bookmark", Bitmaps.Load <NS>("Bookmark")); treeView.ImageList = img; var srv = app.GetService <IDocumentService>(); srv.EnumerateDocuments().ForEach(d => AddDocument(d as TextDocument)); srv.DocumentAdded += DocumentAdded; srv.DocumentRemoved += DocumentRemoved; }
public Menu(Device device, ShaderCache shaderCache, TrackedDeviceBufferManager trackedDeviceBufferManager, ControllerManager controllerManager, IMenuLevel rootLevel) { model = new MenuModel(rootLevel); controller = new MenuController(model, controllerManager); visualRenderer = new MenuView(device, model); renderer = new MenuRenderer(device, shaderCache, trackedDeviceBufferManager, controllerManager, visualRenderer.TextureView); }
public Menu() { Renderer = new MenuRenderer(); Padding = new Padding(5); DoubleBuffered = true; }
private void Spawner(DataObjectCollection collection, string type) { _spawners.Add(type, ""); MenuRenderer.AddTextBox($"{type} Name", (t, c) => _spawners[type] = t) .AddButton($"Spawn {type}", (c) => Spawn(type, collection)) .AddLabel("", out IMenuLabel label); _spawnerLabels.Add(type, label); }
private void HandleLogin(string token) { try { var splitToken = token.Split('.'); if (splitToken.Length != 3) { throw new Exception("Token is the wrong length"); } var dataEncoded = splitToken[1]; var padLength = 4 - dataEncoded.Length % 4; if (padLength < 4) { dataEncoded += new string('=', padLength); } var dataBytes = Convert.FromBase64String(dataEncoded); var parsedToken = JsonUtility.FromJson <Token>(Encoding.UTF8.GetString(dataBytes)); jwt = Regex.Replace(token, @"[^a-zA-Z0-9_.-]", string.Empty); userID = parsedToken.channel_id; Logger.Debug(userID); } catch (Exception e) { MenuRenderer.AddLabel("Failed to parse token"); Logger.Error(e.ToString()); return; } try { string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string workDir = Path.Combine(appdata, "WonderMine"); string tokenFile = Path.Combine(workDir, "token.txt"); Directory.CreateDirectory(workDir); using (StreamWriter writer = new StreamWriter(tokenFile)) { writer.WriteLine(jwt); } } catch (Exception e) { MenuRenderer.AddLabel("Failed to save token to disk (you can still use the mod)"); Logger.Error(e.ToString()); } }
public override void Initialize() { string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string tokenFile = Path.Combine(appdata, "WonderMine", "token.txt"); try { using (StreamReader reader = new StreamReader(tokenFile)) { pastedToken = reader.ReadToEnd(); HandleLogin(pastedToken); } } catch (Exception) { /* Do nothing (file probably doesn't exist) */ } MenuRenderer.Text = "WonderMine"; MenuRenderer.SetDefaultSkin() .AddButton("Login to Twitch", (c) => Process.Start("https://wondermine.3ocene.com")) .AddTextBox("Paste Login Token", (t, c) => pastedToken = t, pastedToken, true) .AddButton("Set access token", (c) => HandleLogin(pastedToken)); loop = UpdateLoop().GetEnumerator(); Events.OnGameUpdated += OnGameUpdated; }
public IMenuBuilder <T> CreateMenuBuilder <T>(T menu) where T : new() { var builder = new MenuBuilder <T>(); builder.Finished += (_, __) => { var ms = builder.GetToolStrip(); if (ms is ContextMenuStrip) { MenuRenderer.ApplySkin((ContextMenuStrip)ms); } else { ms.Renderer = new MenuRenderer(); } }; var menuStrip = builder.Start(menu); menus.Add(menuStrip); return(builder); }
public SfmlRenderer(Config config, RenderWindow window, CommonResource resource) { try { Console.Write("Initialize renderer: "); this.config = config; config.video_gamescreensize = Math.Clamp(config.video_gamescreensize, 0, this.MaxWindowSize); config.video_gammacorrection = Math.Clamp(config.video_gammacorrection, 0, this.MaxGammaCorrectionLevel); this.sfmlWindow = window; this.palette = resource.Palette; this.sfmlWindowWidth = (int)window.Size.X; this.sfmlWindowHeight = (int)window.Size.Y; if (config.video_highresolution) { this.screen = new DrawScreen(640, 400); this.sfmlTextureWidth = 512; this.sfmlTextureHeight = 1024; } else { this.screen = new DrawScreen(320, 200); this.sfmlTextureWidth = 256; this.sfmlTextureHeight = 512; } this.sfmlTextureData = new byte[4 * this.screen.Width * this.screen.Height]; this.sfmlTexture = new Texture((uint)this.sfmlTextureWidth, (uint)this.sfmlTextureHeight); this.sfmlSprite = new Sprite(this.sfmlTexture); this.sfmlSprite.Position = new Vector2f(0, 0); this.sfmlSprite.Rotation = 90; var scaleX = (float)this.sfmlWindowWidth / this.screen.Width; var scaleY = (float)this.sfmlWindowHeight / this.screen.Height; this.sfmlSprite.Scale = new Vector2f(scaleY, -scaleX); this.sfmlStates = new RenderStates(BlendMode.None); this.menu = new MenuRenderer(this.screen); this.threeD = new ThreeDRenderer(resource, this.screen, config.video_gamescreensize); this.statusBar = new StatusBarRenderer(this.screen); this.intermission = new IntermissionRenderer(this.screen); this.openingSequence = new OpeningSequenceRenderer(this.screen, this); this.autoMap = new AutoMapRenderer(this.screen); this.finale = new FinaleRenderer(resource, this.screen); this.pause = Patch.FromWad("M_PAUSE"); var scale = this.screen.Width / 320; this.wipeBandWidth = 2 * scale; this.wipeBandCount = this.screen.Width / this.wipeBandWidth + 1; this.wipeHeight = this.screen.Height / scale; this.wipeBuffer = new byte[this.screen.Data.Length]; this.palette.ResetColors(SfmlRenderer.gammaCorrectionParameters[config.video_gammacorrection]); Console.WriteLine("OK"); } catch (Exception e) { Console.WriteLine("Failed"); this.Dispose(); ExceptionDispatchInfo.Throw(e); } }
public override void Initialize(IApp app) { base.Initialize(app); contextMenu = new ContextMenuStrip(); contextMenu.Items.Add("Close file", null, (o, e) => CloseDocument(lastNodeClick)); contextMenu.Items.Add("Toggle document flag", null, (o, e) => ToggleFlag(lastNodeClick)); MenuRenderer.ApplySkin(contextMenu); control = new OpenFilesControl(); mainFolder = new TreeNode(App.EditorInfo(EditorFlags.Main).DisplayName.Remove("&")) { ImageKey = "Folder", SelectedImageKey = "Folder" }; otherFolder = new TreeNode("Other Files") { ImageKey = "Folder", SelectedImageKey = "Folder" }; flagFolder = new TreeNode("Flagged Files") { ImageKey = "Flag", SelectedImageKey = "Flag" }; control.TreeView.Nodes.Add(mainFolder); control.TreeView.Nodes.Add(otherFolder); control.TreeView.Nodes.Add(flagFolder); App.GetService <IDocumentService>().DocumentAdded += (o, e) => AddDocumentNode(e.Document); App.GetService <IDocumentService>().DocumentRemoved += (o, e) => RemoveDocumentNode(e.Document); App.GetService <IDocumentService>().ActiveDocumentChanged += (o, e) => Refresh(); Application.Idle += (o, e) => { var sel = App.Document(); ProcessTitles(sel, mainFolder.Nodes.OfType <TreeNode>()); ProcessTitles(sel, otherFolder.Nodes.OfType <TreeNode>()); }; control.TreeView.NodeMouseClick += (o, e) => { if (e.Button == MouseButtons.Left) { var d = e.Node.Tag as Document; if (d != null) { App.GetService <IDocumentService>().SetActiveDocument(d); } } else if (e.Button == MouseButtons.Right) { lastNodeClick = e.Node; } }; control.TreeView.GotFocus += (o, e) => { var node = FindDocumentNode(App.Document()); if (node != null) { node.EnsureVisible(); control.TreeView.SelectedNode = node; } }; control.TreeView.DrawNode += TreeView_DrawNode; control.TreeView.DrawMode = TreeViewDrawMode.OwnerDrawText; control.Load += (o, e) => WalkDocuments(); }
public CrownContextMenuStrip() { Renderer = new MenuRenderer(); }
public CrownMenuStrip() { Renderer = new MenuRenderer(); Padding = new Padding(3, 2, 0, 2); }
/// <summary> /// Allows for drawing things to the UI /// </summary> public virtual void OnGUI() { MenuRenderer?.Render(); }