コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="spineAnimationItem"></param>
        /// <param name="title_path">The path of the spine animation to set as title</param>
        public SpineAnimationWindow(WzSpineAnimationItem spineAnimationItem, string title_path)
        {
            IsMouseVisible = true;

            //Window.IsBorderless = true;
            //Window.Position = new Point(0, 0);
            Window.Title          = title_path;
            IsFixedTimeStep       = false;       // dont cap fps
            Content.RootDirectory = "Content";

            // Res
            this.UserScreenScaleFactor = (float)ScreenDPIUtil.GetScreenScaleFactor();
            this.matrixScale           = Matrix.CreateScale(UserScreenScaleFactor);

            // Graphics
            graphicsDeviceMgr = new GraphicsDeviceManager(this)
            {
                SynchronizeWithVerticalRetrace = true,                 // max fps with the monitor
                HardwareModeSwitch             = true,
                GraphicsProfile             = GraphicsProfile.HiDef,
                IsFullScreen                = false,
                PreferMultiSampling         = true,
                SupportedOrientations       = DisplayOrientation.Default,
                PreferredBackBufferWidth    = (int)(1366 * UserScreenScaleFactor),               // XNA isnt DPI aware.
                PreferredBackBufferHeight   = (int)(768 * UserScreenScaleFactor),
                PreferredBackBufferFormat   = SurfaceFormat.Color /*RGBA8888*/ | SurfaceFormat.Bgr32 | SurfaceFormat.Dxt1 | SurfaceFormat.Dxt5,
                PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8,
            };
            graphicsDeviceMgr.ApplyChanges();

            this.wzSpineObject = new WzSpineObject(spineAnimationItem);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="selectedAnimationNodes"></param>
        public ImageAnimationPreviewWindow(List <WzNode> selectedAnimationNodes, string title_path)
        {
            this.selectedAnimationNodes = selectedAnimationNodes;

            IsMouseVisible = true;

            //Window.AllowUserResizing = true;
            //Window.IsBorderless = true;
            //Window.Position = new Point(0, 0);
            Window.Title          = title_path;
            IsFixedTimeStep       = false;       // dont cap fps
            Content.RootDirectory = "Content";

            // Res
            this.UserScreenScaleFactor   = (float)ScreenDPIUtil.GetScreenScaleFactor();
            this.renderAnimationScaling *= this.UserScreenScaleFactor;
            this.renderTextScaling      *= this.UserScreenScaleFactor;

            graphicsDeviceMgr = new GraphicsDeviceManager(this)
            {
                SynchronizeWithVerticalRetrace = true,
                HardwareModeSwitch             = true,
                GraphicsProfile             = GraphicsProfile.HiDef,
                IsFullScreen                = false,
                PreferMultiSampling         = true,
                SupportedOrientations       = DisplayOrientation.Default,
                PreferredBackBufferWidth    = (int)(RENDER_WIDTH * UserScreenScaleFactor),               // XNA isnt DPI aware.
                PreferredBackBufferHeight   = (int)(RENDER_HEIGHT * UserScreenScaleFactor),              // XNA isnt DPI aware.
                PreferredBackBufferFormat   = SurfaceFormat.Color,
                PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8,
            };
            graphicsDeviceMgr.ApplyChanges();
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double value_             = (double)value;
            double imageWidthOrHeight = value_ / ScreenDPIUtil.GetScreenScaleFactor();

            return(imageWidthOrHeight);
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double widthOrHeight = (double)value;
            double realWidthOrHeightToDisplay = widthOrHeight * ScreenDPIUtil.GetScreenScaleFactor();

            return(realWidthOrHeightToDisplay);
        }
コード例 #5
0
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Thickness value_ = (Thickness)value;

            // converted
            PointF originValue = new PointF((float)((value_.Left) * ScreenDPIUtil.GetScreenScaleFactor()), (float)((value_.Top + fCrossHairWidthHeight) * ScreenDPIUtil.GetScreenScaleFactor()));

            return(originValue);
        }
コード例 #6
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            PointF originValue = (PointF)value;

            // converted
            // its always -50, as it is 50px wide, as specified in the xaml
            Thickness margin = new Thickness((originValue.X) / ScreenDPIUtil.GetScreenScaleFactor(), (originValue.Y - fCrossHairWidthHeight) / ScreenDPIUtil.GetScreenScaleFactor(), 0, 0);             // 20,75


            return(margin);
        }
