Java Code Examples for org.lwjgl.input.Mouse#create()
The following examples show how to use
org.lwjgl.input.Mouse#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LwjglMouseInput.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void initialize() { if (!context.isRenderable()) return; try { Mouse.create(); logger.fine("Mouse created."); supportHardwareCursor = (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0; // Recall state that was set before initialization Mouse.setGrabbed(!cursorVisible); } catch (LWJGLException ex) { logger.log(Level.SEVERE, "Error while creating mouse", ex); } if (listener != null) { sendFirstMouseEvent(); } }
Example 2
Source File: Game.java From FEMultiplayer with GNU General Public License v3.0 | 5 votes |
public void init(int width, int height, String name) { time = System.nanoTime(); windowWidth = width*scaleX; windowHeight = height*scaleY; try { Display.setDisplayMode(new DisplayMode(windowWidth, windowHeight)); Display.create(); Display.setTitle(name); Keyboard.create(); Keyboard.enableRepeatEvents(true); Mouse.create(); glContextExists = true; } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } //init OpenGL glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.01f); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearDepth(1.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glViewport(0, 0, windowWidth, windowHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, windowWidth/scaleX, windowHeight/scaleY, 0, 1, -1); //It's basically a camera glMatrixMode(GL_MODELVIEW); keys = new ArrayList<KeyboardEvent>(); mouseEvents = new ArrayList<MouseEvent>(); }
Example 3
Source File: Window.java From 3DGameEngine with Apache License 2.0 | 5 votes |
public static void CreateWindow(int width, int height, String title) { Display.setTitle(title); try { Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); Keyboard.create(); Mouse.create(); } catch (LWJGLException e) { e.printStackTrace(); } }
Example 4
Source File: LwjglMouseInput.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void initialize() { if (!context.isRenderable()) return; try { Mouse.create(); logger.info("Mouse created."); supportHardwareCursor = (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0; // Recall state that was set before initialization Mouse.setGrabbed(!cursorVisible); } catch (LWJGLException ex) { logger.log(Level.SEVERE, "Error while creating mouse", ex); } }
Example 5
Source File: Game.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 4 votes |
/** * Inits the. * * @param width the width * @param height the height * @param name the name */ public void init(int width, int height, String name) { Game.logicalWidth = width; Game.logicalHeight = height; Game.scale = FEResources.getWindowScale(); final int windowWidth = Math.round(logicalWidth * scale); final int windowHeight = Math.round(logicalHeight * scale); try { Display.setDisplayMode(new DisplayMode(windowWidth, windowHeight)); Display.create(); Display.setTitle(name); Keyboard.create(); Keyboard.enableRepeatEvents(true); Mouse.create(); glContextExists = true; } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } //init OpenGL glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.01f); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearDepth(1.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glViewport(0, 0, windowWidth, windowHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, height, 0, 1, -1); //It's basically a camera glMatrixMode(GL_MODELVIEW); keys = new ArrayList<KeyboardEvent>(); mouseEvents = new ArrayList<MouseEvent>(); }