コード例 #1
0
        public virtual ViewRect?GetViewRect()
        {
            //TODO: See if this can be refactored and remove browser reference
            var size = browser.Size;

            var viewRect = new ViewRect(size.Width, size.Height);

            return(viewRect);
        }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     MC.ReadMats();
     view      = new ViewRect(64, 64, 10, MC);
     view.xPos = 8.1f;
     view.yPos = 10.2f;
     view.GenerateCam();
     anim.speed = 0.0f;
 }
コード例 #3
0
        ViewRect IRenderWebBrowser.GetViewRect()
        {
            var viewRect = new ViewRect
            {
                Width  = (int)ActualWidth,
                Height = (int)ActualHeight
            };

            return(viewRect);
        }
コード例 #4
0
ファイル: ChromiumWebBrowser.cs プロジェクト: poloab/CefSharp
        ViewRect IRenderWebBrowser.GetViewRect()
        {
            var viewRect = new ViewRect
            {
                Width  = size.Width,
                Height = size.Height
            };

            return(viewRect);
        }
コード例 #5
0
ファイル: Window.cs プロジェクト: lukastk/TakaGUI
        /// <summary>
        /// Draws the window.
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="viewRect"></param>
        public override void Draw(GameTime gameTime, ViewRect viewRect)
        {
            if (IsClosed || !IsInitialized || !Activated)
            {
                return;
            }

            if (!Hidden)
            {
                ViewRect windowRect = viewRect.AddGet(new ViewRect(RealX, RealY, Width, Height));
                windowRect.Add(GetDefaultBoundaries());
                IRender render = GraphicsManager.GetRender();
                render.SetViewRect(windowRect);
                Project(gameTime, RealX, RealY, render);

                if (!DialoguesAreHidden && DarkenWhenDialogueExists && GetCurrentDialogue() != null)
                {
                    DrawBox currentDialogue = GetCurrentDialogue();

                    foreach (DrawBox d in DrawBoxList)
                    {
                        if (currentDialogue != d)
                        {
                            d.Draw(gameTime, viewRect);
                        }
                    }

                    var r = GraphicsManager.GetRender();
                    r.Begin();
                    r.Clear(DarkeningMask);
                    r.End();

                    currentDialogue.Draw(gameTime, viewRect);
                }
                else
                {
                    foreach (DrawBox d in DrawBoxList)
                    {
                        if (DialoguesAreHidden && dialogues.Contains(d))
                        {
                            continue;
                        }

                        d.Draw(gameTime, viewRect);
                    }
                }

                foreach (var f in drawDelegates)
                {
                    f(gameTime, viewRect);
                }

                drawDelegates.Clear();
            }
        }
コード例 #6
0
ファイル: Form.cs プロジェクト: lukastk/TakaGUI
        public override ViewRect GetDefaultBoundaries(int newWidth, int newHeight)
        {
            ViewRect bounds = new ViewRect();

            bounds.X      = RealX + topLeftCornerInUse.Width;
            bounds.Y      = RealY + topLeftCornerInUse.Height;
            bounds.Width  = newWidth - topLeftCornerInUse.Width - topRightCornerInUse.Width;
            bounds.Height = newHeight - topLeftCornerInUse.Height - BottomRightCorner.Height;

            return(bounds);
        }
コード例 #7
0
ファイル: Window.cs プロジェクト: lukastk/TakaGUI
        /// <summary>
        /// In addition to the normal SingleSlotBox.UpdateCursor() it also sets up the fields that
        /// is normally handled by a drawbox's container. Like LocationOrigin and MasterBoundaries...
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            // Because Window doesn't have container, these fields has to be set by the window itself.
            LocationOrigin   = new Origin(0, 0);
            Boundaries       = new ViewRect(0, 0, GraphicsManager.ScreenWidth, GraphicsManager.ScreenHeight);
            MasterBoundaries = Boundaries;

            // The Window doesn't compete with others over the under-mouse privelege, so IsUnderMouse
            // isn't set by a container.
            isUnderMouse = CheckMouseOver();

            base.Update(gameTime);
        }
