You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(1) |
2
(14) |
3
(4) |
4
|
5
(3) |
6
(1) |
|
7
(9) |
8
(2) |
9
(4) |
10
|
11
(16) |
12
(21) |
13
(14) |
|
14
(12) |
15
(5) |
16
(6) |
17
|
18
(4) |
19
(4) |
20
(3) |
|
21
(2) |
22
(12) |
23
|
24
|
25
(8) |
26
|
27
(25) |
|
28
|
29
(2) |
30
(1) |
|
|
|
|
|
From: Elias N. <eli...@us...> - 2004-11-12 15:43:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26516/src/native/linux Modified Files: org_lwjgl_input_Mouse.c Log Message: Linux fixes to absolute coordinates Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_input_Mouse.c 12 Nov 2004 15:01:29 -0000 1.20 +++ org_lwjgl_input_Mouse.c 12 Nov 2004 15:43:14 -0000 1.21 @@ -74,16 +74,24 @@ static Cursor blank_cursor; static Cursor current_cursor; -static bool putMouseEvent(jint button, jint state, jint coord1, jint coord2, jint dz) { +static bool putMouseEventWithCoords(jint button, jint state, jint coord1, jint coord2, jint dz) { jint event[] = {button, state, coord1, coord2, dz}; return putEvent(&event_queue, event); } +static bool putMouseEvent(jint button, jint state, jint dz) { + if (pointer_grabbed) + return putMouseEventWithCoords(button, state, 0, 0, dz); + else + return putMouseEventWithCoords(button, state, last_x, last_y, dz); +} + static int transformY(int y) { return getWindowHeight() - 1 - y; } static void setCursorPos(int x, int y) { + y = transformY(y); jint dx = x - last_x; jint dy = y - last_y; accum_dx += dx; @@ -91,9 +99,9 @@ last_x = x; last_y = y; if (pointer_grabbed) { - putMouseEvent(-1, 0, dx, -dy, 0); + putMouseEventWithCoords(-1, 0, dx, dy, 0); } else { - putMouseEvent(-1, 0, x, transformY(y), 0); + putMouseEventWithCoords(-1, 0, x, y, 0); } } @@ -290,7 +298,7 @@ if (button_num == NUM_BUTTONS) return; buttons[button_num] = state; - putMouseEvent(button_num, state, 0, 0, 0); + putMouseEvent(button_num, state, 0); } void handleButtonPress(XButtonEvent *event) { @@ -298,11 +306,11 @@ switch (event->button) { case Button4: delta = WHEEL_SCALE; - putMouseEvent(-1, 0, 0, 0, delta); + putMouseEvent(-1, 0, delta); break; case Button5: delta = -WHEEL_SCALE; - putMouseEvent(-1, 0, 0, 0, delta); + putMouseEvent(-1, 0, delta); break; default: break; @@ -364,10 +372,10 @@ } if (pointer_grabbed) { coords[0] = accum_dx; - coords[1] = -accum_dy; + coords[1] = accum_dy; } else { coords[0] = last_x; - coords[1] = transformY(last_y); + coords[1] = last_y; } coords[2] = accum_dz; accum_dx = accum_dy = accum_dz = 0; |
|
From: Elias N. <eli...@us...> - 2004-11-12 15:38:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25324/src/java/org/lwjgl/opengl Modified Files: MouseEventQueue.java Log Message: Mac OS X part of absolute mouse coords Index: MouseEventQueue.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MouseEventQueue.java 12 Nov 2004 15:11:41 -0000 1.2 +++ MouseEventQueue.java 12 Nov 2004 15:37:47 -0000 1.3 @@ -100,7 +100,14 @@ accum_dx = accum_dy = 0; } - private boolean putMouseEvent(int button, int state, int coord1, int coord2, int dz) { + private boolean putMouseEvent(int button, int state, int dz) { + if (grabbed) + return putMouseEventWithCoords(button, state, 0, 0, dz); + else + return putMouseEventWithCoords(button, state, last_x, last_y, dz); + } + + private boolean putMouseEventWithCoords(int button, int state, int coord1, int coord2, int dz) { event[0] = button; event[1] = state; event[2] = coord1; @@ -125,6 +132,7 @@ } private synchronized void setCursorPos(int x, int y) { + y = transformY(y); if (grabbed) return; int dx = x - last_x; @@ -133,7 +141,7 @@ accum_dy += dy; last_x = x; last_y = y; - putMouseEvent(-1, 0, x, transformY(y), 0); + putMouseEventWithCoords(-1, 0, x, y, 0); } public void mouseClicked(MouseEvent e) { @@ -181,7 +189,7 @@ private synchronized void setButton(byte button, byte state) { buttons[button] = state; - putMouseEvent(button, state, 0, 0, 0); + putMouseEvent(button, state, 0); } public void mouseReleased(MouseEvent e) { @@ -199,7 +207,7 @@ private synchronized void handleWheel(int amount) { accum_dz += amount; - putMouseEvent(-1, 0, 0, 0, amount); + putMouseEvent(-1, 0, amount); } public void updateDeltas() { @@ -208,9 +216,9 @@ synchronized (this) { ((MacOSXDisplay)Display.getImplementation()).getMouseDeltas(delta_buffer); int dx = delta_buffer.get(0); - int dy = delta_buffer.get(1); + int dy = -delta_buffer.get(1); if (dx != 0 || dy != 0) { - putMouseEvent(-1, 0, dx, -dy, 0); + putMouseEventWithCoords(-1, 0, dx, dy, 0); accum_dx += dx; accum_dy += dy; } |
|
From: Elias N. <eli...@us...> - 2004-11-12 15:32:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24439/src/native/win32 Modified Files: org_lwjgl_input_Mouse.cpp Log Message: Win32 part of absolute mouse coordinates Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- org_lwjgl_input_Mouse.cpp 8 Nov 2004 12:10:26 -0000 1.66 +++ org_lwjgl_input_Mouse.cpp 12 Nov 2004 15:32:20 -0000 1.67 @@ -65,10 +65,8 @@ static int accum_dx; static int accum_dy; static int accum_dwheel; -static int last_poll_x; -static int last_poll_y; -static int last_event_x; -static int last_event_y; +static int last_x; +static int last_y; static event_queue_t event_queue; static bool buffer_enabled; @@ -82,19 +80,25 @@ void InitializeMouseFields(); void UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj); -static bool putMouseEvent(jint button, jint state, jint dx, jint dy, jint dz) { - jint event[] = {button, state, dx, -dy, dz}; +static int transformY(int y) { + RECT clientRect; + GetClientRect(getCurrentHWND(), &clientRect); + return (clientRect.bottom - clientRect.top) - 1 - y; +} + +static bool putMouseEventWithCoords(jint button, jint state, jint coord1, jint coord2, jint dz) { + jint event[] = {button, state, coord1, coord2, dz}; return putEvent(&event_queue, event); } +static bool putMouseEvent(jint button, jint state, jint dz) { + if (mouse_grabbed) + return putMouseEventWithCoords(button, state, 0, 0, dz); + else + return putMouseEventWithCoords(button, state, last_x, last_y, dz); +} + static void resetCursorPos(void) { - /* Reset cursor position to middle of the window */ - RECT clientRect; - GetClientRect(getCurrentHWND(), &clientRect); - last_poll_x = (clientRect.left + clientRect.right)/2; - last_poll_y = clientRect.bottom - 1 - (clientRect.bottom - clientRect.top)/2; - last_event_x = last_poll_x; - last_event_y = last_poll_y; accum_dx = accum_dy = 0; } @@ -114,7 +118,7 @@ initEventQueue(&event_queue, EVENT_SIZE); - last_poll_x = last_poll_y = last_event_x = last_event_y = accum_dx = accum_dy = accum_dwheel = 0; + last_x = last_y = accum_dx = accum_dy = accum_dwheel = 0; buffer_enabled = false; // Create input @@ -158,26 +162,26 @@ void handleMouseScrolled(int event_dwheel) { accum_dwheel += event_dwheel; - putMouseEvent(-1, 0, 0, 0, event_dwheel); + putMouseEvent(-1, 0, event_dwheel); } void handleMouseMoved(int x, int y) { - int poll_dx = x - last_poll_x; - int poll_dy = y - last_poll_y; - accum_dx += poll_dx; - accum_dy += poll_dy; - last_poll_x = x; - last_poll_y = y; - int event_dx = x - last_event_x; - int event_dy = y - last_event_y; - if (putMouseEvent(-1, 0, event_dx, event_dy, 0)) { - last_event_x = x; - last_event_y = y; - } + y = transformY(y); + int dx = x - last_x; + int dy = y - last_y; + accum_dx += dx; + accum_dy += dy; + last_x = x; + last_y = y; + if (mouse_grabbed) { + putMouseEventWithCoords(-1, 0, dx, dy, 0); + } else { + putMouseEventWithCoords(-1, 0, x, y, 0); + } } void handleMouseButton(int button, int state) { - putMouseEvent(button, state, 0, 0, 0); + putMouseEvent(button, state, 0); } static void copyDXEvents(int num_di_events, DIDEVICEOBJECTDATA *di_buffer) { @@ -187,19 +191,19 @@ int button_state = (di_buffer[i].dwData & 0x80) != 0 ? 1 : 0; switch (di_buffer[i].dwOfs) { case DIMOFS_BUTTON0: - putMouseEvent(0, button_state, dx, dy, dwheel); + putMouseEventWithCoords(0, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON1: - putMouseEvent(1, button_state, dx, dy, dwheel); + putMouseEventWithCoords(1, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON2: - putMouseEvent(2, button_state, dx, dy, dwheel); + putMouseEventWithCoords(2, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON3: - putMouseEvent(3, button_state, dx, dy, dwheel); + putMouseEventWithCoords(3, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_X: @@ -214,12 +218,10 @@ } } if (dx != 0 || dy != 0 || dwheel != 0) - putMouseEvent(-1, 0, dx, dy, dwheel); + putMouseEventWithCoords(-1, 0, dx, -dy, dwheel); } -static void readDXBuffer() -{ - +static void readDXBuffer() { DIDEVICEOBJECTDATA rgdod[EVENT_BUFFER_SIZE]; DWORD num_di_events = EVENT_BUFFER_SIZE; @@ -326,7 +328,6 @@ ShowCursor(true); mouseMask = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND; } - resetCursorPos(); } mDIDevice->Unacquire(); if(mDIDevice->SetCooperativeLevel(getCurrentHWND(), mouseMask) != DI_OK) { @@ -486,8 +487,8 @@ coords[1] = -diMouseState.lY; coords[2] = diMouseState.lZ; } else { - coords[0] = accum_dx; - coords[1] = -accum_dy; + coords[0] = last_x; + coords[1] = last_y; coords[2] = accum_dwheel; accum_dx = accum_dy = accum_dwheel = 0; } |
|
From: Elias N. <eli...@us...> - 2004-11-12 15:11:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20033/src/native/macosx Modified Files: Makefile Log Message: Mac OS X part of absolute mouse coords Index: Makefile =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 12 Nov 2004 14:32:42 -0000 1.2 +++ Makefile 12 Nov 2004 15:11:42 -0000 1.3 @@ -7,7 +7,7 @@ STRIP=strip CFLAGS_LINK=-dynamiclib -Wall FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM -CFLAGS_O=-fPIC O2 -D_MACOSX -Wall -c -I${AL}/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers +CFLAGS_O=-fPIC -O2 -D_MACOSX -Wall -c -I${AL}/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers SRC=$(wildcard *.m) $(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../common/arb/*.c) $(wildcard ../common/ati/*.c) $(wildcard ../common/ext/*.c) $(wildcard ../common/nv/*.c) OBJECTS=$(subst .m,.o, $(subst .c,.o,$(SRC))) LIBRARY=liblwjgl.jnilib |
|
From: Elias N. <eli...@us...> - 2004-11-12 15:11:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20033/src/java/org/lwjgl/opengl Modified Files: MouseEventQueue.java Log Message: Mac OS X part of absolute mouse coords Index: MouseEventQueue.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MouseEventQueue.java 11 Nov 2004 16:04:28 -0000 1.1 +++ MouseEventQueue.java 12 Nov 2004 15:11:41 -0000 1.2 @@ -65,12 +65,9 @@ private int accum_dy; private int accum_dz; - /** The last polled mouse position */ - private int last_poll_x; - private int last_poll_y; - /** The last event mouse position */ - private int last_event_x; - private int last_event_y; + /** The last mouse position */ + private int last_x; + private int last_y; /** Event scratch array */ private final int[] event = new int[EVENT_SIZE]; @@ -94,29 +91,32 @@ return grabbed; } + private int transformY(int y) { + return height - 1 - y; + } + private void resetCursorToCenter() { - int center_x = width/2; - int center_y = height - 1 - height/2; - last_poll_x = center_x; - last_poll_y = center_y; - last_event_x = center_x; - last_event_y = center_y; clearEvents(); accum_dx = accum_dy = 0; } - private boolean putMouseEvent(int button, int state, int dx, int dy, int dz) { + private boolean putMouseEvent(int button, int state, int coord1, int coord2, int dz) { event[0] = button; event[1] = state; - event[2] = dx; - event[3] = dy; + event[2] = coord1; + event[3] = coord2; event[4] = dz; return putEvent(event); } public synchronized void poll(IntBuffer coord_buffer, ByteBuffer buttons_buffer) { - coord_buffer.put(0, accum_dx); - coord_buffer.put(1, accum_dy); + if (grabbed) { + coord_buffer.put(0, accum_dx); + coord_buffer.put(1, accum_dy); + } else { + coord_buffer.put(0, last_x); + coord_buffer.put(1, last_y); + } coord_buffer.put(2, accum_dz); accum_dx = accum_dy = accum_dz = 0; int old_position = buttons_buffer.position(); @@ -127,18 +127,13 @@ private synchronized void setCursorPos(int x, int y) { if (grabbed) return; - int poll_dx = x - last_poll_x; - int poll_dy = y - last_poll_y; - accum_dx += poll_dx; - accum_dy += poll_dy; - last_poll_x = x; - last_poll_y = y; - int event_dx = x - last_event_x; - int event_dy = y - last_event_y; - if (putMouseEvent(-1, 0, event_dx, -event_dy, 0)) { - last_event_x = x; - last_event_y = y; - } + int dx = x - last_x; + int dy = y - last_y; + accum_dx += dx; + accum_dy += dy; + last_x = x; + last_y = y; + putMouseEvent(-1, 0, x, transformY(y), 0); } public void mouseClicked(MouseEvent e) { |
|
From: Elias N. <eli...@us...> - 2004-11-12 15:01:39
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17363/src/native/linux Modified Files: org_lwjgl_input_Mouse.c Log Message: Make read() and poll() return absolute coordinates when the mouse is not grabbed Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_input_Mouse.c 8 Nov 2004 12:11:42 -0000 1.19 +++ org_lwjgl_input_Mouse.c 12 Nov 2004 15:01:29 -0000 1.20 @@ -65,10 +65,8 @@ static int accum_dx; static int accum_dy; static int accum_dz; -static int last_poll_x; -static int last_poll_y; -static int last_event_x; -static int last_event_y; +static int last_x; +static int last_y; static jbyte buttons[NUM_BUTTONS]; static event_queue_t event_queue; static bool buffer_enabled; @@ -76,35 +74,32 @@ static Cursor blank_cursor; static Cursor current_cursor; -static bool putMouseEvent(jint button, jint state, jint dx, jint dy, jint dz) { - jint event[] = {button, state, dx, dy, dz}; +static bool putMouseEvent(jint button, jint state, jint coord1, jint coord2, jint dz) { + jint event[] = {button, state, coord1, coord2, dz}; return putEvent(&event_queue, event); } -static void setCursorPos(int x, int y) { - jint poll_dx = x - last_poll_x; - jint poll_dy = y - last_poll_y; - accum_dx += poll_dx; - accum_dy += poll_dy; - last_poll_x = x; - last_poll_y = y; - jint event_dx = x - last_event_x; - jint event_dy = y - last_event_y; - if (putMouseEvent(-1, 0, event_dx, -event_dy, 0)) { - last_event_x = x; - last_event_y = y; - } -} - static int transformY(int y) { return getWindowHeight() - 1 - y; } +static void setCursorPos(int x, int y) { + jint dx = x - last_x; + jint dy = y - last_y; + accum_dx += dx; + accum_dy += dy; + last_x = x; + last_y = y; + if (pointer_grabbed) { + putMouseEvent(-1, 0, dx, -dy, 0); + } else { + putMouseEvent(-1, 0, x, transformY(y), 0); + } +} + static void resetCursor(int x, int y) { - last_poll_x = x; - last_poll_y = y; - last_event_x = x; - last_event_y = y; + last_x = x; + last_y = y; } static bool blankCursor(void) { @@ -241,8 +236,7 @@ return NUM_BUTTONS; } -static void resetCursorToCenter(void) { - resetCursor(getWindowWidth()/2, transformY(getWindowHeight()/2)); +static void reset(void) { initEventQueue(&event_queue, EVENT_SIZE); } @@ -253,8 +247,8 @@ if (disp == NULL) return; int i; - last_poll_y = last_poll_x = last_event_x = last_event_y = accum_dx = accum_dy = accum_dz = 0; - resetCursorToCenter(); + last_y = last_x = accum_dx = accum_dy = accum_dz = 0; + reset(); for (i = 0; i < NUM_BUTTONS; i++) buttons[i] = 0; if (!blankCursor()) { @@ -368,8 +362,13 @@ printfDebug("ERROR: Not enough space in coords array: %d < 3\n", coords_length); return; } - coords[0] = accum_dx; - coords[1] = -accum_dy; + if (pointer_grabbed) { + coords[0] = accum_dx; + coords[1] = -accum_dy; + } else { + coords[0] = last_x; + coords[1] = transformY(last_y); + } coords[2] = accum_dz; accum_dx = accum_dy = accum_dz = 0; int num_buttons = NUM_BUTTONS; @@ -397,7 +396,7 @@ unsigned int mask_return; setGrab(new_grab == JNI_TRUE ? true : false); - resetCursorToCenter(); + reset(); accum_dx = accum_dy = 0; XQueryPointer(getDisplay(), getCurrentWindow(), &root_return, &child_return, &root_x, &root_y, &win_x, &win_y, &mask_return); doHandlePointerMotion(root_x, root_y, win_x, win_y); |
|
From: Elias N. <eli...@us...> - 2004-11-12 15:01:37
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17363/src/java/org/lwjgl/input Modified Files: Mouse.java Log Message: Make read() and poll() return absolute coordinates when the mouse is not grabbed Index: Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- Mouse.java 3 Nov 2004 13:49:08 -0000 1.68 +++ Mouse.java 12 Nov 2004 15:01:26 -0000 1.69 @@ -68,13 +68,6 @@ /** animation native cursor */ public final static int CURSOR_ANIMATION = 4; - /** Mouse minimum and maximum sensitivity */ - public static final int MAX_SENSITIVITY = 8; - public static final int MIN_SENSITIVITY = 1; - - /** Mouse sensitivity: 1...8 */ - private static int sensitivity = MAX_SENSITIVITY; - /** Mouse constraint */ private static int width, height; @@ -84,18 +77,12 @@ /** The mouse buttons status from the last poll */ private static ByteBuffer buttons; - /** Mouse absolute X position in 16:16FP */ + /** Mouse absolute X position in pixels */ private static int x; - /** Mouse absolute Y position in 16:16FP */ + /** Mouse absolute Y position in pixels */ private static int y; - /** Mouse X scroll position in 16:16FP */ - private static int scrollX; - - /** Mouse Y scroll position in 16:16FP */ - private static int scrollY; - /** Buffer to hold the deltas dx, dy and dwheel */ private static IntBuffer coord_buffer; @@ -139,6 +126,9 @@ private static int event_dx; private static int event_dy; private static int event_dwheel; + /** The current absolute position of the mouse in the event queue */ + private static int event_x; + private static int event_y; /** Buffer size in events */ private final static int BUFFER_SIZE = 50; @@ -147,9 +137,6 @@ private static boolean isGrabbed; - /** Whether absolute mouse tracking is enabled */ - private static boolean trackingEnabled = true; - /** * Mouse cannot be constructed. */ @@ -248,10 +235,12 @@ private static void resetMouse() { dx = dy = dwheel = 0; - width = Display.getDisplayMode().getWidth() << 16; - height = Display.getDisplayMode().getHeight() << 16; + width = Display.getDisplayMode().getWidth(); + height = Display.getDisplayMode().getHeight(); x = width / 2; y = height / 2; + if (readBuffer != null) + readBuffer.clear(); } /** @@ -266,7 +255,7 @@ if (!initialized) initialize(); - if (created) { return; } + if (created) return; Display.getImplementation().createMouse(); hasWheel = Display.getImplementation().hasWheel(); created = true; @@ -334,47 +323,26 @@ if (!created) throw new IllegalStateException("Mouse must be created before you can poll it"); Display.getImplementation().pollMouse(coord_buffer, buttons); - int poll_dx = coord_buffer.get(0); - int poll_dy = coord_buffer.get(1); + /* If we're grabbed, poll returns mouse deltas, if not it returns absolute coordinates */ + int poll_coord1 = coord_buffer.get(0); + int poll_coord2 = coord_buffer.get(1); + /* The wheel is always relative */ int poll_dwheel = coord_buffer.get(2); - dx += poll_dx; - dy += poll_dy; - dwheel += poll_dwheel; - - // Calculate the new absolute position unless tracking is disabled - if (trackingEnabled) { - x += ((poll_dx * sensitivity) << 16) / MAX_SENSITIVITY; - y += ((poll_dy * sensitivity) << 16) / MAX_SENSITIVITY; - - // clamp x, y - if (x < 0) { - scrollX = x; - x = 0; - } else if (x >= width) { - scrollX = x - width; - x = width - 1; - } else { - scrollX = 0; - } - - if (y < 0) { - scrollY = y; - y = 0; - } else if (y >= height) { - scrollY = y - height; - y = height - 1; - } else { - scrollY = 0; - } + if (isGrabbed()) { + dx += poll_coord1; + dy += poll_coord2; + x += poll_coord1; + y += poll_coord2; } else { - scrollX = 0; - scrollY = 0; + x = poll_coord1; + y = poll_coord2; } - - if (readBuffer != null) { + x = Math.min(width - 1, Math.max(0, x)); + y = Math.min(height - 1, Math.max(0, y)); + dwheel += poll_dwheel; + if (readBuffer != null) read(); - } } private static void read() { @@ -449,8 +417,17 @@ if (readBuffer.hasRemaining()) { eventButton = readBuffer.get(); eventState = readBuffer.get() != 0; - event_dx = readBuffer.get(); - event_dy = readBuffer.get(); + if (isGrabbed()) { + event_dx = readBuffer.get(); + event_dy = readBuffer.get(); + event_x += event_dx; + event_y += event_dy; + } else { + event_x = readBuffer.get(); + event_y = readBuffer.get(); + } + event_x = Math.min(width - 1, Math.max(0, event_x)); + event_y = Math.min(height - 1, Math.max(0, event_y)); event_dwheel = readBuffer.get(); return true; } else @@ -476,20 +453,38 @@ } /** - * @return Current events delta x + * @return Current events delta x. Only valid when the mouse is grabbed. */ public static int getEventDX() { + if (!isGrabbed()) + throw new IllegalStateException("X, Y deltas are only available when the mouse is grabbed. Use getEventX()/getEventY() instead."); return event_dx; } /** - * @return Current events delta y + * @return Current events delta y. Only valid when the mouse is grabbed. */ public static int getEventDY() { + if (!isGrabbed()) + throw new IllegalStateException("X, Y deltas are only available when the mouse is grabbed. Use getEventX()/getEventY() instead."); return event_dy; } /** + * @return Current events absolute x. Only valid when the mouse is not grabbed. + */ + public static int getEventX() { + return event_x; + } + + /** + * @return Current events absolute y. Only valid when the mouse is not grabbed. + */ + public static int getEventY() { + return event_y; + } + + /** * @return Current events delta z */ public static int getEventDWheel() { @@ -503,7 +498,7 @@ * @return Absolute x axis position of mouse */ public static int getX() { - return x >> 16; + return x; } /** @@ -513,22 +508,26 @@ * @return Absolute y axis position of mouse */ public static int getY() { - return y >> 16; + return y; } /** - * @return Movement on the x axis since last time getDX() was called + * @return Movement on the x axis since last time getDX() was called. Only valid when the mouse is grabbed. */ public static int getDX() { + if (!isGrabbed()) + throw new IllegalStateException("X, Y deltas are only available when the mouse is grabbed. Use getEventX()/getEventY() instead."); int result = dx; dx = 0; return result; } /** - * @return Movement on the y axis since last time getDY() was called + * @return Movement on the y axis since last time getDY() was called. Only valid when the mouse is grabbed. */ public static int getDY() { + if (!isGrabbed()) + throw new IllegalStateException("X, Y deltas are only available when the mouse is grabbed. Use getEventX()/getEventY() instead."); int result = dy; dy = 0; return result; @@ -551,20 +550,6 @@ } /** - * @return the amount the mouse tried to move past its constraints on the X axis since the last poll - */ - public static int getScrollX() { - return scrollX >> 16; - } - - /** - * @return the amount the mouse tried to move past its constraints on the Y axis since the last poll - */ - public static int getScrollY() { - return scrollY >> 16; - } - - /** * @return Whether or not this mouse has wheel support */ public static boolean hasWheel() { @@ -609,68 +594,4 @@ } } } - - /** - * Sets the mouse sensitivity, which is expressed as a value from 1 to 8. - * Values outside this range are clamped to [1..8]. 8 is the most sensitive; - * other values slow down the mouse to a minimum of 1/8th its original speed. - * @param newSensitivity The mouse sensitivity - */ - public static void setSensitivity(int newSensitivity) { - sensitivity = Math.min(MAX_SENSITIVITY, Math.max(MIN_SENSITIVITY, newSensitivity)); - } - - /** - * @return the current mouse sensitivity (guaranteed in the range 1..8) - */ - public static int getSensitivity() { - return sensitivity; - } - - /** - * Sets the absolute position of the mouse. The position is capped to the - * current size. - * - * @param newx - * @param newy - */ - public static void setPosition(int newx, int newy) { - x = Math.min(Math.max(0, newx << 16), width - 1); - y = Math.min(Math.max(0, newy << 16), height - 1); - } - - - /** - * Sets the dimensions of the mouse's constraint. - * @param width - * @param height - */ - public static void setDimensions(int width, int height) { - Mouse.width = width << 16; - Mouse.height = height << 16; - - // Clamp the mouse absolute coordinates just in case - if (x >= Mouse.width) { - x = Mouse.width - 1; - } - if (y >= Mouse.height) { - y = Mouse.height - 1; - } - } - - /** - * Enable or disable absolute mouse coordinate tracking. - * @param enabled - */ - public static void setTrackingEnabled(boolean enabled) { - Mouse.trackingEnabled = enabled; - } - - /** - * Determine if mouse coordinate tracking is enabled - * @return boolean - */ - public static boolean isTrackingEnabled() { - return trackingEnabled; - } } |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:33:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/common Modified Files: extal.h Removed Files: Makefile.am Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- Makefile.am DELETED --- Index: extal.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- extal.h 3 Nov 2004 12:10:20 -0000 1.30 +++ extal.h 12 Nov 2004 14:32:40 -0000 1.31 @@ -74,40 +74,6 @@ #define ALCAPI #define ALCAPIENTRY - #ifdef _X11 - /** ALC boolean type. */ - typedef char ALCboolean; - - /** ALC 8bit signed byte. */ - typedef char ALCbyte; - - /** ALC 8bit unsigned byte. */ - typedef unsigned char ALCubyte; - - /** ALC 16bit signed short integer type. */ - typedef short ALCshort; - - /** ALC 16bit unsigned short integer type. */ - typedef unsigned short ALCushort; - - /** ALC 32bit unsigned integer type. */ - typedef unsigned ALCuint; - - /** ALC 32bit signed integer type. */ - typedef int ALCint; - - /** ALC 32bit floating point type. */ - typedef float ALCfloat; - - /** ALC 64bit double point type. */ - typedef double ALCdouble; - - /** ALC 32bit type. */ - typedef unsigned int ALCsizei; - - /** ALC void type */ - typedef void ALCvoid; - #endif #endif #ifdef _WIN32 |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:53
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/linux Added Files: Makefile Removed Files: Makefile.am Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- Makefile.am DELETED --- --- NEW FILE: Makefile --- CC=gcc LINKER=gcc STRIP=strip CFLAGS_LINK=-shared -Wall LIBS=-L/usr/X11/lib -lX11 -lXext -lXxf86vm -lpthread -Wl,-static,-lXcursor,-lXrender,-lXrandr,-call_shared CFLAGS_O=-fPIC -O2 -D_X11 -Wall -pthread -c -I../common -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux SRC=$(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../common/arb/*.c) $(wildcard ../common/ati/*.c) $(wildcard ../common/ext/*.c) $(wildcard ../common/nv/*.c) OBJECTS=$(subst .c,.o,$(SRC)) LIBRARY=liblwjgl.so $(LIBRARY): $(OBJECTS) $(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(LIBS) $(STRIP) $@ .c.o: $(CC) $(CFLAGS_O) $< -o $@ clean: rm -f $(OBJECTS) $(LIBRARY) |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:53
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/macosx Modified Files: Makefile Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile Index: Makefile =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 11 Nov 2004 16:03:16 -0000 1.1 +++ Makefile 12 Nov 2004 14:32:42 -0000 1.2 @@ -6,25 +6,15 @@ LINKER=gcc STRIP=strip CFLAGS_LINK=-dynamiclib -Wall -#FRAMEWORKS=-framework OpenGL -framework AppKit -framework JavaVM FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM -CFLAGS_O=-O2 -D_MACOSX -Wall -c -I${AL}/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -#SRC:=$(shell find . -name \*.c -print) $(shell find ../common -name \*.c) +CFLAGS_O=-fPIC O2 -D_MACOSX -Wall -c -I${AL}/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers SRC=$(wildcard *.m) $(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../common/arb/*.c) $(wildcard ../common/ati/*.c) $(wildcard ../common/ext/*.c) $(wildcard ../common/nv/*.c) OBJECTS=$(subst .m,.o, $(subst .c,.o,$(SRC))) -#OBJECTS=org_lwjgl_opengl_Display.o \ -# org_lwjgl_Sys.o \ -# ../common/extgl.o \ -# ../common/extal.o \ -# ../common/org_lwjgl_openal_AL.o \ -# ../common/org_lwjgl_openal_ALC.o \ -# ../common/org_lwjgl_openal_AL10.o \ -# ../common/common_tools.o LIBRARY=liblwjgl.jnilib $(LIBRARY): $(OBJECTS) $(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(FRAMEWORKS) -# $(STRIP) -S -X $@ + $(STRIP) -S -X $@ .m.o: $(CC) $(CFLAGS_O) $< -o $@ @@ -33,4 +23,4 @@ $(CC) $(CFLAGS_O) $< -o $@ clean: - rm -f ${OBJECTS} ${LIBRARY} + rm -f $(OBJECTS) $(LIBRARY) |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/nv In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/common/nv Removed Files: Makefile.am Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- Makefile.am DELETED --- |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/arb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/common/arb Removed Files: Makefile.am Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- Makefile.am DELETED --- |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/ati In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/common/ati Removed Files: Makefile.am Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- Makefile.am DELETED --- |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469 Removed Files: configure.in Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- configure.in DELETED --- |
|
From: Elias N. <eli...@us...> - 2004-11-12 14:32:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469/common/fmod3 Removed Files: Makefile.am Log Message: Kill off automake/autoconf/libtool build system and replace by a much simpler Makefile --- Makefile.am DELETED --- |
|
From: Elias N. <eli...@us...> - 2004-11-12 13:23:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26114/src/java/org/lwjgl/opengl Modified Files: MacOSXDisplay.java MacOSXGLCanvas.java Added Files: MacOSXFrame.java Log Message: Mac OS X: Made AWT access thread safe --- NEW FILE: MacOSXFrame.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * This is the Mac OS X AWT Frame. It contains thread safe * methods to manipulateit from non-AWT threads * @author elias_naur */ import java.awt.BorderLayout; import java.awt.Frame; import java.awt.Insets; import java.awt.Cursor; import java.awt.Rectangle; import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; import java.awt.GraphicsEnvironment; import java.awt.GraphicsDevice; import java.awt.image.BufferedImage; import java.awt.event.WindowListener; import java.awt.event.ComponentListener; import java.awt.event.ComponentEvent; import java.awt.event.WindowEvent; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import org.lwjgl.LWJGLException; final class MacOSXFrame extends Frame implements WindowListener, ComponentListener { private final MacOSXGLCanvas canvas; private boolean close_requested; /* States */ private Rectangle bounds; private boolean should_update; private boolean active; private boolean visible; private boolean minimized; public MacOSXFrame(DisplayMode mode, java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { setResizable(false); addWindowListener(this); addComponentListener(this); canvas = new MacOSXGLCanvas(); add(canvas, BorderLayout.CENTER); setUndecorated(fullscreen); if (fullscreen) { getDevice().setFullScreenWindow(this); getDevice().setDisplayMode(requested_mode); /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */ if (requested_mode.getWidth() != getDevice().getDisplayMode().getWidth() || requested_mode.getHeight() != getDevice().getDisplayMode().getHeight()) { syncDispose(); throw new LWJGLException("AWT capped mode"); } } pack(); syncReshape(x, y, mode.getWidth(), mode.getHeight()); invokeAWT(new Runnable() { public void run() { setVisible(true); requestFocus(); canvas.requestFocus(); } }); canvas.waitForCanvasCreated(); } public Rectangle syncGetBounds() { synchronized (this) { return bounds; } } public void componentShown(ComponentEvent e) { } public void componentHidden(ComponentEvent e) { } private void updateBounds() { synchronized (this) { bounds = getBounds(); } } public void componentResized(ComponentEvent e) { updateBounds(); } public void componentMoved(ComponentEvent e) { updateBounds(); } public final static GraphicsDevice getDevice() { GraphicsEnvironment g_env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = g_env.getDefaultScreenDevice(); return device; } public void windowIconified(WindowEvent e) { synchronized (this) { minimized = true; } } public void windowDeiconified(WindowEvent e) { synchronized (this) { minimized = false; } } public void windowOpened(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowClosing(WindowEvent e) { synchronized (this) { close_requested = true; } } public void windowDeactivated(WindowEvent e) { synchronized (this) { active = false; } } public void windowActivated(WindowEvent e) { synchronized (this) { should_update = true; active = true; } } public void syncDispose() { invokeAWT(new Runnable() { public void run() { dispose(); } }); } private class TitleSetter implements Runnable { private final String title; public TitleSetter(String title) { this.title = title; } public void run() { setTitle(title); } } public void syncSetTitle(String title) { invokeAWT(new TitleSetter(title)); } public boolean syncIsCloseRequested() { boolean result; synchronized (this) { result = close_requested; close_requested = false; } return result; } public boolean syncIsVisible() { synchronized (this) { return !minimized; } } public boolean syncIsActive() { synchronized (this) { return active; } } public MacOSXGLCanvas getCanvas() { return canvas; } public boolean syncShouldUpdateContext() { boolean result; synchronized (this) { result = canvas.syncShouldUpdateContext() || should_update; should_update = false; } return result; } private class Reshaper implements Runnable { private final int x; private final int y; private final int width; private final int height; public Reshaper(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; } public void run() { Insets insets = getInsets(); setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom); } } private void invokeAWT(Runnable r) { try { java.awt.EventQueue.invokeAndWait(r); } catch (InterruptedException e) { // ignore } catch (InvocationTargetException e) { throw new RuntimeException(e); } } public void syncReshape(int x, int y, int width, int height) { invokeAWT(new Reshaper(x, y, width, height)); } private class CursorSetter implements Runnable { private final java.awt.Cursor awt_cursor; public CursorSetter(java.awt.Cursor awt_cursor) { this.awt_cursor = awt_cursor; } public void run() { canvas.setCursor(awt_cursor); } } public void syncSetCursor(java.awt.Cursor awt_cursor) { invokeAWT(new CursorSetter(awt_cursor)); } } Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MacOSXDisplay.java 12 Nov 2004 10:48:51 -0000 1.3 +++ MacOSXDisplay.java 12 Nov 2004 13:23:20 -0000 1.4 @@ -51,30 +51,26 @@ import java.util.ArrayList; import java.awt.BorderLayout; import java.awt.Frame; -import javax.swing.JFrame; import java.awt.Insets; import java.awt.Cursor; import java.awt.Rectangle; import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; -import java.awt.GraphicsEnvironment; -import java.awt.GraphicsDevice; import java.awt.image.BufferedImage; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; -final class MacOSXDisplay extends WindowAdapter implements DisplayImplementation { - private JFrame frame; - private MacOSXGLCanvas canvas; - private boolean close_requested; +final class MacOSXDisplay implements DisplayImplementation { + private MacOSXFrame frame; private MouseEventQueue mouse_queue; private KeyboardEventQueue keyboard_queue; private java.awt.DisplayMode requested_mode; + + /* States */ + private boolean close_requested; public MacOSXDisplay() { new MacOSXApplicationListener(); @@ -82,33 +78,12 @@ public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { close_requested = false; - frame = new JFrame(); - frame.setResizable(false); - frame.addWindowListener(this); - canvas = new MacOSXGLCanvas(); - frame.getContentPane().add(canvas, BorderLayout.CENTER); - frame.setUndecorated(fullscreen); - if (fullscreen) { - getDevice().setFullScreenWindow(frame); - getDevice().setDisplayMode(requested_mode); - /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */ - if (requested_mode.getWidth() != getDevice().getDisplayMode().getWidth() || requested_mode.getHeight() != getDevice().getDisplayMode().getHeight()) { - destroyWindow(); - throw new LWJGLException("AWT capped mode"); - } + try { + frame = new MacOSXFrame(mode, requested_mode, fullscreen, x, y); + } catch (LWJGLException e) { + destroyWindow(); + throw e; } - frame.pack(); - reshape(x, y, mode.getWidth(), mode.getHeight()); - frame.setVisible(true); - frame.requestFocus(); - canvas.requestFocus(); - canvas.waitForCanvasCreated(); - } - - private GraphicsDevice getDevice() { - GraphicsEnvironment g_env = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice device = g_env.getDefaultScreenDevice(); - return device; } private void handleQuit() { @@ -117,21 +92,12 @@ } } - public void windowClosing(WindowEvent e) { - handleQuit(); - } - - public void windowActivated(WindowEvent e) { - warpCursor(); - } - public void destroyWindow() { - if (getDevice().getFullScreenWindow() != null) - getDevice().setFullScreenWindow(null); + if (MacOSXFrame.getDevice().getFullScreenWindow() != null) + MacOSXFrame.getDevice().setFullScreenWindow(null); setView(null); - frame.dispose(); + frame.syncDispose(); frame = null; - canvas = null; } public int getGammaRampLength() { @@ -156,7 +122,7 @@ } public void switchDisplayMode(DisplayMode mode) throws LWJGLException { - java.awt.DisplayMode[] awt_modes = getDevice().getDisplayModes(); + java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); for (int i = 0; i < awt_modes.length; i++) if (equals(awt_modes[i], mode)) { requested_mode = awt_modes[i]; @@ -166,8 +132,8 @@ } public void resetDisplayMode() { - if (getDevice().getFullScreenWindow() != null) - getDevice().setFullScreenWindow(null); + if (MacOSXFrame.getDevice().getFullScreenWindow() != null) + MacOSXFrame.getDevice().setFullScreenWindow(null); requested_mode = null; } @@ -188,11 +154,11 @@ } public DisplayMode init() { - return createLWJGLDisplayMode(getDevice().getDisplayMode()); + return createLWJGLDisplayMode(MacOSXFrame.getDevice().getDisplayMode()); } public DisplayMode[] getAvailableDisplayModes() { - java.awt.DisplayMode[] awt_modes = getDevice().getDisplayModes(); + java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); List modes = new ArrayList(); for (int i = 0; i < awt_modes.length; i++) if (awt_modes[i].getBitDepth() >= 16) @@ -203,7 +169,7 @@ } public void setTitle(String title) { - frame.setTitle(title); + frame.syncSetTitle(title); } public boolean isCloseRequested() { @@ -216,15 +182,15 @@ } public boolean isVisible() { - return frame.isShowing(); + return frame.syncIsVisible(); } public boolean isActive() { - return frame.isFocused(); + return frame.syncIsActive(); } public boolean isDirty() { - return canvas.isDirty(); + return frame.getCanvas().syncIsDirty(); } public native void setView(MacOSXGLCanvas canvas); @@ -238,10 +204,10 @@ public native void destroyContext(); public void update() { - if (canvas.shouldUpdateContext()) { + if (frame.syncShouldUpdateContext()) { updateContext(); /* This is necessary to make sure the context won't "forget" about the view size */ - GL11.glViewport(0, 0, canvas.getWidth(), canvas.getHeight()); + GL11.glViewport(0, 0, frame.getCanvas().syncGetWidth(), frame.getCanvas().syncGetHeight()); warpCursor(); } mouse_queue.updateDeltas(); @@ -249,7 +215,7 @@ private void warpCursor() { if (mouse_queue != null && mouse_queue.isGrabbed()) { - Rectangle bounds = frame.getBounds(); + Rectangle bounds = frame.syncGetBounds(); int x = bounds.x + bounds.width/2; int y = bounds.y + bounds.height/2; nWarpCursor(x, y); @@ -263,8 +229,7 @@ public native void setVSyncEnabled(boolean sync); public void reshape(int x, int y, int width, int height) { - Insets insets = frame.getInsets(); - frame.setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom); + frame.syncReshape(x, y, width, height); } /* Mouse */ @@ -277,6 +242,7 @@ } public void createMouse() { + MacOSXGLCanvas canvas = frame.getCanvas(); this.mouse_queue = new MouseEventQueue(canvas.getWidth(), canvas.getHeight()); canvas.addMouseListener(mouse_queue); canvas.addMouseMotionListener(mouse_queue); @@ -284,6 +250,7 @@ } public void destroyMouse() { + MacOSXGLCanvas canvas = frame.getCanvas(); canvas.removeMouseListener(mouse_queue); canvas.removeMouseWheelListener(mouse_queue); canvas.removeMouseMotionListener(mouse_queue); @@ -321,7 +288,7 @@ public void setNativeCursor(Object handle) throws LWJGLException { Cursor awt_cursor = (Cursor)handle; - canvas.setCursor(awt_cursor); + frame.syncSetCursor(awt_cursor); } public int getMinCursorSize() { @@ -336,6 +303,7 @@ /* Keyboard */ public void createKeyboard() throws LWJGLException { + MacOSXGLCanvas canvas = frame.getCanvas(); this.keyboard_queue = new KeyboardEventQueue(); canvas.addKeyListener(keyboard_queue); } @@ -345,7 +313,7 @@ * This line is commented out to work around AWT bug 4867453: * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4867453 */ -// canvas.removeKeyListener(keyboard_queue); +// frame.getCanvas().removeKeyListener(keyboard_queue); this.keyboard_queue = null; } Index: MacOSXGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXGLCanvas.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MacOSXGLCanvas.java 11 Nov 2004 16:03:15 -0000 1.1 +++ MacOSXGLCanvas.java 12 Nov 2004 13:23:20 -0000 1.2 @@ -39,22 +39,18 @@ import java.awt.Canvas; import java.awt.Dimension; import java.awt.Point; +import java.awt.Rectangle; import java.awt.Graphics; -import java.awt.event.HierarchyBoundsListener; -import java.awt.event.HierarchyEvent; +import java.awt.event.ComponentListener; +import java.awt.event.ComponentEvent; -final class MacOSXGLCanvas extends Canvas implements HierarchyBoundsListener { +final class MacOSXGLCanvas extends Canvas implements ComponentListener { + private int width; + private int height; private boolean context_update; private boolean canvas_created; private boolean dirty; - public MacOSXGLCanvas() { - setFocusTraversalKeysEnabled(false); - /* Input methods are not enabled in fullscreen anyway, so disable always */ - enableInputMethods(false); - addHierarchyBoundsListener(this); - } - public void update(Graphics g) { paint(g); } @@ -63,6 +59,10 @@ synchronized (this) { dirty = true; if (!canvas_created) { + setFocusTraversalKeysEnabled(false); + /* Input methods are not enabled in fullscreen anyway, so disable always */ + enableInputMethods(false); + addComponentListener(this); ((MacOSXDisplay)Display.getImplementation()).setView(this); canvas_created = true; setUpdate(); @@ -71,7 +71,7 @@ } } - public boolean isDirty() { + public boolean syncIsDirty() { boolean result; synchronized (this) { result = dirty; @@ -92,7 +92,7 @@ } } - public boolean shouldUpdateContext() { + public boolean syncShouldUpdateContext() { boolean should_update; synchronized (this) { should_update = context_update; @@ -102,14 +102,36 @@ } private synchronized void setUpdate() { - context_update = true; + synchronized (this) { + width = getWidth(); + height = getHeight(); + context_update = true; + } } - public void ancestorResized(HierarchyEvent e) { + public int syncGetWidth() { + synchronized (this) { + return width; + } + } + + public int syncGetHeight() { + synchronized (this) { + return height; + } + } + + public void componentShown(ComponentEvent e) { + } + + public void componentHidden(ComponentEvent e) { + } + + public void componentResized(ComponentEvent e) { setUpdate(); } - public void ancestorMoved(HierarchyEvent e) { + public void componentMoved(ComponentEvent e) { setUpdate(); } |
|
From: Elias N. <eli...@us...> - 2004-11-12 10:49:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22918/src/java/org/lwjgl/opengl Modified Files: MacOSXDisplay.java Log Message: Mac OS X default implementation of gamma and state keys Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MacOSXDisplay.java 12 Nov 2004 10:39:06 -0000 1.2 +++ MacOSXDisplay.java 12 Nov 2004 10:48:51 -0000 1.3 @@ -45,6 +45,7 @@ import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Mouse; +import org.lwjgl.input.Keyboard; import java.util.List; import java.util.ArrayList; @@ -133,8 +134,13 @@ canvas = null; } - public native int getGammaRampLength(); - public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; + public int getGammaRampLength() { + return 0; + } + + public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException { + throw new LWJGLException("Gamma not supported"); + } public String getAdapter() { return null; @@ -359,7 +365,9 @@ public void enableKeyboardBuffer() throws LWJGLException { } - public native int isStateKeySet(int key); + public int isStateKeySet(int key) { + return Keyboard.STATE_UNKNOWN; + } /** Native cursor handles */ public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { |
|
From: Elias N. <eli...@us...> - 2004-11-12 10:39:19
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20964/src/java/org/lwjgl/opengl Modified Files: MacOSXDisplay.java Log Message: Access Mac OS X java extensions through relfection to enable compilation on other platforms Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MacOSXDisplay.java 11 Nov 2004 16:03:15 -0000 1.1 +++ MacOSXDisplay.java 12 Nov 2004 10:39:06 -0000 1.2 @@ -62,11 +62,12 @@ import java.awt.image.BufferedImage; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import com.apple.eawt.Application; -import com.apple.eawt.ApplicationListener; -import com.apple.eawt.ApplicationEvent; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; -final class MacOSXDisplay extends WindowAdapter implements DisplayImplementation, ApplicationListener { +final class MacOSXDisplay extends WindowAdapter implements DisplayImplementation { private JFrame frame; private MacOSXGLCanvas canvas; private boolean close_requested; @@ -75,8 +76,7 @@ private java.awt.DisplayMode requested_mode; public MacOSXDisplay() { - Application.getApplication().addApplicationListener(this); -System.out.println("getMaxCursorSize = " + getMaxCursorSize()); + new MacOSXApplicationListener(); } public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { @@ -110,28 +110,6 @@ return device; } - public void handleAbout(ApplicationEvent event) { - } - - public void handleOpenApplication(ApplicationEvent event) { - } - - public void handleOpenFile(ApplicationEvent event) { - } - - public void handlePreferences(ApplicationEvent event) { - } - - public void handlePrintFile(ApplicationEvent event) { - } - - public void handleQuit(ApplicationEvent event) { - handleQuit(); - } - - public void handleReOpenApplication(ApplicationEvent event) { - } - private void handleQuit() { synchronized (this) { close_requested = true; @@ -396,4 +374,44 @@ public void destroyCursor(Object cursor_handle) { } + + /** + * This class captures com.apple.eawt.ApplicationEvents through reflection + * to enable compilation on other platforms than Mac OS X + */ + private class MacOSXApplicationListener implements InvocationHandler { + private final Method handleQuit; + + public MacOSXApplicationListener() { + try { + /* Get the com.apple.eawt.Application class */ + Class com_apple_eawt_Application = Class.forName("com.apple.eawt.Application"); + /* Call the static Application.getApplication() method */ + Object application = com_apple_eawt_Application.getMethod("getApplication", null).invoke(null, null); + /* Create a proxy implementing com.apple.eawt.ApplicationListener */ + Class com_apple_eawt_ApplicationListener = Class.forName("com.apple.eawt.ApplicationListener"); + Object listener_proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {com_apple_eawt_ApplicationListener}, this); + /* Invoke the method application.addApplicationListener(proxy) */ + Method addApplicationListener = com_apple_eawt_Application.getMethod("addApplicationListener", new Class[]{com_apple_eawt_ApplicationListener}); + addApplicationListener.invoke(application, new Object[]{listener_proxy}); + /* Finally, get the handleQuit method we want to react to */ + Class com_apple_eawt_ApplicationEvent = Class.forName("com.apple.eawt.ApplicationEvent"); + handleQuit = com_apple_eawt_ApplicationListener.getMethod("handleQuit", new Class[]{com_apple_eawt_ApplicationEvent}); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + public Object invoke(Object proxy, Method method, Object[] args) { + if (method.equals(handleQuit)) + handleQuit(); + return null; + } + } } |
|
From: Mark B. <cap...@us...> - 2004-11-12 03:37:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/devil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7843/src/java/org/lwjgl/test/devil Modified Files: BasicTest.java Log Message: Added more tests. Index: BasicTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/devil/BasicTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- BasicTest.java 23 Oct 2004 08:57:53 -0000 1.2 +++ BasicTest.java 12 Nov 2004 03:37:34 -0000 1.3 @@ -67,5 +67,7 @@ System.out.println("limit = " + limit); System.out.println("Version: " + IL.ilGetInteger(IL.IL_VERSION_NUM)); + System.out.println(IL.ilActiveImage(im.get(0))); + System.out.println(IL.ilClearImage()); } } |
|
From: Mark B. <cap...@us...> - 2004-11-12 02:54:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common/devil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31561/src/native/common/devil Modified Files: org_lwjgl_devil_IL.c Log Message: Full functionality from IL. Does not include Windows specific calls or anything that uses function pointers. Index: org_lwjgl_devil_IL.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/devil/org_lwjgl_devil_IL.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_devil_IL.c 23 Oct 2004 09:02:49 -0000 1.3 +++ org_lwjgl_devil_IL.c 12 Nov 2004 02:54:31 -0000 1.4 @@ -3,6 +3,63 @@ #include "org_lwjgl_devil_IL.h" #include "common_tools.h" +#ifdef __cplusplus +extern "C" { +/* + * Class: org_lwjgl_devil_IL + * Method: ilActiveImage + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilActiveImage(JNIEnv *env, jclass clazz, jint number) { + return ilActiveImage((ILuint)number); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilActiveLayer + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilActiveLayer(JNIEnv *env, jclass clazz, jint number) { + return ilActiveLayer((ILuint)number); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilActiveMipmap + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilActiveMipmap(JNIEnv *env, jclass clazz, jint number) { + return ilActiveMipmap((ILuint)number); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilApplyPal + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilApplyPal(JNIEnv *env, jclass clazz, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilApplyPal((const ILstring*)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilApplyProfile + * Signature: (Ljava/lang/String;Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilApplyProfile(JNIEnv *env, jclass clazz, jstring inProfile, jstring outProfile) { + const char *strInProfile = (*env)->GetStringUTFChars(env, inProfile, 0); + const char *strOutProfile = (*env)->GetStringUTFChars(env, outProfile, 0); + jboolean result = ilApplyProfile((const ILstring)strInProfile, (const ILstring)strOutProfile); + (*env)->ReleaseStringUTFChars(env, inProfile, strInProfile); + (*env)->ReleaseStringUTFChars(env, outProfile, strOutProfile); + + return result; +} + /* * Class: org_lwjgl_devil_IL * Method: ilBindImage @@ -12,6 +69,108 @@ ilBindImage(image); } + +/* + * Class: org_lwjgl_devil_IL + * Method: ilBlit + * Signature: (IIIIIIIIII)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilBlit(JNIEnv *env, jclass clazz, jint source, jint destX, jint destY, jint destZ, jint srcX, jint srcY, jint srcZ, jint width, jint height, jint depth) { + return ilBlit((ILuint)source, (ILint)destX, (ILint)destY, (ILint)destZ, (ILuint)srcX, (ILuint)srcY, (ILuint)srcZ, (ILuint)width, (ILuint)height, (ILuint)depth); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilClearColour + * Signature: (FFFF)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilClearColour(JNIEnv *env, jclass clazz, jfloat red, jfloat green, jfloat blue, jfloat alpha) { + ilClearColour((ILclampf)red, (ILclampf)green, (ILclampf)blue, (ILclampf)alpha); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilClearImage + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilClearImage(JNIEnv *env, jclass clazz) { + return ilClearImage(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilCloneCurImage + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_devil_IL_ilCloneCurImage(JNIEnv *env, jclass clazz) { + return ilCloneCurImage(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilCompressFunc + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilCompressFunc(JNIEnv *env, jclass clazz, jint mode) { + return ilCompressFunc((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilConvertImage + * Signature: (II)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilConvertImage(JNIEnv *env, jclass clazz, jint destFormat, jint destType) { + return ilConvertImage((ILenum)destFormat, (ILenum)destType); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilConvertPal + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilConvertPal(JNIEnv *env, jclass clazz, jint destFormat) { + return ilConvertPal((ILenum)destFormat); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilCopyImage + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilCopyImage(JNIEnv *env, jclass clazz, jint src) { + return ilCopyImage((ILuint)src); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilCopyPixels + * Signature: (IIIIIIIILjava/nio/ByteBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_devil_IL_nilCopyPixels(JNIEnv *env, jclass clazz, jint xOff, jint yOff, jint zOff, jint width, jint height, jint depth, jint format, jint type, jobject data_buffer, jint data_offset) { + ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); + + return ilCopyPixels((ILuint)xOff, (ILuint)yOff, (ILuint)zOff, (ILuint)width, (ILuint)height, (ILuint)depth, (ILenum)format, (ILenum)type, (ILvoid *)(data + data_offset)); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilCreateSubImage + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_devil_IL_ilCreateSubImage(JNIEnv *env, jclass clazz, jint type, jint num) { + return ilCreateSubImage((ILenum)type, (ILuint)num); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilDefaultImage + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilDefaultImage(JNIEnv *env, jclass clazz) { + return ilDefaultImage(); +} + /* * Class: org_lwjgl_devil_IL * Method: ilDeleteImages @@ -22,6 +181,34 @@ ilDeleteImages((ILsizei)num, (ILuint *)lists); } + +/* + * Class: org_lwjgl_devil_IL + * Method: ilDisable + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilDisable(JNIEnv *env, jclass clazz, jint mode) { + return ilDisable((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilEnable + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilEnable(JNIEnv *env, jclass clazz, jint mode) { + return ilEnable((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilFormatFunc + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilFormatFunc(JNIEnv *env, jclass clazz, jint mode) { + return ilFormatFunc((ILenum)mode); +} + /* * Class: org_lwjgl_devil_IL * Method: ilGenImages @@ -32,19 +219,58 @@ ilGenImages((ILsizei)num, (ILuint *)lists); } + +/* + * Class: org_lwjgl_devil_IL + * Method: ilGetAlpha + * Signature: (I)[B + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_devil_IL_ilGetAlpha(JNIEnv *env, jclass clazz, jint type) { + ILubyte *alpha = ilGetAlpha((ILenum)type); + + int size = sizeof(alpha); + jobject result = safeNewBuffer(env, alpha, size); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilModAlpha + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilModAlpha(JNIEnv *env, jclass clazz, jint alphaValue) { + ilModAlpha((ILint)alphaValue); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSetAlpha + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilSetAlpha(JNIEnv *env, jclass clazz, jint alphaValue) { + ilSetAlpha((ILuint)alphaValue); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilGetBoolean + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilGetBoolean(JNIEnv *env, jclass clazz, jint mode) { + return ilGetBoolean((ILenum)mode); +} + /* * Class: org_lwjgl_devil_IL * Method: ilGetData * Signature: ()[B */ JNIEXPORT jobject JNICALL Java_org_lwjgl_devil_IL_ilGetData(JNIEnv * env, jclass clazz) { - int size; - jobject result; - ILubyte *data = ilGetData(); - size = ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL); - result = safeNewBuffer(env, data, size); + int size = sizeof(data); + jobject result = safeNewBuffer(env, data, size); return result; } @@ -67,6 +293,48 @@ return ilGetInteger((ILenum)mode); } + +/* + * Class: org_lwjgl_devil_IL + * Method: ilGetLumpPos + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_devil_IL_ilGetLumpPos(JNIEnv *env, jclass clazz) { + return ilGetLumpPos(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilGetPalette + * Signature: ()[B + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_devil_IL_ilGetPalette(JNIEnv *env, jclass clazz) { + ILubyte *pal = ilGetPalette(); + + int size = sizeof(pal); + jobject result = safeNewBuffer(env, pal, size); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilGetString + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_lwjgl_devil_IL_ilGetString(JNIEnv *env, jclass clazz, jint stringName) { + return (*env)->NewStringUTF(env, ilGetString((ILenum)stringName)); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilHint + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilHint(JNIEnv *env, jclass clazz, jint target, jint mode) { + ilHint((ILenum)target, (ILenum)mode); +} + /* * Class: org_lwjgl_devil_IL * Method: ilInit @@ -78,15 +346,376 @@ /* * Class: org_lwjgl_devil_IL + * Method: ilIsDisabled + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsDisabled(JNIEnv *env, jclass clazz, jint mode) { + return ilIsDisabled((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilIsEnabled + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsEnabled(JNIEnv *env, jclass clazz, jint mode) { + return ilIsEnabled((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilIsImage + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsImage(JNIEnv *env, jclass clazz, jint image) { + return ilIsImage((ILuint)image); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilIsValid + * Signature: (ILjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsValid(JNIEnv *env, jclass clazz, jint type, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilIsValid((ILuint)type, (const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilIsValidL + * Signature: (ILjava/nio/ByteBuffer;II)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_nilIsValidL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { + ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); + + return ilIsValidL((ILenum)type, (ILvoid *)(lump + lump_offset), (ILuint)size); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilKeyColour + * Signature: (FFFF)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilKeyColour(JNIEnv *env, jclass clazz, jfloat red, jfloat green, jfloat blue, jfloat alpha) { + ilKeyColour((ILclampf)red, (ILclampf)green, (ILclampf)blue, (ILclampf)alpha); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilLoad + * Signature: (ILjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoad(JNIEnv *env, jclass clazz, jint type, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilLoad((ILenum)type, (const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL * Method: ilLoadImage * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadImage(JNIEnv *env, jclass clazz, jstring fileName) { - const char *str = (*env)->GetStringUTFChars(env, fileName, 0); - jboolean result = ilLoadImage((char *)str); - (*env)->ReleaseStringUTFChars(env, fileName, str); + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilLoadImage((const ILstring*)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + + +/* + * Class: org_lwjgl_devil_IL + * Method: nilLoadL + * Signature: (ILjava/nio/ByteBuffer;II)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_nilLoadL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { + ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); + + return ilLoadL((ILenum)type, (ILvoid *)(lump + lump_offset), (ILuint)size); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilLoadPal + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadPal(JNIEnv *env, jclass clazz, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilLoadPal((const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilOriginFunc + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilOriginFunc(JNIEnv *env, jclass clazz, jint mode) { + return ilOriginFunc((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilOverlayImage + * Signature: (IIII)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilOverlayImage(JNIEnv *env, jclass clazz, jint source, jint xCoord, jint yCoord, jint zCoord) { + return ilOverlayImage((ILuint)source, (ILint)xCoord, (ILint)yCoord, (ILint)zCoord); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilPopAttrib + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilPopAttrib(JNIEnv *env, jclass clazz) { + ilPopAttrib(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilPushAttrib + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilPushAttrib(JNIEnv *env, jclass clazz, jint bits) { + ilPushAttrib((ILuint)bits); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilRemoveLoad + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilRemoveLoad(JNIEnv *env, jclass clazz, jstring ext) { + const char *strExt = (*env)->GetStringUTFChars(env, ext, 0); + jboolean result = ilRemoveLoad((const ILstring)strExt); + (*env)->ReleaseStringUTFChars(env, fileName, strExt); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilRemoveSave + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilRemoveSave(JNIEnv *env, jclass clazz, jstring ext) { + const char *strExt = (*env)->GetStringUTFChars(env, ext, 0); + jboolean result = ilRemoveSave((const ILstring)strExt); + (*env)->ReleaseStringUTFChars(env, fileName, strExt); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilResetMemory + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilResetMemory(JNIEnv *env, jclass clazz) { + ilResetMemory(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilResetRead + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilResetRead(JNIEnv *env, jclass clazz) { + ilResetRead(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilResetWrite + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilResetWrite(JNIEnv *env, jclass clazz) { + ilResetWrite(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSave + * Signature: (ILjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilSave(JNIEnv *env, jclass clazz, jint type, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilSave((ILenum)type, (const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSaveImage + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilSaveImage(JNIEnv *env, jclass clazz, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilSaveImage((const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilSaveL + * Signature: (ILjava/nio/ByteBuffer;II)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_devil_IL_nilSaveL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { + ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); + + return ilSaveL((ILenum)type, (ILvoid *)(lump + lump_offset), (ILuint)size); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSavePal + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilSavePal(JNIEnv *env, jclass clazz, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilSavePal((const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilSetData + * Signature: (Ljava/nio/ByteBuffer;I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_nilSetData(JNIEnv *env, jclass clazz, jobject data_buffer, jint data_offset) { + ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); + + return ilSetData((ILvoid *)(data + data_offset)); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSetDuration + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilSetDuration(JNIEnv *env, jclass clazz, jint duration) { + return ilSetDuration((ILuint)duration); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSetInteger + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilSetInteger(JNIEnv *env, jclass clazz, jint mode, jint param) { + ilSetInteger((ILenum)mode, (ILint)param); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilSetPixels + * Signature: (IIIIIIIILjava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_nilSetPixels(JNIEnv *env, jclass clazz, jint xOff, jint yOff, jint zOff, jint width, jint height, jint depth, jint format, jint type, jobject data_buffer, jint data_offset) { + ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); + + ilSetPixels((ILint)xOff, (ILint)yOff, (ILint)zOff, (ILuint)width, (ILuint)height, (ILuint)depth, (ILenum)format, (ILenum)type, (ILvoid *)(data + data_offset)); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSetString + * Signature: (ILjava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilSetString(JNIEnv *env, jclass clazz, jint mode, jstring string) { + const char *strString = (*env)->GetStringUTFChars(env, string, 0); + + ilSetString(mode, (const ILstring)strString); + (*env)->ReleaseStringUTFChars(env, string, strString); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilShutDown + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_ilShutDown(JNIEnv *env, jclass clazz) { + ilShutDown(); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilTexImage + * Signature: (IIIBIILjava/nio/ByteBuffer;I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_nilTexImage(JNIEnv *env, jclass clazz, jint width, jint height, jint depth , jbyte bpp, jint format, jint type, jobject data_buffer, jint data_offset) { + ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); + + return ilTexImage((ILuint)width, (ILuint)height, (ILuint)depth , (ILubyte)bpp, (ILenum)format, (ILenum)type, (ILvoid *)(data + data_offset)); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilTypeFunc + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilTypeFunc(JNIEnv *env, jclass clazz, jint mode) { + return ilTypeFunc((ILenum)mode); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilLoadData + * Signature: (Ljava/lang/String;IIIB)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadData(JNIEnv *env, jclass clazz, jstring fileName, jint width, jint height, jint depth, jbyte bpp) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilLoadData((const ILstring)strFileName, (ILuint)width, (ILuint)height, (ILuint)depth, (ILubyte)bpp); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + + return result; +} + +/* + * Class: org_lwjgl_devil_IL + * Method: nilLoadDataL + * Signature: (Ljava/nio/ByteBuffer;IIIIIB)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_nilLoadDataL(JNIEnv *env, jclass clazz, jobject lump_buffer, jint lump_offset, jint size, jint width, jint height, jint depth, jbyte bpp) { + ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); + + return ilLoadDataL((ILvoid *)(lump + lump_offset), (ILuint)size, (ILuint)width, (ILuint)height, (ILuint)depth, (ILubyte)bpp); +} + +/* + * Class: org_lwjgl_devil_IL + * Method: ilSaveData + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilSaveData(JNIEnv *env, jclass clazz, jstring fileName) { + const char *strFileName = (*env)->GetStringUTFChars(env, fileName, 0); + jboolean result = ilSaveData((const ILstring)strFileName); + (*env)->ReleaseStringUTFChars(env, fileName, strFileName); + return result; } JNIEXPORT void JNICALL Java_org_lwjgl_devil_IL_initNativeStubs(JNIEnv *env, jclass clazz) { } + +#ifdef __cplusplus +} +#endif +#endif |
|
From: Mark B. <cap...@us...> - 2004-11-12 02:40:51
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28686/src/java/org/lwjgl/devil Modified Files: IL.java Log Message: Full functionality from IL. Does not include Windows specific calls or anything that uses function pointers. Index: IL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/IL.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- IL.java 23 Oct 2004 08:55:27 -0000 1.2 +++ IL.java 12 Nov 2004 02:40:41 -0000 1.3 @@ -36,7 +36,6 @@ import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; - /** * $Id$ * @@ -297,7 +296,7 @@ public static final int IL_EOF = -1; static { - System.loadLibrary("DevIL"); + System.loadLibrary("DevIL"); System.loadLibrary("lwjgl-devil"); } @@ -310,96 +309,142 @@ public static native void initNativeStubs() throws LWJGLException; -// public static native boolean ilActiveImage(ILuint Number); -// public static native boolean ilActiveLayer(ILuint Number); -// public static native boolean ilActiveMipmap(ILuint Number); -// public static native boolean ilApplyPal(const ILstring FileName); -// public static native boolean ilApplyProfile(const ILstring InProfile, const ILstring OutProfile); + public static native boolean ilActiveImage(int Number); + public static native boolean ilActiveLayer(int Number); + public static native boolean ilActiveMipmap(int Number); + public static native boolean ilApplyPal(String FileName); + public static native boolean ilApplyProfile(String InProfile, String OutProfile); public static native void ilBindImage(int image); -// public static native boolean ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth); -// public static native void ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); -// public static native boolean ilClearImage(ILvoid); -// public static native int ilCloneCurImage(ILvoid); -// public static native boolean ilCompressFunc(ILenum Mode); -// public static native boolean ilConvertImage(ILenum DestFormat, ILenum DestType); -// public static native boolean ilConvertPal(ILenum DestFormat); -// public static native boolean ilCopyImage(ILuint Src); -// public static native int ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data); -// public static native int ilCreateSubImage(ILenum Type, ILuint Num); -// public static native boolean ilDefaultImage(ILvoid); + public static native boolean ilBlit(int Source, int DestX, int DestY, int DestZ, int SrcX, int SrcY, int SrcZ, int Width, int Height, int Depth); + public static native void ilClearColour(float Red, float Green, float Blue, float Alpha); + public static native boolean ilClearImage(); + public static native int ilCloneCurImage(); + public static native boolean ilCompressFunc(int Mode); + public static native boolean ilConvertImage(int DestFormat, int DestType); + public static native boolean ilConvertPal(int DestFormat); + public static native boolean ilCopyImage(int Src); + public static int ilCopyPixels(int XOff, int YOff, int ZOff, int Width, int Height, int Depth, int Format, int Type, ByteBuffer Data) { + BufferChecks.checkDirect(Data); + return nilCopyPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, Data, Data.position()); + } + public static native int nilCopyPixels(int XOff, int YOff, int ZOff, int Width, int Height, int Depth, int Format, int Type, ByteBuffer Data, int data_offset); + public static native int ilCreateSubImage(int Type, int Num); + public static native boolean ilDefaultImage(); public static void ilDeleteImages(int num, IntBuffer images) { BufferChecks.checkDirect(images); - nilGenImages(num, images, images.position()); + nilDeleteImages(num, images, images.position()); } public static native void nilDeleteImages(int num, IntBuffer images, int images_offset); -// public static native boolean ilDisable(ILenum Mode); -// public static native boolean ilEnable(ILenum Mode); -// public static native boolean ilFormatFunc(ILenum Mode); + public static native boolean ilDisable(int Mode); + public static native boolean ilEnable(int Mode); + public static native boolean ilFormatFunc(int Mode); public static void ilGenImages(int num, IntBuffer images) { BufferChecks.checkDirect(images); nilGenImages(num, images, images.position()); } public static native void nilGenImages(int num, IntBuffer images, int images_offset); -// public static native byte[] ilGetAlpha(ILenum Type);//ILubyte* -// public static native void ilModAlpha( ILint AlphaValue ); -// public static native void ilSetAlpha( ILuint AlphaValue ); -// public static native boolean ilGetBoolean(ILenum Mode); -// public static native void ilGetBooleanv(ILenum Mode, ILboolean *Param); + public static native ByteBuffer ilGetAlpha(int Type);//ILubyte* + public static native void ilModAlpha( int AlphaValue ); + public static native void ilSetAlpha( int AlphaValue ); + public static native boolean ilGetBoolean(int Mode); +// public static native void ilGetBooleanv(int Mode, boolean *Param); public static native ByteBuffer ilGetData(); -// public static native int ilGetDXTCData(ILvoid *Buffer, ILuint BufferSize, ILenum DXTCFormat); +// public static native int ilGetDXTCData(ILvoid *Buffer, int BufferSize, int DXTCFormat); public static native int ilGetError(); public static native int ilGetInteger(int mode); -// public static native void ilGetIntegerv(ILenum Mode, ILint *Param); -// public static native int ilGetLumpPos(ILvoid); -// public static native byte[] ilGetPalette(ILvoid);//ILubyte* -// public static native String ilGetString(ILenum StringName);//const ILstring -// public static native void ilHint(ILenum Target, ILenum Mode); +// public static native void ilGetIntegerv(int Mode, int *Param); + public static native int ilGetLumpPos(); + public static native ByteBuffer ilGetPalette();//ILubyte* + public static native String ilGetString(int StringName);//String + public static native void ilHint(int Target, int Mode); public static native void ilInit(); -// public static native boolean ilIsDisabled(ILenum Mode); -// public static native boolean ilIsEnabled(ILenum Mode); -// public static native boolean ilIsImage(ILuint Image); -// public static native boolean ilIsValid(ILenum Type, const ILstring FileName); -// public static native boolean ilIsValidF(ILenum Type, ILHANDLE File); -// public static native boolean ilIsValidL(ILenum Type, ILvoid *Lump, ILuint Size); -// public static native void ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); -// public static native boolean ilLoad(ILenum Type, const ILstring FileName); -// public static native boolean ilLoadF(ILenum Type, ILHANDLE File); + public static native boolean ilIsDisabled(int Mode); + public static native boolean ilIsEnabled(int Mode); + public static native boolean ilIsImage(int Image); + public static native boolean ilIsValid(int Type, String FileName); + //ilIsValidF() uses a Windows file handle so will not be implemented +// public static native boolean ilIsValidF(int Type, ILHANDLE File); + public static boolean ilIsValidL(int Type, ByteBuffer Lump, int Size) { + BufferChecks.checkDirect(Lump); + return nilIsValidL(Type, Lump, Lump.position(), Size); + } + public static native boolean nilIsValidL(int Type, ByteBuffer Lump, int lump_offset, int Size); + public static native void ilKeyColour(float Red, float Green, float Blue, float Alpha); + public static native boolean ilLoad(int Type, String FileName); + //ilLoadF() uses a Windows file handle so will not be implemented +// public static native boolean ilLoadF(int Type, ILHANDLE File); public static native boolean ilLoadImage(String fileName); -// public static native boolean ilLoadL(ILenum Type, ILvoid *Lump, ILuint Size); -// public static native boolean ilLoadPal(const ILstring FileName); -// public static native boolean ilOriginFunc(ILenum Mode); -// public static native boolean ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord); -// public static native void ilPopAttrib(ILvoid); -// public static native void ilPushAttrib(ILuint Bits); -// public static native void ilRegisterFormat(ILenum Format); -// public static native boolean ilRegisterLoad(const ILstring Ext, IL_LOADPROC Load); -// public static native boolean ilRegisterMipNum(ILuint Num); -// public static native boolean ilRegisterNumImages(ILuint Num); -// public static native void ilRegisterOrigin(ILenum Origin); -// public static native void ilRegisterPal(ILvoid *Pal, ILuint Size, ILenum Type); -// public static native boolean ilRegisterSave(const ILstring Ext, IL_SAVEPROC Save); -// public static native void ilRegisterType(ILenum Type); -// public static native boolean ilRemoveLoad(const ILstring Ext); -// public static native boolean ilRemoveSave(const ILstring Ext); -// public static native void ilResetMemory(ILvoid); -// public static native void ilResetRead(ILvoid); -// public static native void ilResetWrite(ILvoid); -// public static native boolean ilSave(ILenum Type, const ILstring FileName); -// public static native int ilSaveF(ILenum Type, ILHANDLE File); -// public static native boolean ilSaveImage(const ILstring FileName); -// public static native int ilSaveL(ILenum Type, ILvoid *Lump, ILuint Size); -// public static native boolean ilSavePal(const ILstring FileName); -// public static native boolean ilSetData(ILvoid *Data); -// public static native boolean ilSetDuration(ILuint Duration); -// public static native void ilSetInteger(ILenum Mode, ILint Param); + public static boolean ilLoadL(int Type, ByteBuffer Lump, int Size) { + BufferChecks.checkDirect(Lump); + return nilIsValidL(Type, Lump, Lump.position(), Size); + } + public static native boolean nilLoadL(int Type, ByteBuffer Lump, int lump_offset, int Size); + public static native boolean ilLoadPal(String FileName); + public static native boolean ilOriginFunc(int Mode); + public static native boolean ilOverlayImage(int Source, int XCoord, int YCoord, int ZCoord); + public static native void ilPopAttrib(); + public static native void ilPushAttrib(int Bits); +// public static native void ilRegisterFormat(int Format); +// public static native boolean ilRegisterLoad(String Ext, IL_LOADPROC Load); +// public static native boolean ilRegisterMipNum(int Num); +// public static native boolean ilRegisterNumImages(int Num); +// public static native void ilRegisterOrigin(int Origin); +// public static void ilRegisterPal(ByteBuffer Pal, int Size, int Type) { +// BufferChecks.checkDirect(Pal); +// nilRegisterPal(Pal, Pal.position(), Size, Type); +// } +// public static native void nilRegisterPal(ByteBuffer Pal, int pal_position, int Size, int Type); +// public static native boolean ilRegisterSave(String Ext, IL_SAVEPROC Save); +// public static native void ilRegisterType(int Type); + public static native boolean ilRemoveLoad(String Ext); + public static native boolean ilRemoveSave(String Ext); + public static native void ilResetMemory(); + public static native void ilResetRead(); + public static native void ilResetWrite(); + public static native boolean ilSave(int Type, String FileName); + //ilSaveF() uses a Windows file handle so will not be implemented +// public static native int ilSaveF(int Type, ILHANDLE File); + public static native boolean ilSaveImage(String FileName); + public static int ilSaveL(int Type, ByteBuffer Lump, int Size) { + BufferChecks.checkDirect(Lump); + return nilSaveL(Type, Lump, Lump.position(), Size); + } + public static native int nilSaveL(int Type, ByteBuffer Lump, int lump_offset, int Size); + public static native boolean ilSavePal(String FileName); + public static boolean ilSetData(ByteBuffer Data) { + BufferChecks.checkDirect(Data); + return nilSetData(Data, Data.position()); + } + public static native boolean nilSetData(ByteBuffer Data, int data_offset); + public static native boolean ilSetDuration(int Duration); + public static native void ilSetInteger(int Mode, int Param); // public static native void ilSetMemory(mAlloc, mFree); -// public static native void ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data); + public static void ilSetPixels(int XOff, int YOff, int ZOff, int Width, int Height, int Depth, int Format, int Type, ByteBuffer Data) { + BufferChecks.checkDirect(Data); + nilSetPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, Data, Data.position()); + } + public static native void nilSetPixels(int XOff, int YOff, int ZOff, int Width, int Height, int Depth, int Format, int Type, ByteBuffer Data, int data_offset); // public static native void ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc); -// public static native void ilSetString(ILenum Mode, const char *String); + public static native void ilSetString(int Mode, String string); // public static native void ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc); -// public static native void ilShutDown(ILvoid); -// public static native boolean ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, ILvoid *Data); -// public static native boolean ilTypeFunc(ILenum Mode); + public static native void ilShutDown(); + public static boolean ilTexImage(int Width, int Height, int Depth, byte Bpp, int Format, int Type, ByteBuffer Data) { + BufferChecks.checkDirect(Data); + return nilTexImage(Width, Height, Depth, Bpp, Format, Type, Data, Data.position()); + } + public static native boolean nilTexImage(int Width, int Height, int Depth, byte Bpp, int Format, int Type, ByteBuffer Data, int data_offset); + public static native boolean ilTypeFunc(int Mode); + public static native boolean ilLoadData(String FileName, int Width, int Height, int Depth, byte Bpp); +// public static native boolean ilLoadDataF(ILHANDLE File, int Width, int Height, int Depth, ILubyte Bpp); + public static boolean ilLoadDataL(ByteBuffer Lump, int Size, int Width, int Height, int Depth, byte Bpp) { + BufferChecks.checkDirect(Lump); + return nilLoadDataL(Lump, Lump.position(), Size, Width, Height, Depth, Bpp); + } + public static native boolean nilLoadDataL(ByteBuffer Lump, int lump_offset, int Size, int Width, int Height, int Depth, byte Bpp); + public static native boolean ilSaveData(String FileName); + +// public static native boolean ilLoadFromJpegStruct(ILvoid* JpegDecompressorPtr); +// public static native boolean ilSaveFromJpegStruct(ILvoid* JpegCompressorPtr); /** * @@ -407,16 +452,8 @@ public static void create() throws LWJGLException { if (!created) { IL.initNativeStubs(); - IL.ilInit(); + IL.ilInit(); created = true; } } - -// public static native boolean ilLoadData(const ILstring FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); -// public static native boolean ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); -// public static native boolean ilLoadDataL(ILvoid *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); -// public static native boolean ilSaveData(const ILstring FileName); - -// public static native boolean ilLoadFromJpegStruct(ILvoid* JpegDecompressorPtr); -// public static native boolean ilSaveFromJpegStruct(ILvoid* JpegCompressorPtr); } |