コード例 #7
0
        private void InitialiseWindowAndMap_WidthHeight()
        {
            this.RenderObjectScaling = 1.0f;
            switch (this.mapRenderResolution)
            {
            case RenderResolution.Res_1024x768:      // 1024x768
                Height = 768;
                Width  = 1024;
                break;

            case RenderResolution.Res_1280x720:     // 1280x720
                Height = 720;
                Width  = 1280;
                break;

            case RenderResolution.Res_1366x768:      // 1366x768
                Height = 768;
                Width  = 1366;
                break;


            case RenderResolution.Res_1920x1080:     // 1920x1080
                Height = 1080;
                Width  = 1920;
                break;

            case RenderResolution.Res_1920x1080_120PercScaled:     // 1920x1080
                Height = 1080;
                Width  = 1920;
                RenderObjectScaling = 1.2f;
                break;

            case RenderResolution.Res_1920x1080_150PercScaled:     // 1920x1080
                Height = 1080;
                Width  = 1920;
                RenderObjectScaling       = 1.5f;
                this.mapRenderResolution |= RenderResolution.Res_1366x768;     // 1920x1080 is just 1366x768 with 150% scale.
                break;


            case RenderResolution.Res_1920x1200:     // 1920x1200
                Height = 1200;
                Width  = 1920;
                break;

            case RenderResolution.Res_1920x1200_120PercScaled:     // 1920x1200
                Height = 1200;
                Width  = 1920;
                RenderObjectScaling = 1.2f;
                break;

            case RenderResolution.Res_1920x1200_150PercScaled:     // 1920x1200
                Height = 1200;
                Width  = 1920;
                RenderObjectScaling = 1.5f;
                break;

            case RenderResolution.Res_All:
            case RenderResolution.Res_800x600:     // 800x600
            default:
                Height = 600;
                Width  = 800;
                break;
            }
            this.UserScreenScaleFactor = (float)ScreenDPIUtil.GetScreenScaleFactor();

            this.RenderHeight        = (int)(Height * UserScreenScaleFactor);
            this.RenderWidth         = (int)(Width * UserScreenScaleFactor);
            this.RenderObjectScaling = (RenderObjectScaling * UserScreenScaleFactor);

            this.matrixScale = Matrix.CreateScale(RenderObjectScaling);
        }
コード例 #8
0
        public MapSimulator(Board mapBoard)
        {
            InitializeComponent();

            if (Program.InfoManager.BGMs.ContainsKey(mapBoard.MapInfo.bgm))
            {
                audio = new WzMp3Streamer(Program.InfoManager.BGMs[mapBoard.MapInfo.bgm], true);
            }

            mapCenter  = mapBoard.CenterPoint;
            minimapPos = new Point((int)Math.Round((mapBoard.MinimapPosition.X + mapCenter.X) / (double)mapBoard.mag), (int)Math.Round((mapBoard.MinimapPosition.Y + mapCenter.Y) / (double)mapBoard.mag));
            if (mapBoard.VRRectangle == null)
            {
                vr = new Rectangle(0, 0, mapBoard.MapSize.X, mapBoard.MapSize.Y);
            }
            else
            {
                vr = new Rectangle(mapBoard.VRRectangle.X + mapCenter.X, mapBoard.VRRectangle.Y + mapCenter.Y, mapBoard.VRRectangle.Width, mapBoard.VRRectangle.Height);
            }
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);


            switch (UserSettings.SimulateResolution)
            {
            case MapRenderResolution.Res_1024x768:      // 1024x768
                RenderHeight = 768;
                RenderWidth  = 1024;
                break;

            case MapRenderResolution.Res_1280x720:     // 1280x720
                RenderHeight = 720;
                RenderWidth  = 1280;
                break;

            case MapRenderResolution.Res_1366x768:      // 1366x768
                RenderHeight = 768;
                RenderWidth  = 1366;
                break;

            case MapRenderResolution.Res_1920x1080:
                RenderHeight = 1080;
                RenderWidth  = 1920;
                break;

            case MapRenderResolution.Res_800x600:     // 800x600
            default:
                RenderHeight = 600;
                RenderWidth  = 800;
                break;
            }
            double dpi = ScreenDPIUtil.GetScreenScaleFactor();

            // set Form window height & width
            this.Width  = (int)(RenderWidth * dpi);
            this.Height = (int)(RenderHeight * dpi);

#if FULLSCREEN
            pParams.BackBufferWidth    = Math.Max(Width, 1);
            pParams.BackBufferHeight   = Math.Max(Height, 1);
            pParams.BackBufferFormat   = SurfaceFormat.Color;
            pParams.IsFullScreen       = false;
            pParams.DepthStencilFormat = DepthFormat.Depth24;
#else
            pParams.BackBufferWidth    = Math.Max(RenderWidth, 1);
            pParams.BackBufferHeight   = Math.Max(RenderHeight, 1);
            pParams.BackBufferFormat   = SurfaceFormat.Color;
            pParams.DepthStencilFormat = DepthFormat.Depth24Stencil8;
            pParams.DeviceWindowHandle = Handle;
            pParams.IsFullScreen       = false;
#endif

            // default center
            mapShiftX = vr.Left;
            mapShiftY = vr.Top;


            DxDevice     = MultiBoard.CreateGraphicsDevice(pParams);
            this.minimap = BoardItem.TextureFromBitmap(DxDevice, mapBoard.MiniMap);
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1, 1);
            bmp.SetPixel(0, 0, System.Drawing.Color.White);
            pixel = BoardItem.TextureFromBitmap(DxDevice, bmp);

            sprite = new SpriteBatch(DxDevice);
        }