コード例 #8
0
ファイル: SlotBox.cs プロジェクト: lukastk/TakaGUI
        public override void Draw(GameTime gameTime, ViewRect viewRect)
        {
            base.Draw(gameTime, viewRect);

            if (!IsInitialized || !Activated || Hidden)
            {
                return;
            }

            viewRect.Add(Boundaries);
            viewRect.Add(GetMasterBoundaries());

            if (!DialoguesAreHidden && DarkenWhenDialogueExists && GetCurrentDialogue() != null)
            {
                DrawBox currentDialogue = GetCurrentDialogue();

                foreach (DrawBox d in DrawBoxList)
                {
                    if (currentDialogue != d)
                    {
                        d.Draw(gameTime, viewRect);
                    }
                }

                var render = GraphicsManager.GetRender();
                render.Begin();
                render.Clear(DarkeningMask);
                render.End();

                currentDialogue.Draw(gameTime, viewRect);
            }
            else
            {
                foreach (DrawBox d in DrawBoxList)
                {
                    if (DialoguesAreHidden && dialogues.Contains(d))
                    {
                        continue;
                    }

                    d.Draw(gameTime, viewRect);
                }
            }
        }
コード例 #9
0
        public override void ProcessEvents(Event e)
        {
            base.ProcessEvents(e);

            if (ViewRect.Contains(e.mousePosition))
            {
                if (e.button == 0)
                {
                    if (e.type == EventType.MouseDown)
                    {
                    }

                    if (e.type == EventType.MouseDrag)
                    {
                    }

                    if (e.type == EventType.MouseUp)
                    {
                    }
                }

                if (e.button == 1)
                {
                    if (e.type == EventType.MouseDown)
                    {
                        MousePosition = e.mousePosition;
                        NodeToDelete  = null;
                        if (CurrentGraph != null)
                        {
                            NodeToDelete = CurrentGraph.Nodes.FirstOrDefault(x => x.NodeRect.Contains(e.mousePosition));
                        }

                        if (NodeToDelete == null)
                        {
                            ProcessContextMenu(e, 0);
                        }
                        else
                        {
                            ProcessContextMenu(e, 1);
                        }
                    }
                }
            }
        }
コード例 #10
0
        public virtual void Draw(GameTime gameTime, ViewRect viewRect)
        {
            if (IsClosed || !IsInitialized || !Activated || Hidden)
            {
                return;
            }

            viewRect.Add(MasterBoundaries);
            viewRect.Add(Boundaries);
            viewRect.Add(new ViewRect(Container.RealX, Container.RealY, Container.Width, Container.Height));
            viewRect.Add(new ViewRect(RealX, RealY, Width, Height));
            IRender render = GraphicsManager.GetRender();

            if (DrawBoundaries)
            {
                render.SetViewRect(viewRect);
            }

            Project(gameTime, RealX, RealY, render);

            render.Reset();
        }
コード例 #11
0
ファイル: Push.cs プロジェクト: lukastk/TakaGUI
        public static void FromSide(DrawBox box, int distance, Side edge)
        {
            ViewRect bounds = box.Boundaries;

            switch (edge)
            {
            case Side.Top:
                box.Y = distance;
                break;

            case Side.Bottom:
                box.Y = bounds.Height - box.Height - distance;
                break;

            case Side.Left:
                box.X = distance;
                break;

            case Side.Right:
                box.X = bounds.Width - box.Width - distance;
                break;
            }
        }
コード例 #12
0
    void RenderAnim(int _frame, int _tFrame, ViewRect rect)
    {
        render = true;
        // recersive function to render frames
        if (_frame >= _tFrame)
        {
            render = false;
            temp   = view.normalSheet;
            temp.Apply();
            view.SaveSheets(@"C:\Users\student.CSS-RM107-29\Documents\Processing\cum\Git\LastBeat\CharacterRender\Assets\STONK");
            return; // break statment
        }
        if (_frame == 0)
        {
            view.InitSheet((int)_tFrame); // initialize texture
        }
        JumpTo(_frame, _tFrame);
        view.Render();
        view.StitchTex(_frame);


        _frame++; // step frame
        RenderAnim(_frame, _tFrame, rect);
    }
