Exemplo n.º 1
0
        override public void paint(SdlDotNet.Graphics.Surface surface, bool focused, Point offset)
        {
            Caption.SizeWithIcon = false;

            Point dest = new Point((Width - Caption.Width) / 2 + offset.X,
                                   (Height - Caption.Height) / 2 + offset.Y);

            Rectangle rect = new Rectangle(offset, Dimensions);

            surface.Fill(rect, DisplaySettings.atomForeground);
            rect.Width  -= Compound.BorderPadding.Width * 2;
            rect.Height -= Compound.BorderPadding.Height * 2;
            rect.X      += Compound.BorderPadding.Width;
            rect.Y      += Compound.BorderPadding.Height;
            surface.Fill(rect, pressed ? DisplaySettings.atomBackgroundDimmed : DisplaySettings.atomBackground);
            rect.Width  -= Compound.BorderPadding.Width * 2;
            rect.Height -= Compound.BorderPadding.Height * 2;
            rect.X      += Compound.BorderPadding.Width;
            rect.Y      += Compound.BorderPadding.Height;

            Rectangle oldClipper = surface.ClipRectangle;

            surface.ClipRectangle = rect;

            Caption.Blit(surface, dest);

            surface.ClipRectangle = oldClipper;
        }
Exemplo n.º 2
0
        //protected override void DrawBuffer() {
        //    base.DrawBuffer();
        //    if (Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map != null && Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map.Loaded) {
        //        //Graphics.Renderers.Screen.ScreenRenderer.RenderScreen(base.Buffer, this.Location);
        //        //gl.DrawScreen(base.Buffer, activeMap, mapAnim, this.cameraX, this.cameraX2, this.cameraY, this.cameraY2, displayAttributes, displayMapGrid, displayLocation, overlay);
        //        Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderScreen(destData);
        //    }
        //    if (font != null) {
        //        //if (IO.Settings.DisplayCursorLocation) {
        //        //    fpsY += 27;
        //        //    DrawText("X: " + (Globals.CursorX + 1).ToString() + " Y: " + (Globals.CursorY + 1).ToString(), Color.Red, 5, 0);
        //        //}
        //        //if (IO.Settings.DisplayFPS) {
        //        //    DrawText("FPS: " + SdlDotNet.Core.Events.Fps.ToString(), Color.Red, 5, fpsY);
        //        //}
        //    }
        //    base.DrawBorder();
        //    base.DrawComplete();
        //}

        public SdlDotNet.Graphics.Surface CaptureMapImage(bool captureVisibleArea, bool captureAttributes, bool captureMapGrid)
        {
            int cameraX;
            int cameraX2;
            int cameraY;
            int cameraY2;

            if (captureVisibleArea)
            {
                cameraX  = ScreenRenderer.Camera.X;
                cameraX2 = ScreenRenderer.Camera.X2;
                cameraY  = ScreenRenderer.Camera.Y;
                cameraY2 = ScreenRenderer.Camera.Y2;
            }
            else
            {
                cameraX  = 0;
                cameraX2 = Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map.MaxX;
                cameraY  = 0;
                cameraY2 = Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map.MaxY;
            }
            SdlDotNet.Graphics.Surface screenshotSurf = new SdlDotNet.Graphics.Surface((cameraX2 - cameraX) * Constants.TILE_WIDTH, (cameraY2 - cameraY) * Constants.TILE_HEIGHT);
            screenshotSurf.Fill(Color.White);
            Client.Logic.Graphics.Renderers.Maps.MapRenderer.DrawTiles(new Logic.Graphics.Renderers.RendererDestinationData(screenshotSurf, new Point(0, 0), screenshotSurf.Size), Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map, Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayAnimation, cameraX, cameraX2, cameraY, cameraY2, captureAttributes, captureMapGrid);
            return(screenshotSurf);
        }
Exemplo n.º 3
0
 void lblAllMoves_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuMoveSelected") == null)
     {
         Label label = (Label)sender;
         SdlDotNet.Graphics.Surface dragSurf = new SdlDotNet.Graphics.Surface(label.Buffer.Size);
         dragSurf.Fill(Color.Black);
         dragSurf.Blit(label.Buffer, new Point(0, 0));
         label.DoDragDrop(Array.IndexOf(lblAllMoves, sender), DragDropEffects.Copy, dragSurf);
     }
 }
