private void Init(Map map) { this.map = map; if (map.Parallax != null) { foreach (var pl in map.Parallax.Layers) { new LabelGadget(this, "Parallax " + pl.Texture.Name); var bl = new BoxGadget(this, Orientation.Horizontal); new LabelGadget(bl, "Speed:") { FixedWidth = 100 }; new NumericalGadget(bl) { Increment = 0.01, DoubleValue = pl.Speed, FixedWidth = 100, GadgetUpEvent = (o, i) => { pl.Speed = (float)((NumericalGadget)o).DoubleValue; } }; var blX = new BoxGadget(this, Orientation.Horizontal); new LabelGadget(blX, "Fixed Speed X:") { FixedWidth = 100 }; new NumericalGadget(blX) { Increment = 0.01, DoubleValue = pl.FixedSpeedX, FixedWidth = 100, GadgetUpEvent = (o, i) => { pl.FixedSpeedX = (float)((NumericalGadget)o).DoubleValue; } }; var blY = new BoxGadget(this, Orientation.Horizontal); new LabelGadget(blY, "Fixed Speed Y:") { FixedWidth = 100 }; new NumericalGadget(blY) { Increment = 0.01, DoubleValue = pl.FixedSpeedY, FixedWidth = 100, GadgetUpEvent = (o, i) => { pl.FixedSpeedY = (float)((NumericalGadget)o).DoubleValue; } }; } } }
private void Init() { labelInfo = new LabelGadget(this, $"Tile {mapX}/{mapY}"); layerBox = new BoxGadget(this, Orientation.Horizontal); var tileBox = new BoxGadget(this, Orientation.Horizontal); image = new ImageGadget(tileBox) { FixedHeight = 200, FixedWidth = 200 }; table = new TableGadget(tileBox) { RowHeight = 64, EvenColumns = false, SelectedCellChangedEvent = (o, i) => { ChangeTile(); } }; var colImg = table.AddColumn("Img", 64); var colIdx = table.AddColumn("Id", 64); var colName = table.AddColumn("Name", 200); var butBox = new BoxGadget(this, Orientation.Horizontal, Alignment.Fill, 10, 10); new ButtonGadget(butBox, "Ok") { GadgetUpEvent = (o, i) => { Apply(); mapScreen.HideEditor(); } }; new ButtonGadget(butBox, "Cancel") { GadgetUpEvent = (o, i) => { mapScreen.HideEditor(); } }; }
private void ButtonDemo() { if (buttonWindow == null) { buttonWindow = new Window(screen, "Button Demo") { LeftEdge = 30, TopEdge = 30, CloseGadget = true, DepthGadget = true, SizeGadget = true, SizeBRight = true, WindowCloseEvent = (o, i) => { screen.CloseWindow(buttonWindow); buttonWindow = null; } }; new LabelGadget(buttonWindow, "Button Gadgets") { Frame = true }; new ButtonGadget(buttonWindow, "Normal") { TooltipText = "Tooltip", TooltipPos = new Point(2, 2), ShowTooltip = true }; new ButtonGadget(buttonWindow, "Toggle") { Sticky = true }; var box = new BoxGadget(buttonWindow, Orientation.Horizontal) { }; new ButtonGadget(box, "A"); new ButtonGadget(box, "B"); new ButtonGadget(box, "C"); new ButtonGadget(box, "D"); var box2 = new BoxGadget(buttonWindow, Orientation.Horizontal) { }; new ButtonGadget(box2, Icons.ENTYPO_ICON_500PX); new ButtonGadget(box2, Icons.ENTYPO_ICON_AIR); new ButtonGadget(box2, Icons.ENTYPO_ICON_BOOK); new ButtonGadget(box2, Icons.ENTYPO_ICON_CLAPPERBOARD); new SeparatorGadget(box2); new ChooserGadget(box2) { Items = new string[] { "Item1", "Item2", "Item3", "Item4" } }; var box3 = new BoxGadget(buttonWindow, Orientation.Horizontal, Alignment.Fill) { }; new CheckBoxGadget(box3, "Checkbox 1"); new CheckBoxGadget(box3, "Checkbox 2"); new StrGadget(buttonWindow, "") { Buffer = "Hello Buffer" }; new NumericalGadget(buttonWindow) { }; } screen.ShowWindow(buttonWindow); screen.WindowToFront(buttonWindow); screen.ActivateWindow(buttonWindow); }
private void BasicDemo() { if (basicWindow == null) { basicWindow = new Window(screen, "Baisc Demo") { LeftEdge = 30, TopEdge = 30, CloseGadget = true, DepthGadget = true, SizeGadget = true, WindowCloseEvent = (o, i) => { screen.CloseWindow(basicWindow); basicWindow = null; } }; var tabs = new TabPanelGadget(basicWindow); var tab1 = tabs.AddTab("Tab 1", Orientation.Vertical); new LabelGadget(tab1, "First Tab"); var boxL = new BoxGadget(tab1, Orientation.Horizontal); new LabelGadget(boxL, "Selection:"); var cg = new ChooserGadget(boxL) { Items = new string[] { "Rows", "Cells", "Cols" } }; var table1 = new TableGadget(tab1); cg.SelectedIndexChangedEvent = (o, i) => { table1.SelectMode = (TableSelectMode)cg.SelectedIndex; }; var col1 = table1.AddColumn("Name", 100); var col2 = table1.AddColumn("Date", 100); var col3 = table1.AddColumn("Col 3", 100); for (int i = 0; i < 700; i++) { var row = table1.AddRow("" + i, "" + (i * i), "" + (i + i)); } table1.AddRow("Last", "The very last row!", "Ultimo"); var tab2 = tabs.AddTab("Tab 2", Orientation.Vertical); new LabelGadget(tab2, "Second Tab"); var hbox = new BoxGadget(tab2, Orientation.Horizontal); new LabelGadget(hbox, "Lab"); var table2 = new TableGadget(hbox) { ShowHeader = false }; Icons icon = Icons.ENTYPO_ICON_500PX; for (int i = 0; i < 700; i++) { string lab = icon.ToString(); var row = table2.AddRow(lab.Replace("ENTYPO_ICON_", "")); row.Cells[0].Icon = icon; icon++; if (icon > Icons.ENTYPO_ICON_YOUTUBE_WITH_CIRCLE) { break; } } var tab3 = tabs.AddTab("Tab 3", Orientation.Vertical); new LabelGadget(tab3, "Third Tab"); tabs.SelectedIndex = 2; } screen.ShowWindow(basicWindow); screen.WindowToFront(basicWindow); screen.ActivateWindow(basicWindow); }