コード例 #1
0
ファイル: Disp_Raster.cs プロジェクト: erin100280/Emunator
 protected virtual void InitDisp_Raster()
 {
     SdlDotNet.Graphics.Video.Initialize();
     //Sdl.SDL_Init(
     _frontBuffer = new sdlSurfaceControl();
     //_frontBuffer.CanFocus = false;
     _frontBuffer.GotFocus += new EventHandler(_frontBuffer_GotFocus);
     _frontBuffer.BackColor = Color.Pink;
     if(video != null) _frontBuffer.Size = video.resolution;
     else _frontBuffer.Size = _defaultSize;
     _backBuffer = new sdlSurface(_frontBuffer.Size);
     Controls.Add(_frontBuffer);
     Refresh();
 }
コード例 #2
0
ファイル: Disp_Raster.cs プロジェクト: erin100280/Emunator
        public override void Refresh()
        {
            base.Refresh();
            if(video != null && _frontBuffer != null) {
                sdlSurface bb = _backBuffer;
                sdlSurfaceControl fb = _frontBuffer;
                Size res = video.resolution;
                Size sz = res;

                if(bb.Size != res) {
                    bb.Dispose();
                    bb = _backBuffer = new sdlSurface(res);
                }

                switch(_displayMode) {
                    #region displaySizeMode.original
                    case displaySizeMode.original:
                        break;
                    #endregion
                    #region displaySizeMode.stretch
                    case displaySizeMode.times:
                        if(_displayArg < 1) _displayArg = 1;
                        sz = new Size(
                            res.Width * _displayArg
                        ,	res.Height * _displayArg
                        );
                        break;
                    #endregion
                    #region default
                    default:
                        break;
                    #endregion
                }

                if(fb.InvokeRequired) {
                    Size sz2 = (Size)this.Invoke(fb.GetSize);

                    object objs = new object[]{ sz };
                    this.Invoke(fb.SetMaximumSize, sz);
                    this.Invoke(fb.SetMinimumSize, sz);
                    this.Invoke(fb.SetSize, sz);

                    this.Invoke(fb.SetLocation
                    ,	new Point(
                            ((ClientSize.Width / 2) - (sz2.Width / 2))
                        ,	((ClientSize.Height / 2) - (sz2.Height / 2))
                        )
                );
                    //sg.Box("pow!");
                }
                else {
                    fb.Size = fb.MaximumSize = fb.MinimumSize = sz;
                    fb.Location = new Point(
                        ((ClientSize.Width / 2) - (fb.Width / 2))
                    ,	((ClientSize.Height / 2) - (fb.Height / 2))
                    );
                }
            }
        }