Exemplo n.º 4
0
        public SdlDotNet.Graphics.Surface RenderPassword(char passwordChar)
        {
            int charWidth = mFont.SizeText(passwordChar.ToString()).Width;

            SdlDotNet.Graphics.Surface tempSurf = new SdlDotNet.Graphics.Surface(mMaxWidth, mFont.Height);
            tempSurf.Fill(Color.Transparent);
            tempSurf.TransparentColor = Color.Transparent;
            tempSurf.Transparent      = true;
            int lastX = 0;

            for (int i = 0; i < mChars.Count; i++)
            {
                if (mChars[i].Char != "\n")
                {
                    if (mChars[i].CharOptions != null)
                    {
                        mFont.Bold      = mChars[i].CharOptions.Bold;
                        mFont.Italic    = mChars[i].CharOptions.Italic;
                        mFont.Underline = mChars[i].CharOptions.Underline;
                    }
                    Color bltColor;
                    if (mChars[i].CharColor == Color.Empty)
                    {
                        bltColor = mDefaultForeColor;
                    }
                    else
                    {
                        bltColor = mChars[i].CharColor;
                    }
                    SdlDotNet.Graphics.Surface charSurf = mFont.Render(passwordChar.ToString(), bltColor, false);
                    tempSurf.Blit(charSurf, new Point(lastX, 0));
                    charSurf.Close();
                    if (mFont.Bold == true)
                    {
                        mFont.Bold = false;
                    }
                    if (mFont.Italic == true)
                    {
                        mFont.Italic = false;
                    }
                    if (mFont.Underline == true)
                    {
                        mFont.Underline = false;
                    }
                    lastX += charWidth;
                }
            }

            return(tempSurf);
        }
Exemplo n.º 5
0
 void lblVisibleItems_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (mode == Enums.InvMenuType.Use)
     {
         if (Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuItemSelected") == null)
         {
             Label label = (Label)sender;
             SdlDotNet.Graphics.Surface dragSurf = new SdlDotNet.Graphics.Surface(label.Buffer.Size);
             dragSurf.Fill(Color.Black);
             dragSurf.Blit(label.Buffer, new Point(0, 0));
             label.DoDragDrop(Array.IndexOf(lblVisibleItems, sender) + 1 + (currentTen * 10), DragDropEffects.Copy, dragSurf);
         }
     }
 }
Exemplo n.º 6
0
        private void AddBorder()
        {
            Size newSize = this.Size;

            switch (mWindowState)
            {
            case WindowManager.WindowState.Normal:
                newSize = this.Size;
                break;

            case WindowManager.WindowState.Maximized:
                newSize = new Size(SdlDotNet.Graphics.Video.Screen.Width, SdlDotNet.Graphics.Video.Screen.Height - Globals.GameScreen.TaskBar.Height);
                break;

            case WindowManager.WindowState.Minimized:
                return;
            }
            mBorderBuffer = new SdlDotNet.Graphics.Surface(AddBorderSize(newSize));
            mBorderBuffer.AlphaBlending = true;
            mBorderBuffer.Alpha         = mBorderAlpha;
            mTitleBarBounds             = new Rectangle(0, 0, newSize.Width + 2, 20);
            mTitleBarSurface            = new SdlDotNet.Graphics.Surface(mTitleBarBounds.Size);
            mTitleBarSurface.Fill(Color.Blue);
            if (mText != "")
            {
                mTitleBarSurface.Blit(Logic.Graphics.FontManager.TextBoxFont.Render(mText, Color.Black, false), new Point(20, 3));
            }
            mCloseButtonBounds = new Rectangle(new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width, 0), mCloseButtonSurf.Size);
            if (mCloseable)
            {
                mTitleBarSurface.Blit(mCloseButtonSurf, new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width, 0));
            }
            mMaximizeButtonBounds = new Rectangle(new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMaximizeButtonSurf.Width, 0), mMaximizeButtonSurf.Size);
            if (mMaximizable)
            {
                mTitleBarSurface.Blit(mMaximizeButtonSurf, new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMaximizeButtonSurf.Width, 0));
            }
            mMinimizeButtonBounds = new Rectangle(new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMinimizeButtonSurf.Width - mMinimizeButtonSurf.Width, 0), mMinimizeButtonSurf.Size);
            if (mMinimizable)
            {
                mTitleBarSurface.Blit(mMinimizeButtonSurf, new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMinimizeButtonSurf.Width - mMinimizeButtonSurf.Width, 0));
            }
            mBorderBuffer.Blit(mTitleBarSurface, mTitleBarBounds.Location);
        }
