Ejemplo n.º 1
0
        private void DrawCursor(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            cursorArea.Height = System.Math.Max(20, mBackground.Height - System.Math.Max(20, max / 4));
            cursorArea.Width  = 12;

            cursorPos.X = this.ScreenLocation.X;
            if (!isScrolling)
            {
                if (!inverted)
                {
                    cursorPos.Y = (this.ScreenLocation.Y + buttonHeight) + (Height - 21 - cursorArea.Height) + ((value * 100) / max);
                }
                else
                {
                    cursorPos.Y = (this.ScreenLocation.Y + buttonHeight) + (Height - 21 - cursorArea.Height) * ((max - value) / max);
                }
            }

            cursorArea.X = (int)(cursorPos.X + this.ScreenLocation.X);
            cursorArea.Y = (int)(cursorPos.Y + this.ScreenLocation.Y);

            cursorSurf = new SdlDotNet.Graphics.Surface(cursorArea.Size);
            cursorSurf.Fill(Color.Gray);

            dstSrf.Blit(cursorSurf, cursorPos);
            //spriteBatch.Draw(cursorTex, cursorPos, cursorLeft, BackColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);

            //cursorMidDest.X = (int)cursorPos.X + 3;
            //cursorMidDest.Y = (int)cursorPos.Y;
            //cursorMidDest.Width = cursorArea.Width - 6;
            //spriteBatch.Draw(cursorTex, cursorMidDest, cursorMiddle, BackColor, 0f, Vector2.Zero, SpriteEffects.None, 0f);

            //spriteBatch.Draw(cursorTex, cursorPos + new Vector2(cursorMidDest.Width, 0f), cursorRight, BackColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
        }
Ejemplo n.º 2
0
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SdlDotNet.Core.TickEventArgs"/> instance containing the event data.</param>
        public override void Tick(object sender, SdlDotNet.Core.TickEventArgs e)
        {
            base.Tick(sender, e);

            Gl.glViewport(0, 0, BackbufferWidth, BackbufferHeight);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluOrtho2D(0, BackbufferWidth, BackbufferHeight, 0);

            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            // render the current game screen
            GameScreenManager.CurrentGameScreen.Render();

            // render the FPS
            VariableManager.SetVariable("FPS", e.Fps);
            // Video.Screen.Blit(FontManager.DrawText("fntMain", e.Fps.ToString(), Color.Yellow), new Point(100, 20));


            // render the mouse cursor
            cursor.Draw(MouseX - cursor.RealSize.Width / 2, MouseY - cursor.RealSize.Height / 2);

            Gl.glFlush();

            Video.GLSwapBuffers();
        }
Ejemplo n.º 3
0
        public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            DrawBackground(dstSrf, e);
            DrawCursor(dstSrf, e);

            base.Update(dstSrf, e);
        }
Ejemplo n.º 4
0
        void winGame_Tick(object sender, SdlDotNet.Core.TickEventArgs e)
        {
            if (Globals.InGame)
            {
                if (IO.Options.AutoSaveSpeed > 0)
                {
                    if (e.Tick > lastSaveTick + (100 * 60000 / IO.Options.AutoSaveSpeed))
                    {
                        Messenger.SendPacket(PMDCP.Sockets.TcpPacket.CreatePacket("checkcommands", "/save"));
                        lastSaveTick = e.Tick;
                    }
                }
                if (IO.Options.Ping)
                {
                    if (e.Tick > tickSinceLastPing + 1000 && !MessageProcessor.PingStopwatch.IsRunning)
                    {
                        MessageProcessor.PingStopwatch.Reset();
                        MessageProcessor.PingStopwatch.Start();
                        Messenger.SendPacket(PMDCP.Sockets.TcpPacket.CreatePacket("ping"));
                        tickSinceLastPing = e.Tick;
                    }
                }

                if (Players.PlayerManager.MyPlayer.MovementPacketCache != null)
                {
                    if (Globals.Tick > Players.PlayerManager.MyPlayer.LastMovementCacheSend + Constants.MovementClusteringFrquency && Players.PlayerManager.MyPlayer.MovementPacketCache.Packets.Count > 0)
                    {
                        NetworkManager.SendData(Players.PlayerManager.MyPlayer.MovementPacketCache);
                        Players.PlayerManager.MyPlayer.MovementPacketCache   = new PacketList();
                        Players.PlayerManager.MyPlayer.LastMovementCacheSend = Globals.Tick;
                    }
                }
            }
        }
