Skip to content

Commit

Permalink
added mouse listener
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Dec 18, 2023
1 parent 6e59507 commit 2ff4b89
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/main/java/com/marginallyclever/ro3/render/OpenGLPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.event.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
Expand All @@ -26,7 +27,7 @@
/**
* {@link OpenGLPanel} is a {@link DockingPanel} that contains a {@link GLJPanel} and an {@link FPSAnimator}.
*/
public class OpenGLPanel extends JPanel implements GLEventListener {
public class OpenGLPanel extends JPanel implements GLEventListener, MouseListener, MouseMotionListener, MouseWheelListener {
private static final Logger logger = LoggerFactory.getLogger(OpenGLPanel.class);
protected GLJPanel glCanvas;
protected int canvasWidth, canvasHeight;
Expand Down Expand Up @@ -54,12 +55,18 @@ public OpenGLPanel() {
public void addNotify() {
super.addNotify();
addGLEventListener(this);
glCanvas.addMouseListener(this);
glCanvas.addMouseMotionListener(this);
glCanvas.addMouseWheelListener(this);
}

@Override
public void removeNotify() {
super.removeNotify();
removeGLEventListener(this);
glCanvas.removeMouseListener(this);
glCanvas.removeMouseMotionListener(this);
glCanvas.removeMouseWheelListener(this);
}

private GLCapabilities getCapabilities() {
Expand Down Expand Up @@ -201,4 +208,28 @@ private void renderAllPasses() {
}
}
}

@Override
public void mouseClicked(MouseEvent e) {}

@Override
public void mousePressed(MouseEvent e) {}

@Override
public void mouseReleased(MouseEvent e) {}

@Override
public void mouseEntered(MouseEvent e) {}

@Override
public void mouseExited(MouseEvent e) {}

@Override
public void mouseDragged(MouseEvent e) {}

@Override
public void mouseMoved(MouseEvent e) {}

@Override
public void mouseWheelMoved(MouseWheelEvent e) {}
}

0 comments on commit 2ff4b89

Please sign in to comment.