コード例 #13
0
ファイル: ComboBox.cs プロジェクト: lukastk/TakaGUI
        void DrawOpen(GameTime gameTime, ViewRect viewRect)
        {
            if (IsClosed || !IsInitialized || !Activated || Hidden)
            {
                return;
            }

            viewRect.Add(MasterBoundaries);
            IRender render = GraphicsManager.GetRender();

            int x = RealX;
            int y = RealY;

            render.AddViewRect(new ViewRect(x, y + TextFieldHeight, TextFieldWidth, OpenHeight - TextFieldHeight));

            render.Begin();

            render.DrawRect(new Rectangle(x, y + TextFieldHeight, TextFieldWidth, OpenHeight - TextFieldHeight), OpenBackgroundColor);

            //DrawSprite items
            int drawY = y + TextFieldHeight - ItemPositionY + itemMargin;

            foreach (string line in Items)
            {
                Rectangle area = new Rectangle(x, drawY, TextFieldWidth, Font.CharHeight + Font.VerticalSpace);
                if (IsMouseInRect(area))
                {
                    render.DrawRect(area, MouseOverElementColor);
                }

                Font.DrawString(line, new Point(x + itemMargin, drawY), OpenFontColor, render);
                drawY += Font.CharHeight + Font.VerticalSpace;
            }

            render.End();
        }
コード例 #14
0
ファイル: ChromiumWebBrowser.cs プロジェクト: shkdee/CefSharp
        /// <summary>
        /// Gets the view rect (width, height)
        /// </summary>
        /// <returns>ViewRect.</returns>
        protected virtual ViewRect GetViewRect()
        {
            var viewRect = new ViewRect(size.Width, size.Height);

            return(viewRect);
        }
コード例 #15
0
 public void ParentToViewRect(ViewRect parent)
 {
     this.transform.SetParent(parent.transform, false);
     FitToParent();
 }
コード例 #16
0
 public static Rect ToRect(this ViewRect view)
 {
     return(new Rect(view.X, view.Y, view.Width, view.Height));
 }
コード例 #17
0
 public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, ViewRect viewRect)
 {
     base.Draw(gameTime, viewRect);
 }
コード例 #18
0
        /// <summary>
        /// Gets the view rect.
        /// </summary>
        /// <returns>ViewRect.</returns>
        ViewRect IRenderWebBrowser.GetViewRect()
        {
            var viewRect = new ViewRect(size.Width, size.Height);

            return(viewRect);
        }