Ejemplo n.º 5
0
 public static void Tick(SdlDotNet.Graphics.Surface screen, SdlDotNet.Core.TickEventArgs e)
 {
     for (int i = 0; i < mOpenWindows.Count; i++)
     {
         mOpenWindows[i].Tick(screen, e);
     }
 }
Ejemplo n.º 6
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     if (e.Tick > lastTick + 35)
     {
         mGameLoop.DrawScreen(mGameSurface, e);
         lastTick = e.Tick;
     }
     dstSrf.Blit(mGameSurface, this.Location);
 }
Ejemplo n.º 7
0
 public virtual void Tick(SdlDotNet.Graphics.Surface dstSurf, SdlDotNet.Core.TickEventArgs e)
 {
     if (!mIsDisposing)
     {
         if (mWindowState != WindowManager.WindowState.Minimized)
         {
             this.UpdateControls(dstSurf, e);
         }
     }
 }
Ejemplo n.º 8
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     //int addX = 0;
     //int addY = 0;
     //if (this.Parent != null) {
     //    //addX += this.Parent.Location.X;
     //    //addY += this.Parent.Location.Y;
     //}
     base.Update(dstSrf, e);
 }
Ejemplo n.º 9
0
 public override void OnTick(SdlDotNet.Core.TickEventArgs e)
 {
     base.OnTick(e);
     if (vScroll != null)
     {
         vScroll.OnTick(e);
     }
     if (hScroll != null)
     {
         hScroll.OnTick(e);
     }
 }
Ejemplo n.º 10
0
 public override void OnTick(SdlDotNet.Core.TickEventArgs e)
 {
     //rwLock.EnterUpgradeableReadLock();
     try {
         for (int i = 0; i < openMenus.Count; i++)
         {
             openMenus[i].MenuPanel.OnTick(e);
         }
     } finally {
         //rwLock.ExitUpgradeableReadLock();
     }
     base.OnTick(e);
 }
Ejemplo n.º 11
0
 public override void OnTick(SdlDotNet.Core.TickEventArgs e)
 {
     if (e.Tick > lastAnimTick + 250)
     {
         Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayAnimation = !Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayAnimation;
         lastAnimTick = e.Tick;
     }
     if (Globals.Tick > ((Client.Logic.Music.Bass.BassAudioPlayer)Music.Music.AudioPlayer).TimeOfNextSong &&
         ((Client.Logic.Music.Bass.BassAudioPlayer)Music.Music.AudioPlayer).TimeOfNextSong > 0)
     {
         ((Client.Logic.Music.Bass.BassAudioPlayer)Music.Music.AudioPlayer).PlayNextMusic();
     }
     base.OnTick(e);
     RequestRedraw();
 }
Ejemplo n.º 12
0
        public static bool CanUpdate(SdlDotNet.Core.TickEventArgs e)
        {
            float val = 1.0f / 1000 * e.TicksElapsed * Constants.FRAME_RATE;

            val += lastVal;
            if (val > 1)
            {
                lastVal = 0;
                return(true);
            }
            else
            {
                lastVal = val;
                return(false);
            }
        }
Ejemplo n.º 13
0
        public override void UpdateControls(SdlDotNet.Graphics.Surface dstSurf, SdlDotNet.Core.TickEventArgs e)
        {
            try {
                if (!mIsDisposing)
                {
//					mBuffer.Fill(SystemColors.Control);
                    base.UpdateControls(mBuffer, e);
                    if (mWindowed)
                    {
                        dstSurf.Blit(mBorderBuffer, mFullBounds.Location, new Rectangle(0, 0, this.FullBounds.Width, this.FullBounds.Height));
                    }
                    dstSurf.Blit(mBuffer, mControlBounds.Location, new Rectangle(0, 0, this.ControlBounds.Width, this.ControlBounds.Height));
                }
            } catch {
            }
        }