Exemplo n.º 7
0
        private void InitBuffer()
        {
            Size newSize = this.Size;

            switch (mWindowState)
            {
            case WindowManager.WindowState.Normal:
                newSize = this.Size;
                break;

            case WindowManager.WindowState.Maximized:
                newSize = new Size(SdlDotNet.Graphics.Video.Screen.Width, SdlDotNet.Graphics.Video.Screen.Height - Globals.GameScreen.TaskBar.Height);
                break;

            case WindowManager.WindowState.Minimized:
                return;
            }
            if (mBuffer != null)
            {
                mBuffer.Close();
                mBuffer.Dispose();
            }
            mBuffer = new SdlDotNet.Graphics.Surface(AddBorderSize(newSize));
            mBuffer.AlphaBlending = true;
            mBuffer.Alpha         = mControlsAlpha;
            mBuffer.Fill(SystemColors.Control);
            if (mWindowed)
            {
                AddBorder();
            }
            else
            {
                mCloseable   = false;
                mMinimizable = false;
                mMaximizable = false;
            }
        }
Exemplo n.º 8
0
 void lblAllMoves_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuMoveSelected") == null) {
         Label label = (Label)sender;
         SdlDotNet.Graphics.Surface dragSurf = new SdlDotNet.Graphics.Surface(label.Buffer.Size);
         dragSurf.Fill(Color.Black);
         dragSurf.Blit(label.Buffer, new Point(0, 0));
         label.DoDragDrop(Array.IndexOf(lblAllMoves, sender), DragDropEffects.Copy, dragSurf);
     }
 }
Exemplo n.º 9
0
 private void InitBuffer()
 {
     Size newSize = this.Size;
     switch (mWindowState) {
         case WindowManager.WindowState.Normal:
             newSize = this.Size;
             break;
         case WindowManager.WindowState.Maximized:
             newSize = new Size(SdlDotNet.Graphics.Video.Screen.Width, SdlDotNet.Graphics.Video.Screen.Height - Globals.GameScreen.TaskBar.Height);
             break;
         case WindowManager.WindowState.Minimized:
             return;
     }
     if (mBuffer != null) {
         mBuffer.Close();
         mBuffer.Dispose();
     }
     mBuffer = new SdlDotNet.Graphics.Surface(AddBorderSize(newSize));
     mBuffer.AlphaBlending = true;
     mBuffer.Alpha = mControlsAlpha;
     mBuffer.Fill(SystemColors.Control);
     if (mWindowed) {
         AddBorder();
     } else {
         mCloseable = false;
         mMinimizable = false;
         mMaximizable = false;
     }
 }
Exemplo n.º 10
0
 private void AddBorder()
 {
     Size newSize = this.Size;
     switch (mWindowState) {
         case WindowManager.WindowState.Normal:
             newSize = this.Size;
             break;
         case WindowManager.WindowState.Maximized:
             newSize = new Size(SdlDotNet.Graphics.Video.Screen.Width, SdlDotNet.Graphics.Video.Screen.Height - Globals.GameScreen.TaskBar.Height);
             break;
         case WindowManager.WindowState.Minimized:
             return;
     }
     mBorderBuffer = new SdlDotNet.Graphics.Surface(AddBorderSize(newSize));
     mBorderBuffer.AlphaBlending = true;
     mBorderBuffer.Alpha = mBorderAlpha;
     mTitleBarBounds = new Rectangle(0, 0, newSize.Width + 2, 20);
     mTitleBarSurface = new SdlDotNet.Graphics.Surface(mTitleBarBounds.Size);
     mTitleBarSurface.Fill(Color.Blue);
     if (mText != "") {
         mTitleBarSurface.Blit(Logic.Graphics.FontManager.TextBoxFont.Render(mText, Color.Black, false), new Point(20, 3));
     }
     mCloseButtonBounds = new Rectangle(new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width, 0), mCloseButtonSurf.Size);
     if (mCloseable) {
         mTitleBarSurface.Blit(mCloseButtonSurf, new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width, 0));
     }
     mMaximizeButtonBounds = new Rectangle(new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMaximizeButtonSurf.Width, 0), mMaximizeButtonSurf.Size);
     if (mMaximizable) {
         mTitleBarSurface.Blit(mMaximizeButtonSurf, new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMaximizeButtonSurf.Width, 0));
     }
     mMinimizeButtonBounds = new Rectangle(new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMinimizeButtonSurf.Width - mMinimizeButtonSurf.Width, 0), mMinimizeButtonSurf.Size);
     if (mMinimizable) {
         mTitleBarSurface.Blit(mMinimizeButtonSurf, new Point(mTitleBarSurface.Width - 3 - mCloseButtonSurf.Width - mMinimizeButtonSurf.Width - mMinimizeButtonSurf.Width, 0));
     }
     mBorderBuffer.Blit(mTitleBarSurface, mTitleBarBounds.Location);
 }