コード例 #19
0
ファイル: MenuBar.cs プロジェクト: lukastk/TakaGUI
        void DrawMenu(GameTime gameTime, ViewRect viewRect)
        {
            if (IsClosed || !IsInitialized || !Activated || Hidden)
            {
                return;
            }

            viewRect.Add(MasterBoundaries);
            IRender render = GraphicsManager.GetRender();

            int x = RealX;
            int y = RealY;

            int posX  = x + menuItemMarginX;
            int posY  = y + Height / 2 - Font.CharHeight / 2;
            int count = 0;

            foreach (var item in MenuItems)
            {
                int strinW = Font.MeasureString(item.Name).X;

                if (count == SelectedMenuItem && ItemIsOpen)
                {
                    render.Begin();

                    Color color = count == SelectedMenuItem && item.Enabled ? FontHighlightColor : FontColor;

                    render.DrawHorizontalLine(new Point(posX, y + menuItemMarginY), strinW, DropdownBorder);
                    render.DrawVerticalLine(new Point(posX, y + menuItemMarginY), Height - menuItemMarginY + toolbarDropdownMargin, DropdownBorder);
                    render.DrawVerticalLine(new Point(posX + strinW, y + menuItemMarginY), Height - menuItemMarginY + toolbarDropdownMargin, DropdownBorder);

                    render.DrawRect(new Rectangle(posX + 1, y + menuItemMarginY + 1, strinW - 2, Height - menuItemMarginY + toolbarDropdownMargin - 2), DropdownBody);

                    Font.DrawString(item.Name, new Point(posX + 1, posY), color, render);

                    //DropdownMenu

                    int top = y + Height + toolbarDropdownMargin - 1;

                    render.DrawHorizontalLine(new Point(posX + strinW, top), dropdownMenuWidth - strinW, DropdownBorder);
                    render.DrawHorizontalLine(new Point(posX, top + dropdownMenuHeight), dropdownMenuWidth, DropdownBorder);
                    render.DrawVerticalLine(new Point(posX, top), dropdownMenuHeight, DropdownBorder);
                    render.DrawVerticalLine(new Point(posX + dropdownMenuWidth - 1, top), dropdownMenuHeight, DropdownBorder);

                    render.DrawRect(new Rectangle(posX + 1, top + 1, dropdownMenuWidth - 3, dropdownMenuHeight - 2), DropdownBody);

                    int elemX        = posX;
                    int elemY        = top + menuElemMarginY;
                    var selectedItem = MenuItems[SelectedMenuItem];
                    int c            = 0;
                    foreach (var elem in selectedItem.Elements)
                    {
                        int elemH;
                        if (elem.Name != null)
                        {
                            elemH = Font.MeasureString(elem.Name).Y + menuElemMarginY;
                        }
                        else
                        {
                            elemH = separatorHeight;
                        }

                        if (c == SelectedMenuElement && item.Enabled && elem.Enabled)
                        {
                            render.DrawRect(new Rectangle(elemX + 1, elemY - menuElemMarginY + 2, dropdownMenuWidth - 3, elemH - 2), ElementHighlightColor);
                        }

                        if (elem.IsSeparator)
                        {
                            render.DrawLine(new Vector2(elemX + separatorMargin, elemY + separatorHeight / 2),
                                            new Vector2(elemX + dropdownMenuWidth - separatorMargin, elemY + separatorHeight / 2), SeparatorColor);
                        }
                        else
                        {
                            Font.DrawString(elem.Name, new Point(elemX + menuElemMarginX, elemY), FontColor, render);
                        }

                        elemY += elemH;

                        c += 1;
                    }

                    render.End();
                }

                posX  += strinW + menuItemMarginX;
                count += 1;
            }

            render.Reset();
        }
