1 /*
2  * Copyright (c) 2002-2008 LWJGL Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of 'LWJGL' nor the names of
17  *   its contributors may be used to endorse or promote products derived
18  *   from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 package org.lwjgl.opengl;
33 
34 /**
35  * This is the input implementation interface. Mouse and Keyboard delegates
36  * to implementors of this interface. There is one InputImplementation
37  * for each supported platform.
38  * @author elias_naur
39  */
40 
41 import java.nio.ByteBuffer;
42 import java.nio.IntBuffer;
43 
44 import org.lwjgl.LWJGLException;
45 
46 public interface InputImplementation {
47 	/*
48 	 * Mouse methods
49 	 */
50 	/** Query of wheel support */
hasWheel()51 	boolean hasWheel();
52 
53 	/** Query of button count */
getButtonCount()54 	int getButtonCount();
55 
56 	/**
57 	 * Method to create the mouse.
58 	 */
createMouse()59 	void createMouse() throws LWJGLException;
60 
61 	/**
62 	 * Method the destroy the mouse
63 	 */
destroyMouse()64 	void destroyMouse();
65 
66 	/**
67 	 * Method to poll the mouse
68 	 */
pollMouse(IntBuffer coord_buffer, ByteBuffer buttons)69 	void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
70 
71 	/**
72 	 * Method to read the mouse buffer
73 	 */
readMouse(ByteBuffer buffer)74 	void readMouse(ByteBuffer buffer);
75 
grabMouse(boolean grab)76 	void grabMouse(boolean grab);
77 
78 	/**
79 	 * Function to determine native cursor support
80 	 */
getNativeCursorCapabilities()81 	int getNativeCursorCapabilities();
82 
83 	/** Method to set the native cursor position */
setCursorPosition(int x, int y)84 	void setCursorPosition(int x, int y);
85 
86 	/** Method to set the native cursor */
setNativeCursor(Object handle)87 	void setNativeCursor(Object handle) throws LWJGLException;
88 
89 	/** Method returning the minimum cursor size */
getMinCursorSize()90 	int getMinCursorSize();
91 
92 	/** Method returning the maximum cursor size */
getMaxCursorSize()93 	int getMaxCursorSize();
94 
95 	/*
96 	 * Keyboard methods
97 	 */
98 
99 	/**
100 	 * Method to create the keyboard
101 	 */
createKeyboard()102 	void createKeyboard() throws LWJGLException;
103 
104 	/**
105 	 * Method to destroy the keyboard
106 	 */
destroyKeyboard()107 	void destroyKeyboard();
108 
109 	/**
110 	 * Method to poll the keyboard.
111 	 *
112 	 * @param keyDownBuffer the address of a 256-byte buffer to place
113 	 * key states in.
114 	 */
pollKeyboard(ByteBuffer keyDownBuffer)115 	void pollKeyboard(ByteBuffer keyDownBuffer);
116 
117 	/**
118 	 * Method to read the keyboard buffer
119 	 */
readKeyboard(ByteBuffer buffer)120 	void readKeyboard(ByteBuffer buffer);
121 
122 //	int isStateKeySet(int key);
123 
124 	/** Native cursor handles */
createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays)125 	Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException;
126 
destroyCursor(Object cursor_handle)127 	void destroyCursor(Object cursor_handle);
128 
getWidth()129 	int getWidth();
130 
getHeight()131 	int getHeight();
132 
isInsideWindow()133         boolean isInsideWindow();
134 }
135