protected override void Render(Gwen.Skin.Base skin) { if (dirty) { dirty = false; byte[] pixelData = new byte[Width * Height * 4]; for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { int XLoc = (int)((((float)x) / Width) * gltex.Width); int YLoc = (int)((((float)y) / Height) * gltex.Height); Color c = gltex.Image.GetPixel(XLoc, YLoc); pixelData[4 * (x + y * Width)] = c.R; pixelData[4 * (x + y * Width) + 1] = c.G; pixelData[4 * (x + y * Width) + 2] = c.B; pixelData[4 * (x + y * Width) + 3] = c.A; } } tex = new Gwen.Texture(skin.Renderer); tex.Width = Width; tex.Height = Height; tex.LoadRaw(Width, Height, pixelData); } skin.Renderer.DrawColor = Color.White; skin.Renderer.DrawTexturedRect(tex, RenderBounds); }
public ControlToolbox(Gwen.Control.Base parent) : base(parent) { Width = 150; Margin = new Gwen.Margin( 5, 5, 5, 5 ); SetText( "Controls" ); var pTileLayout = new Gwen.Control.Layout.Tile( this ); pTileLayout.SetTileSize(22, 22); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) foreach (var controlType in assembly.GetTypes().Where<Type>(type => type.IsSubclassOf(typeof(Gwen.Control.Base)))) { if (controlType == typeof(DesignerBase)) continue; var pButton = new Gwen.Control.Button(pTileLayout); pButton.SetSize( 20, 20 ); pButton.SetToolTipText(controlType.Name); //pButton.SetImage("img/controls/" + controlType.Name + ".png"); pButton.ShouldDrawBackground = true; // // Make drag and droppable. Pass the ControlFactory as the userdata // pButton.DragAndDrop_SetPackage(true, "ControlSpawn", controlType);//,pControlFactory ); } }
public ReflectionProperties(Gwen.Control.Base parent) : base(parent) { ptree = new Gwen.Control.PropertyTree(this); //properties = new Gwen.Control.Properties(this); ptree.Dock = Gwen.Pos.Fill; }
public Cage(Gwen.Control.Base parent) : base(parent) { m_Control = null; m_iBorder = 5; m_bDragged = false; }
public ToolBar(Gwen.Control.Base parent) { pTileLayout = new Gwen.Control.Layout.Tile(parent); pTileLayout.SetTileSize(22, 22); pTileLayout.Height = 24; pTileLayout.Dock = Gwen.Pos.Top; }
public Hierarchy( Gwen.Control.Base parent ) : base(parent) { SetSize( 200, 200 ); m_Tree = new Gwen.Control.TreeControl( this ); m_Tree.Dock = Pos.Fill; }
void btnAccept_Clicked(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs arguments) { //You can easily create a message boxes known from OS Gwen.Control.MessageBox mbName = new Gwen.Control.MessageBox(this, "Your name is " + tbName.Text, "Message Box"); btnAccept.Text = "Accepted!"; }
public void Setup(Gwen.Control.Base target) { if(Target != null) Target.PropertyChanged -= TargetPropertyChanged; Target = target; UpdateProperties(); target.PropertyChanged += TargetPropertyChanged; }
public DocumentTab(Gwen.Control.Base parent) { tabControl = new Gwen.Control.TabControl(parent) { Dock = Gwen.Pos.Fill }; tabButtons = new Dictionary<int, TabButton>(); tabControl.TabSelected += OnTabSelected; }
public DocumentCanvas(Gwen.Control.Base parent) : base(parent) { ShouldDrawBackground = true; m_SelectionLayer = new SelectionLayer( this ); /* m_SelectionLayer.PropertiesChanged += OnPropertiesChanged; m_SelectionLayer.HierachyChanged += OnHierachyChanged; ControlFactory::Base* pControlFactory = Gwen::ControlFactory::Find( "DesignerCanvas" ); UserData.Set( "ControlFactory", pControlFactory );*/ }
public void Init(Gwen.Renderer.Base renderer, string textureName) { this.renderer = renderer; skin = new Gwen.Skin.TexturedBase(renderer, textureName); Canvas = new Gwen.Control.Canvas(skin); ToolBar = new ToolBar(Canvas); DocumentTab = new DocumentTab(Canvas); if (GUIInitiated != null) GUIInitiated.Invoke(); }
void CloseDocument(Gwen.Control.Base target) { /* Document doc = CurrentDocument(); if ( !doc ) return; doc.DelayedDelete(); var pButton = m_DocumentHolder.GetCurrentButton(); if ( !pButton ) return; m_DocumentHolder.RemovePage( pButton ); pButton.DelayedDelete();*/ }
public void AddSelection(Gwen.Control.Base pControl, bool fireEvent) { Cage pCage = new Cage( this ); pCage.Setup(pControl); pCage.Moving += OnCageMoving; m_Selected.Add( pControl ); if (fireEvent && SelectionChanged != null) SelectionChanged.Invoke(m_Selected); Redraw(); }
public DesignerBase(Gwen.Control.Base parent) : base(parent) { base.Dock = Pos.Fill; CreateMenu(); CreateToolBar(); CreateControlToolbox(); CreateDocumentHolder(); new Gwen.Control.StatusBar(this);// , "StatusBar" ); NewDocument(this); }
void RecursiveBuildTree(DirectoryInfo dirRoot, Gwen.Control.TreeNode treeIter){ MeshPipeline.SetMeshContext<ushort,BasicVertexFormat> (); foreach (DirectoryInfo di in dirRoot.EnumerateDirectories()) { if (!di.Name.StartsWith (".")) { var iter=treeIter.AddNode (di.Name); foreach (FileInfo file in FilterFiles(di,SharpAsset.Pipeline.SupportedFileFormatsAttribute.importers.Keys)) { if (SupportedFileFormatsAttribute.importers.ContainsKey(file.Extension) && !file.Name.StartsWith(".")) iter.AddNode(SupportedFileFormatsAttribute.importers[file.Extension].Import(file.FullName)); } RecursiveBuildTree (di, iter); } } }
public void InitControl(Gwen.Control.Base parent) { /* var tree = new Gwen.Control.TreeControl(parent); tree.Dock = Gwen.Pos.Left; tree.Width = 150; var projectNode = new Gwen.Control.TreeNode(tree); projectNode.Text = "Project"; projectNode.Dock = Gwen.Pos.Top; var doc1 = new Gwen.Control.TreeNode(projectNode); doc1.Text = "Doc1"; doc1.Dock = Gwen.Pos.Top;*/ }
private void button1Click(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e) { GameFiber.StartNew(delegate { FileStream fs = new FileStream("saves.txt", FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(EntryPoint._instance.playerSaves.ToString() + " " + "// " + textBox1.Text); sw.Close(); fs.Close(); Game.DisplayNotification("Position ~g~successful~s~ saved"); }); this.Window.Close(); }
protected override void PostLayout(Gwen.Skin.Base skin) { if ( m_Control == null ) return; Point canvaspos = m_Control.LocalPosToCanvas(Point.Empty); Point parentpos = Parent.CanvasPosToLocal(canvaspos); parentpos.X -= m_iBorder; parentpos.Y -= m_iBorder; SetPosition(parentpos.X,parentpos.Y); var width = m_Control.Width + m_iBorder * 2; var height = m_Control.Height + m_iBorder * 2; SetSize( width, height ); }
//ImportExport.Base* m_Exporter; //ImportExport::Base* m_Importer; public Document(Gwen.Control.Base parent, string name) : base(parent) { Dock = Pos.Fill; Padding = new Padding( 1, 1, 1, 1 ); // The main horizontal splitter separates the document from the tree/properties var pSplitter = new Gwen.Control.VerticalSplitter(this); pSplitter.Dock = Pos.Fill; //pSplitter.SetScaling( true, 200 ); // The white background DocumentInner pInner = new DocumentInner(pSplitter); pInner.Dock = Pos.Fill; // The vertical splitter on the right containing the tree/properties var pRightSplitter = new Gwen.Control.HorizontalSplitter(pSplitter); pRightSplitter.Dock = Pos.Fill; pRightSplitter.SetSize( 200, 200 ); //pRightSplitter.SetScaling( false, 200 ); pSplitter.SetPanel(0,pInner); pSplitter.SetPanel(1,pRightSplitter); // The actual canvas onto which we drop controls Canvas = new DocumentCanvas( pInner ); Canvas.Dock = Pos.Fill; Canvas.HierachyChanged += OnHierachyChanged; Canvas.SelectionChanged += OnSelectionChanged; // The controls on the right Hierarchy = new Hierarchy( pRightSplitter ); Hierarchy.WatchCanvas( Canvas ); Hierarchy.Dock = Pos.Fill; m_pPropreties = new ReflectionProperties(pRightSplitter); //new Properties( pRightSplitter ); m_pPropreties.Setup(Canvas); m_pPropreties.Dock = Pos.Fill; pRightSplitter.SetPanel(0, Hierarchy); pRightSplitter.SetPanel(1, m_pPropreties); }
public void Init(Gwen.Renderer.Base renderer, string textureName) { this.renderer = renderer; skin = new Gwen.Skin.TexturedBase(renderer, textureName); skin = new Gwen.Skin.Simple(renderer); skin.DefaultFont = new Font(renderer, "Courier", 10); canvas = new Gwen.Control.Canvas(skin); ToolBar = new ToolBar(canvas); DocumentTab = new DocumentTab(canvas); var label = new Gwen.Control.Label(canvas); canvas.AddChild(label); label.SetText("YOLO!"); if (Initiated != null) Initiated.Invoke(); }
public override bool DragAndDrop_HandleDrop(Gwen.DragDrop.Package pPackage, int x, int y) { var pPos = CanvasPosToLocal( new Point( x, y ) ); m_SelectionLayer.Hide(); var pDroppedOn = GetControlAt( pPos.X, pPos.Y ); // pDroppedOn = FindParentControlFactoryControl( pDroppedOn ); m_SelectionLayer.Show(); if ( pDroppedOn == null ) pDroppedOn = this; pPos = pDroppedOn.CanvasPosToLocal( new Point( x, y ) ); if ( pPackage.Name == "ControlSpawn" ) { //ControlFactory::Base* pControlFactory = static_cast<ControlFactory::Base*>(pPackage->userdata); var type = pPackage.data as Type; if (type == null) return false; //TODO LOG var constructor = type.GetConstructor(new Type[] { typeof(Gwen.Control.Base) }); if (constructor == null) return false; //TODO LOG var pControl = (Gwen.Control.Base) constructor.Invoke(new object[] { pDroppedOn }); if (pControl == null) return false; //TODO LOG pControl.SetPosition(pPos.X, pPos.Y); pControl.MouseInputEnabled = true ; if (ChildAdded != null) ChildAdded.Invoke(pControl); return true; } return false; }
public void InitControl(Gwen.Control.Base parent) { /* var ptree = new Gwen.Control.PropertyTree(parent); ptree.Dock = Gwen.Pos.Left; ptree.Width = 200; { var props = ptree.Add("Item One"); props.ValueChanged += OnChanged; props.Add("Middle Name"); props.Add("Last Name"); props.Add("Four"); props.Add("More Items"); props.Add("Bacon", new Gwen.Control.Property.Check(props), "1"); props.Add("To Fill"); props.Add("Colour", new Gwen.Control.Property.Color(props), "255 0 0"); props.Add("Out Here"); } ptree.ExpandAll();*/ }
void AddControlNode( Gwen.Control.TreeNode pNode, Gwen.Control.Base pControl ) { if (pControl.GetType() == typeof(SelectionLayer)) return; var strName = pControl.Name; if ( strName == null || strName == "" ) strName = "[" + pControl.GetType().Name + "]"; var pChildNode = pNode.AddNode( strName ); //pChildNode.SetImage("img/controls/" + pControl.GetType().Name + ".png"); pChildNode.Selected += OnNodeSelected; pChildNode.UserData.Add("TargetControl", pControl); //pChildNode.ShouldDrawBackground = true; pChildNode.DragAndDrop_SetPackage(true, "ControlHierarchy", pChildNode); pChildNode.DragAndDropCanAcceptPackage += new Func<Gwen.Control.Base, Gwen.DragDrop.Package, bool>( delegate(Gwen.Control.Base c, Gwen.DragDrop.Package p) { return p.Name == "ControlHierarchy"; }); pChildNode.DragAndDropHandleDrop += new Func<Gwen.Control.Base, Gwen.DragDrop.Package, int, int, bool>( delegate(Gwen.Control.Base control, Gwen.DragDrop.Package p, int x, int y) { var childNode = p.data as Gwen.Control.TreeNode; var node = control as Gwen.Control.TreeNode; if (childNode == null || node == null) return false; node.AddNode(childNode); return true; }); foreach (var child in pControl.Children) { AddControlNode( pChildNode, child ); } }
public override void DrawTexturedRect(Gwen.Texture tex, Rectangle targetRect, Color clr, float u1 = 0, float v1 = 0, float u2 = 1, float v2 = 1) { if (tex.RendererData != null) { UnityEngine.Texture uTex = (UnityEngine.Texture)tex.RendererData; DrawTexturedRect(uTex, targetRect, clr, u1, v1, u2, v2); } else { DrawMissingImage(targetRect); } }
private void OnTabSelected(Gwen.Control.Base control) { if (DocumentSelected != null) DocumentSelected.Invoke(tabButtons.Single(kvp => kvp.Value == control).Key); }
public void InitGUI(Gwen.Control.Base rootGUI) { var label = new Gwen.Control.Label(rootGUI); label.SetText("YEAH"); label.Height = 100; }
/*virtual void Initialize( Gwen.Control.TabButton pTab ); virtual void DoSaveAs( ImportExport::Base* exporter ); virtual void DoSave( ImportExport::Base* exporter ); virtual void LoadFromFile( const Gwen::String& str, ImportExport::Base* exporter ); virtual void Command( const Gwen::String& str ); void DoSaveFromDialog( Event::Info info );*/ void OnHierachyChanged(Gwen.Control.Base caller) { Hierarchy.CompleteRefresh(); }
static void exitButton_OnDown(Gwen.Controls.Base control) { Environment.Exit(0); }
public GUIComponentContainer(Gwen.Renderer.OpenTK renderer, Gwen.Skin.Base skin) : this() { Renderer = renderer; Skin = skin; }
public override bool DragAndDrop_CanAcceptPackage( Gwen.DragDrop.Package pPackage ) { return pPackage.Name == "ControlSpawn"; }
private static void OnLoadingComplete() { if (ObjectManager.Player == null) { return; } buff.OnGameLoad(); try { switch (GameObjects.Player.CharacterName) { case "Jayce": Jayce.OnGameLoad(); break; case "DrMundo": DrMundo.OnGameLoad(); break; case "Veigar": veigar.OnGameLoad(); break; case "MonkeyKing": Wukong.OnGameLoad(); break; case "Lux": lux.OnGameLoad(); break; case "MissFortune": MF.OnGameLoad(); break; case "Ivern": ivern.OnGameLoad(); break; case "Trundle": Trundle.OnGameLoad(); break; case "Warwick": Warwick.OnGameLoad(); break; case "Ryze": ryze.OnGameLoad(); break; case "RekSai": RekSai.OnGameLoad(); break; case "Taliyah": Taliyah.OnGameLoad(); break; case "Gangplank": gankplank.OnGameLoad(); break; case "Tryndamere": Tryndamere.OnGameLoad(); break; case "Anivia": Anivia.OnGameLoad(); break; case "Garen": Garen.OnGameLoad(); break; case "Gwen": Gwen.OnGameLoad(); break; case "Illaoi": Illaoi.OnGameLoad(); break; case "Mordekaiser": Mordekaiser.OnGameLoad(); break; case "Rumble": Rumble.OnGameLoad(); break; case "XinZhao": XinZhao.OnGameLoad(); break; case "Renekton": Renekton.OnGameLoad(); break; case "Chogath": Chogath.OnGameLoad(); break; case "Urgot": Urgot.OnGameLoad(); break; case "Kayle": Kayle.OnGameLoad(); break; default: Game.Print("<font color='#b756c5' size='25'>SimpleAIO Does Not Support :" + ObjectManager.Player.CharacterName + "</font>"); Console.WriteLine("Not Supported " + ObjectManager.Player.CharacterName); break; } } catch (Exception ex) { Game.Print("Error in loading"); Console.WriteLine("Error in loading :"); Console.WriteLine(ex); } }