Guest User

Untitled

a guest
Apr 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. // incorrectly reports 16 buttons; only capable of reading first three.
  2.  
  3. import org.lwjgl.*;
  4. import org.lwjgl.opengl.Display;
  5. import org.lwjgl.opengl.DisplayMode;
  6. import org.lwjgl.input.Mouse;
  7.  
  8.  
  9. public class MouseProperties
  10. {
  11.     @SuppressWarnings("static-access")
  12.     public static void main (String[] argv)
  13.     {
  14.         try
  15.         {
  16.                 Display.setDisplayMode(new DisplayMode(200,200));
  17.                 Display.create();
  18.                 Mouse.create();
  19.                 if (Mouse.isCreated() && Display.isCreated())
  20.                 {
  21.                     System.out.println("\tNumber of buttons: " + Mouse.getButtonCount());
  22.                     System.out.println("Does mouse have wheel?");
  23.                     if (Mouse.hasWheel())
  24.                         System.out.println("\tMouse has wheel.");
  25.                     System.out.println("Determining which button is which: ");
  26.                     while (!Display.isCloseRequested())
  27.                     {
  28.                         Mouse.next();
  29.                         System.out.println("\t\t" + Mouse.getEventButton());
  30.                         Display.update();
  31.                     }
  32.                     Mouse.destroy();
  33.                     Display.destroy();
  34.                 }
  35.         }
  36.         catch (LWJGLException e )
  37.         {
  38.             e.printStackTrace();
  39.             System.exit(0);
  40.         }
  41.        
  42.         return;
  43.     }
  44. }
Add Comment
Please, Sign In to add comment