Exemplo n.º 11
0
        public SdlDotNet.Graphics.Surface RenderPassword(char passwordChar)
        {
            int charWidth = mFont.SizeText(passwordChar.ToString()).Width;
            SdlDotNet.Graphics.Surface tempSurf = new SdlDotNet.Graphics.Surface(mMaxWidth, mFont.Height);
            tempSurf.Fill(Color.Transparent);
            tempSurf.TransparentColor = Color.Transparent;
            tempSurf.Transparent = true;
            int lastX = 0;
            for (int i = 0; i < mChars.Count; i++) {
                if (mChars[i].Char != "\n") {
                    if (mChars[i].CharOptions != null) {
                        mFont.Bold = mChars[i].CharOptions.Bold;
                        mFont.Italic = mChars[i].CharOptions.Italic;
                        mFont.Underline = mChars[i].CharOptions.Underline;
                    }
                    Color bltColor;
                    if (mChars[i].CharColor == Color.Empty)
                        bltColor = mDefaultForeColor;
                    else
                        bltColor = mChars[i].CharColor;
                    SdlDotNet.Graphics.Surface charSurf = mFont.Render(passwordChar.ToString(), bltColor, false);
                    tempSurf.Blit(charSurf, new Point(lastX, 0));
                    charSurf.Close();
                    if (mFont.Bold == true) {
                        mFont.Bold = false;
                    }
                    if (mFont.Italic == true) {
                        mFont.Italic = false;
                    }
                    if (mFont.Underline == true) {
                        mFont.Underline = false;
                    }
                    lastX += charWidth;
                }
            }

            return tempSurf;
        }
Exemplo n.º 12
0
 void lblVisibleItems_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (mode == Enums.InvMenuType.Use) {
         if (Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuItemSelected") == null) {
             Label label = (Label)sender;
             SdlDotNet.Graphics.Surface dragSurf = new SdlDotNet.Graphics.Surface(label.Buffer.Size);
             dragSurf.Fill(Color.Black);
             dragSurf.Blit(label.Buffer, new Point(0, 0));
             label.DoDragDrop(Array.IndexOf(lblVisibleItems, sender) + 1 + (currentTen * 10), DragDropEffects.Copy, dragSurf);
         }
     }
 }
Exemplo n.º 13
0
 //protected override void DrawBuffer() {
 //    base.DrawBuffer();
 //    if (Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map != null && Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map.Loaded) {
 //        //Graphics.Renderers.Screen.ScreenRenderer.RenderScreen(base.Buffer, this.Location);
 //        //gl.DrawScreen(base.Buffer, activeMap, mapAnim, this.cameraX, this.cameraX2, this.cameraY, this.cameraY2, displayAttributes, displayMapGrid, displayLocation, overlay);
 //        Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderScreen(destData);
 //    }
 //    if (font != null) {
 //        //if (IO.Settings.DisplayCursorLocation) {
 //        //    fpsY += 27;
 //        //    DrawText("X: " + (Globals.CursorX + 1).ToString() + " Y: " + (Globals.CursorY + 1).ToString(), Color.Red, 5, 0);
 //        //}
 //        //if (IO.Settings.DisplayFPS) {
 //        //    DrawText("FPS: " + SdlDotNet.Core.Events.Fps.ToString(), Color.Red, 5, fpsY);
 //        //}
 //    }
 //    base.DrawBorder();
 //    base.DrawComplete();
 //}
 public SdlDotNet.Graphics.Surface CaptureMapImage(bool captureVisibleArea, bool captureAttributes, bool captureMapGrid)
 {
     int cameraX;
     int cameraX2;
     int cameraY;
     int cameraY2;
     if (captureVisibleArea) {
         cameraX = ScreenRenderer.Camera.X;
         cameraX2 = ScreenRenderer.Camera.X2;
         cameraY = ScreenRenderer.Camera.Y;
         cameraY2 = ScreenRenderer.Camera.Y2;
     } else {
         cameraX = 0;
         cameraX2 = Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map.MaxX;
         cameraY = 0;
         cameraY2 = Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map.MaxY;
     }
     SdlDotNet.Graphics.Surface screenshotSurf = new SdlDotNet.Graphics.Surface((cameraX2 - cameraX) * Constants.TILE_WIDTH, (cameraY2 - cameraY) * Constants.TILE_HEIGHT);
     screenshotSurf.Fill(Color.White);
     Client.Logic.Graphics.Renderers.Maps.MapRenderer.DrawTiles(new Logic.Graphics.Renderers.RendererDestinationData(screenshotSurf, new Point(0, 0), screenshotSurf.Size), Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.Map, Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayAnimation, cameraX, cameraX2, cameraY, cameraY2, captureAttributes, captureMapGrid);
     return screenshotSurf;
 }