private void DrawSliderBody(BMAPI.v1.HitObjects.SliderObject hitObject, float alpha, int radius, int zindex, byte reverseArrowType) { float smallLength = hitObject.TotalLength; Color color = Color.White; float depthHigh = (zindex * 3 + 2) / 1000.0f; float depthMed = (zindex * 3 + 1) / 1000.0f; float depthLow = (zindex * 3) / 1000.0f; byte alphaByte = (byte)(255 * alpha); for (float i = 0; i < smallLength + 10; i += 10) { if (i > smallLength) { i = smallLength; } // TODO: flip when hardrock Vector2 pos = hitObject.PositionAtTime(i / smallLength); int diameter = this.circleDiameter; color.A = alphaByte; this.sliderEdgeTexture.Draw(pos, diameter, diameter, new Vector2(0.5f * diameter), color); //this.spriteBatch.Draw(this.sliderEdgeTexture, rect, null, color, 0f, Vector2.Zero, SpriteEffects.None, 0.4f + depthHigh); color.A = 255; //this.spriteBatch.Draw(this.sliderBodyTexture, rect, null, color, 0f, Vector2.Zero, SpriteEffects.None, 0.4f + depthMed); this.sliderBodyTexture.Draw(pos, diameter, diameter, new Vector2(0.5f * diameter), color); if (i == smallLength) { break; } } if (reverseArrowType != 0) { /* * color.A = alphaByte; * Rectangle mode; * float rotation; * if (reverseArrowType == 1) * { * mode = lastRect; * rotation = (float)Math.Atan2(lastRectDiff.Y - lastRect.Y, lastRectDiff.X - lastRect.X); * } * else * { * rotation = (float)Math.Atan2(firstRectDiff.Y - firstRect.Y, firstRectDiff.X - firstRect.X); * mode = firstRect; * } * mode.X += 52; * mode.Y += 52; * this.spriteBatch.Draw(this.reverseArrowTexture, mode, null, color, rotation, new Vector2(64.0f), SpriteEffects.None, 0.4f + depthLow); */ } }
private void DrawSliderBody(BMAPI.v1.HitObjects.SliderObject hitObject, float alpha, int radius, int zindex) { float smallLength = hitObject.TotalLength; Color color = Color.White; for (float i = 0; i < smallLength + 10; i += 10) { if (i > smallLength) { i = smallLength; } // TODO: flip when hardrock Vector2 pos = hitObject.PositionAtTime(i / smallLength); int diameter = this.circleDiameter; color.A = (byte)(255 * alpha); this.sliderEdgeTexture.Draw(pos, diameter, diameter, new Vector2(diameter * 0.5f), color); if (i == smallLength) { break; } } color.A = 255; for (float i = 0; i < smallLength + 10; i += 10) { if (i > smallLength) { i = smallLength; } // TODO: flip when hardrock Vector2 pos = hitObject.PositionAtTime(i / smallLength); int diameter = this.circleDiameter; this.sliderBodyTexture.Draw(pos, diameter, diameter, new Vector2(diameter * 0.5f), color); if (i == smallLength) { break; } } }
private void DrawSlider(BMAPI.v1.HitObjects.SliderObject hitObject, float alpha, float approachCircleValue, bool isBackground) { float time = (float)(this.songPlayer.SongTime - hitObject.StartTime) / (float)((hitObject.SegmentEndTime - hitObject.StartTime) * hitObject.RepeatCount); byte reverseArrowType = (hitObject.RepeatCount > 1) ? (byte)1 : (byte)0; if (time < 0) { if (isBackground) { this.DrawSliderBody(hitObject, alpha, this.circleDiameter / 2, reverseArrowType); this.DrawHitcircle(hitObject, alpha); } else { this.DrawApproachCircle(hitObject, alpha, approachCircleValue); } return; } else if (time > 1) { time = 1; } time *= hitObject.RepeatCount; if (time > 1) { bool drawArrow = time - (hitObject.RepeatCount - 1) < 0; int order = 0; while (time > 1) { time -= 1; order++; reverseArrowType = drawArrow ? (byte)1 : (byte)0; } if (order % 2 != 0) { time = 1 - time; reverseArrowType = drawArrow ? (byte)2 : (byte)0; } } if (isBackground) { this.DrawSliderBody(hitObject, alpha, this.circleDiameter / 2, reverseArrowType); } else { Vector2 pos = hitObject.PositionAtTime(time); float diameter = this.circleDiameter * 2.0f; this.sliderFollowCircleTexture.Draw(pos, diameter, diameter, new Vector2(0.5f * diameter), new Color(1.0f, 1.0f, 1.0f, alpha)); } }
private void DrawSlider(BMAPI.v1.HitObjects.SliderObject hitObject, float alpha, int zindex, float approachCircleValue) { float time = (float)(this.songPlayer.SongTime - hitObject.StartTime) / (float)((hitObject.SegmentEndTime - hitObject.StartTime) * hitObject.RepeatCount); byte reverseArrowType = (hitObject.RepeatCount > 1) ? (byte)1 : (byte)0; if (time < 0) { this.DrawHitcircle(hitObject, alpha, zindex); this.DrawApproachCircle(hitObject, alpha, approachCircleValue); this.DrawSliderBody(hitObject, alpha, this.circleDiameter / 2, zindex, reverseArrowType); return; } else if (time > 1) { time = 1; } time *= hitObject.RepeatCount; if (time > 1) { bool drawArrow = time - (hitObject.RepeatCount - 1) < 0; int order = 0; while (time > 1) { time -= 1; order++; reverseArrowType = drawArrow ? (byte)1 : (byte)0; } if (order % 2 != 0) { time = 1 - time; reverseArrowType = drawArrow ? (byte)2 : (byte)0; } } this.DrawSliderBody(hitObject, alpha, this.circleDiameter / 2, zindex, reverseArrowType); Vector2 pos = this.InflateVector(hitObject.PositionAtTime(time), true); // 128x128 is the size of the sprite image for hitcircles int diameter = (int)(this.circleDiameter / 128f * this.sliderFollowCircleTexture.Width * this.Size.X / 512f); Rectangle rect = new Rectangle((int)pos.X, (int)pos.Y, diameter, diameter); rect.X -= rect.Width / 2; rect.Y -= rect.Height / 2; this.spriteBatch.Draw(this.sliderFollowCircleTexture, rect, null, new Color(1.0f, 1.0f, 1.0f, alpha), 0f, Vector2.Zero, SpriteEffects.None, 0f); }
private void DrawSliderBody(BMAPI.v1.HitObjects.SliderObject hitObject, float alpha, int radius, int zindex, byte reverseArrowType) { float smallLength = hitObject.TotalLength; Color color = Color.White; float depthHigh = (zindex * 3 + 2) / 1000.0f; float depthMed = (zindex * 3 + 1) / 1000.0f; float depthLow = (zindex * 3) / 1000.0f; byte alphaByte = (byte)(255 * alpha); Rectangle firstRect = new Rectangle(-222, -222, 222, 222); Rectangle lastRect = new Rectangle(-222, -222, 222, 222); Rectangle firstRectDiff = new Rectangle(-222, -222, 222, 222); Rectangle lastRectDiff = new Rectangle(-222, -222, 222, 222); for (float i = 0; i < smallLength + 10; i += 10) { if (i > smallLength) { i = smallLength; } Vector2 pos = this.InflateVector(hitObject.PositionAtTime(i / smallLength), true); int diameter = (int)(this.circleDiameter * this.Size.X / 512f); Rectangle rect = new Rectangle((int)pos.X, (int)pos.Y, diameter, diameter); rect.X -= rect.Width / 2; rect.Y -= rect.Height / 2; if (firstRect.X == -222) { firstRect = rect; } else if (firstRectDiff.X == -222) { firstRectDiff = rect; } lastRectDiff = lastRect; lastRect = rect; color.A = alphaByte; this.spriteBatch.Draw(this.sliderEdgeTexture, rect, null, color, 0f, Vector2.Zero, SpriteEffects.None, 0.4f + depthHigh); color.A = 255; this.spriteBatch.Draw(this.sliderBodyTexture, rect, null, color, 0f, Vector2.Zero, SpriteEffects.None, 0.4f + depthMed); if (i == smallLength) { break; } } if (reverseArrowType != 0) { color.A = alphaByte; Rectangle mode; float rotation; if (reverseArrowType == 1) { mode = lastRect; rotation = (float)Math.Atan2(lastRectDiff.Y - lastRect.Y, lastRectDiff.X - lastRect.X); } else { rotation = (float)Math.Atan2(firstRectDiff.Y - firstRect.Y, firstRectDiff.X - firstRect.X); mode = firstRect; } mode.X += 52; mode.Y += 52; this.spriteBatch.Draw(this.reverseArrowTexture, mode, null, color, rotation, new Vector2(64.0f), SpriteEffects.None, 0.4f + depthLow); } }