Ejemplo n.º 14
0
 public override void OnTick(SdlDotNet.Core.TickEventArgs e)
 {
     base.OnTick(e);
     if (activeModule != null)
     {
         if (activeModule.ModulePanel.Location.X != 0 || activeModule.ModulePanel.Location.Y != btnLeft.Height)
         {
             activeModule.ModulePanel.Location = new Point(0, btnLeft.Height);
         }
         if (activeModule.ModulePanel.Size.Width != this.Width || activeModule.ModulePanel.Size.Height != this.Height - btnLeft.Height)
         {
             activeModule.ModulePanel.Size = new Size(this.Width, this.Height - btnLeft.Height);
         }
         //activeModule.ModulePanel.BlitToScreen(destinationSurface);
     }
     //if (activeModule != null) {
     //    activeModule.ModulePanel.OnTick(e);
     //}
 }
Ejemplo n.º 15
0
        public static void SdlDotNet_Core_Events_Tick(object sender, SdlDotNet.Core.TickEventArgs e)
        {
            // Only redraw the window if it isn't minimized
            //if (SdlDotNet.Graphics.Video.IsActive) {
            try
            {
                if (Skins.SkinManager.ScreenBackground != null && Globals.InGame == false)
                {
                    SdlDotNet.Graphics.Video.Screen.Blit(Skins.SkinManager.ScreenBackground, new Point(0, 0));
                }
                else
                {
                    if (Skins.SkinManager.ActiveSkin.IngameBackground != null)
                    {
                        SdlDotNet.Graphics.Video.Screen.Blit(Skins.SkinManager.ActiveSkin.IngameBackground, new Point(0, 0));
                    }
                    else
                    {
                        SdlDotNet.Graphics.Video.Screen.Fill(Color.SteelBlue);
                    }
                }
            }
            catch
            {
                SdlDotNet.Graphics.Video.Screen.Fill(Color.SteelBlue);
            }

            //try {
            // Check if the FPS isn't something absurd
            //if (!(SdlDotNet.Core.Events.Fps < 10 || SdlDotNet.Core.Events.Fps > Constants.FRAME_RATE + 10)) {
            SdlDotNet.Widgets.WindowManager.DrawWindows(e);
            //} catch { }
            //}

            //if (Graphics.FontManager.GameFont != null) {
            //    SdlDotNet.Graphics.Video.Screen.Blit(Graphics.FontManager.GameFont.Render("FPS: " + SdlDotNet.Core.Events.Fps.ToString(), Color.Black), new Point(0, 0));
            //}

            SdlDotNet.Graphics.Video.Update();
            //} else {
            //    // Game window isn't active
            //}
        }
Ejemplo n.º 16
0
        public virtual void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            try {
                if (!mIsDisposing)
                {
//					Point totalAddLoc = GetTotalAddLocation(new Point(mBounds.X, mBounds.Y), this);
//					if (mScreenBounds.Location != totalAddLoc) {
//						mScreenBounds = new Rectangle(totalAddLoc, this.Size);
//					}
//					int addX = totalAddLoc.X;
//					int addY = totalAddLoc.Y;
                    if (mBuffer.Size != mBounds.Size)
                    {
                        ReinitBuffer();
                    }
                    dstSrf.Blit(mBuffer, this.Location);
                    UpdateControls(mBuffer, e);
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
Ejemplo n.º 17
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     if (SdlDotNet.Core.Timer.TicksElapsed > mLastLineBlit + 500)
     {
         mDoLineDraw   = !mDoLineDraw;
         mLastLineBlit = e.Tick;
     }
     //if (base.Focused) {
     //    if (mDoLineDraw) {
     //        //if (base.PointInBounds(new Point(((mCursorLocX * (mPrevLetterSize.Width)) + 4) + addX, (((mCursorLine * mLineSize.Height))) + addY)) && base.PointInBounds(new Point((mCursorLocX * (mPrevLetterSize.Width) + 4) + addX, (mCursorLine * mLineSize.Height + mLineSize.Height) + addY))) {
     //        Redraw();
     //        mLineCleared = false;
     //        //}
     //    } else {
     //        if (mLineCleared == false) {
     //            Redraw();
     //            mLineCleared = true;
     //        }
     //    }
     //}
     base.Update(dstSrf, e);
 }
Ejemplo n.º 18
0
 private void DrawBackground(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     mBackground.Fill(Color.White);
     dstSrf.Blit(mBackground, new Point(this.ScreenLocation.X, this.ScreenLocation.Y + buttonHeight));
 }
Ejemplo n.º 19
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     base.Update(dstSrf, e);
 }