コード例 #20
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            ViewRect orig = render.GetViewRect();

            render.Begin();

            ISprite iconUpSignInUse = UpIsPressed ? IconUpSignPressed : IconUpSign;
            ISprite iconInsideInUse = UpIsPressed ? IconInsidePressed : IconInside;

            //	/-------\
            //  |  /|\  |
            //  | / | \ |
            //  |   |   |
            //  \-------/
            render.DrawSprite(IconTop, new Vector2(x, y), Color.White);
            render.DrawSprite(IconLeft, new Rectangle(x, y + IconTop.Height, IconLeft.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White);
            render.DrawSprite(IconRight, new Rectangle(x + IconTop.Width - IconRight.Width, y + IconTop.Height, IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White);
            render.DrawSprite(IconBottom, new Vector2(x, y + UpperFieldHeight - IconBottom.Height), Color.White);
            render.DrawSprite(iconInsideInUse, new Rectangle(x + IconLeft.Width, y + IconTop.Height, IconTop.Width - IconLeft.Width - IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White);
            render.DrawSprite(IconUpSign, new Vector2(x + IconLeft.Width + ((IconTop.Width - IconLeft.Width - IconRight.Width) / 2) - (IconUpSign.Width / 2), y + (UpperFieldHeight / 2) - (IconUpSign.Height / 2)), Color.White);

            //UPPER FIELD:
            //Top
            render.DrawSprite(TopBorder, new Rectangle(x + IconTop.Width, y, Width - IconTop.Width - TopRightCorner.Width, TopBorder.Height), Color.White);
            //TopRight
            render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White);
            //Right
            render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopRightCorner.Height, RightBorder.Width, UpperFieldHeight - TopRightCorner.Height - UpperFieldBottomRightCorner.Height), Color.White);
            //BottomRight
            render.DrawSprite(UpperFieldBottomRightCorner, new Vector2(x + Width - UpperFieldBottomRightCorner.Width, y + UpperFieldHeight - UpperFieldBottomRightCorner.Height), Color.White);
            //Bottom
            render.DrawSprite(BottomBorder, new Rectangle(x + IconTop.Width, y + UpperFieldHeight - BottomBorder.Height, Width - IconTop.Width - TopRightCorner.Width, BottomBorder.Height), Color.White);
            //Inside
            render.DrawSprite(Inside, new Rectangle(x + IconTop.Width, y + TopBorder.Height, Width - IconTop.Width - RightBorder.Width, UpperFieldHeight - TopBorder.Height - BottomBorder.Height), Color.White);

            //LOWER FIELD:
            //Middle
            render.DrawSprite(MiddleBorder, new Rectangle(x + LeftBorder.Width, y + UpperFieldHeight, LowerFieldWidth - LeftBorder.Width - RightBorder.Width, MiddleBorder.Height), Color.White);
            //Right
            render.DrawSprite(RightBorder, new Rectangle(x + LowerFieldWidth - RightBorder.Width, y + UpperFieldHeight, RightBorder.Width, LowerFieldHeight - BottomRightCorner.Height), Color.White);
            //BottomRight
            render.DrawSprite(BottomRightCorner, new Vector2(x + LowerFieldWidth - BottomRightCorner.Width, y + UpperFieldHeight + LowerFieldHeight - BottomRightCorner.Height), Color.White);
            //Bottom
            render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + UpperFieldHeight + LowerFieldHeight - BottomBorder.Height, LowerFieldWidth - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White);
            //BottomLeft
            render.DrawSprite(BottomLeftCorner, new Vector2(x, y + UpperFieldHeight + LowerFieldHeight - BottomLeftCorner.Height), Color.White);
            //Left
            render.DrawSprite(LeftBorder, new Rectangle(x, y + UpperFieldHeight, LeftBorder.Width, LowerFieldHeight - BottomLeftCorner.Height), Color.White);
            //Inside
            render.DrawSprite(Inside, new Rectangle(x + LeftBorder.Width, y + UpperFieldHeight + MiddleBorder.Height, LowerFieldWidth - LeftBorder.Width - RightBorder.Width, LowerFieldHeight - MiddleBorder.Height - BottomBorder.Height), Color.White);

            render.End();

            render.SetViewRect(orig.AddGet(new ViewRect(RealX + IconTop.Width + TextMargin, RealY + TopBorder.Height + TextMargin, Width - IconTop.Width - RightBorder.Width - TextMargin * 2, UpperFieldHeight - TopBorder.Height - MiddleBorder.Height - TextMargin * 2)));
            render.Begin();

            string textToDraw = Text;

            if (HasFocus)
            {
                textToDraw = Text.Insert(CursorPosition, "|");
            }
            Font.DrawString(textToDraw, new Point(RealX + IconTop.Width + TextMargin, RealY + TopBorder.Height + TextMargin), FontColor, render);

            render.End();

            render.SetViewRect(orig.AddGet(new ViewRect(selectorX, selectorY, selectorWidth, selectorHeight)));
            render.Begin();

            int drawX = selectorX + textAreaOriginX;
            int drawY = selectorY + textAreaOriginY;

            //DrawSprite filedir
            Font.DrawString(CurrentDirectory.FullName, new Point(drawX, drawY), FontColor, render);
            drawY += TextMargin + Font.CharHeight;
            render.DrawLine(new Vector2(drawX, drawY), new Vector2(selectorX + selectorWidth, drawY), SeparatorColor);
            drawY += 1 + TextMargin;

            foreach (DirectoryInfo d in directoryList)
            {
                if (selectedDirectories.Contains(d))
                {
                    render.DrawRect(new Rectangle(selectorX, drawY, selectorWidth, Font.CharHeight + Font.VerticalSpace), SelectedColor);
                }

                render.DrawSprite(FolderSign, new Vector2(drawX, drawY), Color.White);

                Font.DrawString(d.Name, new Point(drawX + FolderSign.Width + TextMargin, drawY), FontColor, render);
                drawY += Font.CharHeight + Font.VerticalSpace;
            }

            foreach (FileInfo f in fileList)
            {
                if (selectedFiles.Contains(f))
                {
                    render.DrawRect(new Rectangle(selectorX, drawY, selectorWidth, Font.CharHeight + Font.VerticalSpace), SelectedColor);
                }

                Font.DrawString(f.Name, new Point(drawX, drawY), FontColor, render);
                drawY += Font.CharHeight + Font.VerticalSpace;
            }

            render.End();
        }
