//refresh handler private void canvas_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; int width = canvas.Width; int height = canvas.Height; canvasWidth = canvas.Width; canvasHeight = canvas.Height; renderer.DrawScreen(width, height, g); if (!inPauseMenu && !inLossScreen) { physicsCycle += 0.01F; if (physicsCycle >= (FPS / 20F) / 100) { physicsEngine.SimulatePhysics(); physicsCycle = 0.0F; } } if (!CombatSystem.canAttack && attackSpeedLimit != -1) { StartAttackLimitTimer(attackSpeedLimit); attackSpeedLimit = -1; } }