Ejemplo n.º 20
0
        void Events_Tick(object sender, SdlDotNet.Core.TickEventArgs e)
        {
            m_surface.Fill(Color.Green);

            this.UpdateForm();
        }
Ejemplo n.º 21
0
        public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            dstSrf.Blit(mBackground, this.ScreenLocation);

            base.Update(dstSrf, e);
        }
Ejemplo n.º 22
0
        void SdlEvents_Tick(object sender, SdlDotNet.Core.TickEventArgs e)
        {
            //if (SdlDotNet.Graphics.Video.IsActive == false)
            //    return;
            //if (TickStabalizer.CanUpdate(e)) {
            //if (Gfx.GuiManager.ScreenBackground != null) {
            //    SdlVideo.Screen.Blit(Gfx.GuiManager.ScreenBackground);
            //} else {
            //    SdlVideo.Screen.Fill(Color.SteelBlue);
            //}

            // Version info
            //if (Globals.GameLoaded) {
            //    if (lblInfo != null) {
            //        if (SdlDotNet.Core.Timer.TicksElapsed > lastTick + 1000) {
            //            lblInfo.Text = "Version: PMDCP 7 [Alpha-Debug]\tFPS: " + e.Fps.ToString();
            //            lastTick = SdlDotNet.Core.Timer.TicksElapsed;
            //        }
            //        lblInfo.Update(SdlDotNet.Graphics.Video.Screen, e);
            //    }
            //}
            //if (Globals.InDebugMode && Globals.GameLoaded) {
            //    if (btnDebug != null) {
            //        btnDebug.Update(SdlDotNet.Graphics.Video.Screen, e);
            //    }
            //}

            //SdlDotNet.Widgets.WindowManager.DrawWindows(e);

            //if (Globals.GameLoaded) {
            //    tskTaskBar.Update(SdlVideo.Screen, e);
            //}
            if (isFading)
            {
                if (fadeOut)
                {
                    if (GraphicsManager.FadeSurface.Alpha < 255)
                    {
                        GraphicsManager.FadeSurface.Alpha += (byte)fadeSpeed;
                    }
                    else
                    {
                        isFading = false;
                        fadeCallback();
                    }
                }
                else
                {
                    if (GraphicsManager.FadeSurface.Alpha > 0)
                    {
                        GraphicsManager.FadeSurface.Alpha -= (byte)fadeSpeed;
                    }
                    else
                    {
                        isFading = false;
                        fadeCallback();
                    }
                }
                SdlDotNet.Graphics.Video.Screen.Blit(GraphicsManager.FadeSurface);
            }

            //    SdlVideo.Screen.Update();
            //}
        }
Ejemplo n.º 23
0
        public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            int addX = this.Location.X;
            int addY = this.Location.Y;

            if (this.Parent != null)
            {
                addX += this.Parent.Location.X;
                addY += this.Parent.Location.Y;
            }
            if (SdlDotNet.Input.Mouse.IsButtonPressed(SdlDotNet.Input.MouseButton.PrimaryButton) == false)
            {
                if (base.PointInBounds(SdlDotNet.Input.Mouse.MousePosition))
                {
                    if (this.Focused == false)
                    {
                        if (mBackgroundTexture.Alpha < 150)
                        {
                            mBackgroundTexture.Alpha += 30;
                            UpdateTexture();
                        }
                    }
                    else
                    {
                        if (mBackgroundTexture.Alpha < 150)
                        {
                            mBackgroundTexture.Alpha = 150;
                            UpdateTexture();
                        }
                    }
                }
                else
                {
                    if (this.Focused == false)
                    {
                        if (mBackgroundTexture.Alpha != 0)
                        {
                            mBackgroundTexture.Alpha = 0;
                            UpdateTexture();
                        }
                    }
                    else
                    {
                        if (mBackgroundTexture.Alpha < 150)
                        {
                            mBackgroundTexture.Alpha = 150;
                            UpdateTexture();
                        }
                    }
                }
            }
            else
            {
                if (mBackgroundTexture.Alpha != 0)
                {
                    mBackgroundTexture.Alpha = 0;
                    UpdateTexture();
                }
            }

            base.Buffer.Blit(mTexture, new Point(0, 0));
            base.Update(dstSrf, e);
        }