コード例 #21
0
 //private static extern int SetViewPosition(void* hwnd, ViewRect viewPos);
 public static extern int SetViewPosition(IntPtr hwnd, ViewRect viewPos);
コード例 #22
0
        private void HighlightGUI()
        {
            if (HighlightTF && (
                    Event.current.type == EventType.MouseMove ||
                    (Event.current.type == EventType.MouseDrag && Event.current.button == 0) ||
                    Event.current.type == EventType.MouseUp ||
                    Event.current.type == EventType.ScrollWheel ||
                    Event.current.type == EventType.MouseDown
                    ))
            {
                HoveringVoxelPosition = null;

                if (!ViewRect.Contains(Event.current.mousePosition))
                {
                    if (HighlightTF.gameObject.activeSelf)
                    {
                        HighlightTF.gameObject.SetActive(false);
                        Repaint();
                    }
                    return;
                }

                ViewCastHit((hit) => {
                    string hitName = hit.transform.name;

                    if (hitName == "Cube")
                    {
                        // Cube
                        HighlightTF.gameObject.SetActive(true);
                        HighlightTF.position   = hit.point;
                        HighlightTF.localScale = hit.transform.localScale * 0.5f;
                        HighlightTF.rotation   = Quaternion.LookRotation(-hit.normal);
                        Repaint();
                    }
                    else if (IsRigging)
                    {
                        if (PaintingBoneIndex == -1 || CurrentBrushType == BrushType.Rect)
                        {
                            if (HighlightTF.gameObject.activeSelf)
                            {
                                HighlightTF.gameObject.SetActive(false);
                                Repaint();
                            }
                        }
                        else
                        {
                            // Editing Bone
                            if (hitName == "Voxel")
                            {
                                HighlightTF.gameObject.SetActive(true);
                                HighlightTF.position   = hit.transform.position;
                                HighlightTF.localScale = hit.transform.localScale;
                                HighlightTF.rotation   = Quaternion.LookRotation(-hit.normal);
                                HoveringVoxelPosition  = hit.transform.parent.localPosition;
                                HoveredVoxelPosition   = HoveringVoxelPosition;
                                Repaint();
                            }
                            else if (hitName == "Box")
                            {
                                HighlightTF.gameObject.SetActive(true);
                                int maxAxis    = Util.MaxAxis(hit.normal);
                                Vector3 offset = ContainerTF.position;
                                var newPos     = new Vector3(
                                    Mathf.Round(hit.point.x - offset.x) + offset.x,
                                    Mathf.Round(hit.point.y - offset.y) + offset.y,
                                    Mathf.Round(hit.point.z - offset.z) + offset.z
                                    );
                                newPos[maxAxis]        = hit.point[maxAxis];
                                HighlightTF.position   = newPos;
                                HighlightTF.localScale = Vector3.one;
                                HighlightTF.rotation   = Quaternion.LookRotation(-hit.normal);
                                HoveringVoxelPosition  = HighlightTF.localPosition - ContainerTF.localPosition;
                                HoveredVoxelPosition   = HoveringVoxelPosition;
                                Repaint();
                            }
                            else
                            {
                                if (HighlightTF.gameObject.activeSelf)
                                {
                                    HighlightTF.gameObject.SetActive(false);
                                    Repaint();
                                }
                            }
                        }
                    }
                    else
                    {
                        if (HighlightTF.gameObject.activeSelf)
                        {
                            HighlightTF.gameObject.SetActive(false);
                            Repaint();
                        }
                    }
                }, () => {
                    if (HighlightTF.gameObject.activeSelf)
                    {
                        HighlightTF.gameObject.SetActive(false);
                        Repaint();
                    }
                });
            }
        }