beezdul 56 Posted March 4, 2016 ​​​​I'm aware that the code is pretty ugly, but you can always change it if you want.​​Global: Point[] lastPositions = new Point[15]; ​Put this in onStart() getClient().getInstance().setDrawMouse(false); ​Put this in onPaint(Graphics2D g) Point currentPosition = getMouse().getPosition(); // Shift all elements down and insert the new element for(int i=0;i<lastPositions.length - 1;i++){ lastPositions[i]=lastPositions[i+1]; } lastPositions[lastPositions.length - 1] = new Point(currentPosition.x, currentPosition.y); // This is the point before the new point to draw to Point lastpoint = null; Color mColor = new Color(255, 50, 50); //Go in reverse for(int i=lastPositions.length - 1;i>=0;i--) { Point p = lastPositions[i]; if(p != null) { if(lastpoint == null) lastpoint = p; g.setColor(mColor); g.drawLine(lastpoint.x, lastpoint.y, p.x, p.y); } lastpoint = p; //Every 2 steps - mouse fade out if(i % 2 == 0) mColor = mColor.darker(); } g.setColor(Color.BLACK); g.drawRect(currentPosition.x - 3, currentPosition.y - 3, 7, 7); g.setColor(Color.WHITE); g.drawRect(currentPosition.x, currentPosition.y, 1, 1); Make sure to add this to onExit()! getClient().getInstance().setDrawMouse(true); ​​
Recommended Posts
Archived
This topic is now archived and is closed to further replies.