Skip to content

Commit

Permalink
fixed cursor transparency (normal cursors only have 1-bit transparency)
Browse files Browse the repository at this point in the history
  • Loading branch information
Althoumb committed Apr 3, 2018
1 parent 50f5318 commit b33dbb6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/game/RhythmState.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class RhythmState extends DefaultGameState {
private int beatmapindex = 0;

private Input inp; // Get various information about input (e.g. mouse position)
private Image cursor;
private Vector2f cursorcenter;

private GameContainer gamecontainer;

Expand All @@ -74,7 +76,9 @@ public RhythmState(int id) {
public void enter(GameContainer gc, StateBasedGame arg1) throws SlickException {
gamecontainer = gc;
inp = gc.getInput();
gc.setMouseCursor("res/cursor.png", 80, 80);
gc.setMouseGrabbed(true);
cursor = new Image("res/cursor.png");
cursorcenter = new Vector2f(cursor.getWidth() / 2, cursor.getHeight() / 2);

String beatmapzipfilename = "725875 Sanshuu Chuugaku Yuushabu - Hoshi to Hana.osz";
String beatmaporigin = "res/sample_osu_beatmaps/";
Expand Down Expand Up @@ -185,6 +189,9 @@ public void render(GameContainer gc, StateBasedGame arg1, Graphics g)
10, 90);
g.drawString("Perfection: " + perfectionpercent + "%",
10, 110);

g.drawImage(cursor, inp.getMouseX() - cursorcenter.x,
inp.getMouseY() - cursorcenter.y);
}

@Override
Expand Down

0 comments on commit b33dbb6

Please sign in to comment.