Example #1
0
        public DrawPanel()
        {
            InitializeComponent();
            SetStyle(ControlStyles.SupportsTransparentBackColor |ControlStyles.Opaque |
            ControlStyles.UserPaint |
            ControlStyles.AllPaintingInWmPaint, true);

            canvas = null;

            this.Paint += DrawPanel_Paint;
        }
Example #2
0
        public void Draw(Canvas canvas)
        {
            foreach (IUpdateable up in updateables)
            {
                up.Update();
            }

            canvas.SetClearColor(BackgroundColor);
            canvas.Clear();

            foreach (IDrawable drawable in drawables)
            {
                drawable.Draw(canvas);
            }

            canvas.Present();
        }
Example #3
0
        public override void Draw(Canvas canvas)
        {
            destRect.left = X;
            destRect.top = Y;
            destRect.right = X + ClipWidth;
            destRect.bottom = Y + ClipHeight;

            if (texture != null)
            {
                if (animated)
                {
                    srcRect.right = srcRect.left + (int)frameWidth;
                    srcRect.bottom = srcRect.top + (int)frameHeight;
                    canvas.DrawTexturePart(texture, destRect, srcRect, Rotation);
                }
                else
                    canvas.DrawTextureFull(texture, destRect, Rotation);
                if (fComponent.InFocus)
                {
                    canvas.DrawRect(destRect, Color.Red);
                }
            }
            else
            {
                if (fComponent.InFocus)
                    currentColor = Color.Red;
                else currentColor = Color.Green;

                canvas.DrawRect(destRect, currentColor);
            }
        }
Example #4
0
 public abstract void Draw(Canvas canvas);
Example #5
0
        private void Init()
        {
            CursorHandler.SetMainForm(this);

            GameApp.Init();
            TextRenderer.Init();

            objectsTree.Nodes.Add(GameApp.GetTreeNode());
            GameApp.OnTreeNodeAdd();

            pbDraw.Init();
            canvas = pbDraw.GetCanvas();
            canvas.SetClearColor(Color.Black);

            PropPanelLoader.SetMainPropPanel(propPanel);
            TextureFactory.SetDevicePtr(canvas.GetDevice());

            GameApp.ShowPropsPanel();

            ToolManager.SetCurrentTool(new InteractionTool());

            fpsCounter = new System.Diagnostics.Stopwatch();
        }
Example #6
0
 public void Init()
 {
     canvas = new Canvas(Handle, (uint)Height, (uint)Width);
 }
Example #7
0
        public override void Draw(Canvas canvas)
        {
            if (needReDraw)
            {
                if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(opt.fontName))
                    texture = null;
                else
                    texture = TextRenderer.RenderText(opt, text);

                needReDraw = false;
            }

            destRect.left = X;
            destRect.top = Y;
            destRect.right = X + ClipWidth;
            destRect.bottom = Y + ClipHeight;

            if (texture != null)
            {
                canvas.DrawTextureFull(texture, destRect, 0);
                if (fComponent.InFocus)
                {
                    canvas.DrawRect(destRect, Color.Red);
                }
            }
            else
            {
                if (fComponent.InFocus)
                    currentColor = Color.Red;
                else currentColor = Color.Green;

                canvas.DrawRect(destRect, currentColor);
            }
        }
Example #8
0
 public GraphicElements(Canvas workSpace)
 {
     WorkSpace = workSpace;
 }