Jump to content

How to get an onPaint mouse cursor for weird noobs


Recommended Posts

Posted

Copy and paste this and put it AFTER your onLoop:

 

Spoiler

@Override

public void onPaint(Graphics2D g) {

 

// Get the mouse position on the screen

Point mouseScreenPosition = getMouse().getPosition();

 

// Draw the cursor body

drawCustomCursor(g, mouseScreenPosition);}

Then copy and paste this and also put it AFTER your onLoop

 

Spoiler

public void drawCustomCursor(Graphics2D g, Point mouseScreenPosition) {

int cursorSize = 20; // Adjust cursor size as needed

 

// Define the points for the custom cursor shape (star with spikes)

int[] xPoints = {

mouseScreenPosition.x - cursorSize / 2,

mouseScreenPosition.x,

mouseScreenPosition.x + cursorSize / 2,

mouseScreenPosition.x + cursorSize / 4,

mouseScreenPosition.x,

mouseScreenPosition.x - cursorSize / 4

};

int[] yPoints = {

mouseScreenPosition.y - cursorSize / 4,

mouseScreenPosition.y - cursorSize / 2,

mouseScreenPosition.y - cursorSize / 4,

mouseScreenPosition.y + cursorSize / 4,

mouseScreenPosition.y + cursorSize / 2,

mouseScreenPosition.y + cursorSize / 4

};

 

// Set gold color for the border

g.setColor(new Color(255, 215, 0)); // Gold color (255, 215, 0)

 

// Draw the cursor shape with a thicker gold border

g.setStroke(new BasicStroke(2)); // Increase the stroke width for the border

g.drawPolygon(xPoints, yPoints, xPoints.length); // Draw the border

 

// Set custom cursor color (bright red with 25% opacity)

g.setColor(new Color(255, 0, 0, 64)); // Red (255, 0, 0) with alpha (64)

 

// Draw the cursor shape with less opacity

g.fillPolygon(xPoints, yPoints, xPoints.length); // Fill the shape

 

// Draw a smaller shape in the center (triangle with silver color)

int smallShapeSize = 8; // Size of the smaller shape

int[] smallXPoints = {

mouseScreenPosition.x - smallShapeSize / 2,

mouseScreenPosition.x + smallShapeSize / 2,

mouseScreenPosition.x

};

int[] smallYPoints = {

mouseScreenPosition.y + smallShapeSize / 2,

mouseScreenPosition.y + smallShapeSize / 2,

mouseScreenPosition.y - smallShapeSize / 2

};

g.setColor(new Color(224, 224, 224, 192)); // Silver color (192, 192, 192) with alpha (128)

g.fillPolygon(smallXPoints, smallYPoints, 3); // Fill the triangle

}

Badabing Badaboom you gots yourself a mouse cursor, ask chat gpt if you wanna change the shape and colour of it etc or just mess with the colours and cursor sizes that are already present in the above method

  • Boge 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...