mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-01 14:19:12 -06:00
Merge
This commit is contained in:
commit
21cfe0515a
110 changed files with 1490 additions and 780 deletions
|
|
@ -20,6 +20,7 @@ jar {
|
|||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
}
|
||||
exclude 'net/java/openjdk/cacio/ctc/**'
|
||||
}
|
||||
|
||||
java {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
package net.java.openjdk.cacio.ctc;
|
||||
|
||||
public interface ExternalMouseReader {
|
||||
int getX();
|
||||
int getY();
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package net.java.openjdk.cacio.ctc;
|
||||
|
||||
public class InfdevGrabHandler {
|
||||
public static void setMouseReader(ExternalMouseReader reader) {
|
||||
|
||||
}
|
||||
public static void setGrabbed(boolean grabbed) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import javax.annotation.*;
|
|||
import org.lwjgl.*;
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
|
@ -1370,4 +1371,10 @@ public class GLFW
|
|||
xpos[0] = mGLFWCursorX;
|
||||
ypos[0] = mGLFWCursorY;
|
||||
}
|
||||
|
||||
public static boolean glfwExtensionSupported(String ext) {
|
||||
//return Arrays.stream(glGetString(GL_EXTENSIONS).split(" ")).anyMatch(ext::equals);
|
||||
// Fast path, but will return true if one has the same prefix
|
||||
return glGetString(GL_EXTENSIONS).contains(ext);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ public class Cursor {
|
|||
/** Flag set when the cursor has been destroyed */
|
||||
private boolean destroyed;
|
||||
|
||||
/** Flag set if the cursor is empty */
|
||||
private boolean isEmpty;
|
||||
|
||||
/**
|
||||
* Constructs a new Cursor, with the given parameters. Mouse must have been
|
||||
* created before you can create Cursor objects. Cursor images are in ARGB
|
||||
|
|
@ -59,14 +62,19 @@ public class Cursor {
|
|||
*/
|
||||
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays)
|
||||
throws LWJGLException {
|
||||
|
||||
cursors = new CursorElement[numImages];
|
||||
|
||||
IntBuffer flippedImages = BufferUtils.createIntBuffer(images.limit());
|
||||
flipImages(width, height, numImages, images, flippedImages);
|
||||
|
||||
ByteBuffer pixels = convertARGBIntBuffertoRGBAByteBuffer(width, height, flippedImages);
|
||||
|
||||
if(numImages == 1) {
|
||||
isEmpty = true;
|
||||
for(int i = 0; i < width*height; i++) if(pixels.get(i) != 0) {
|
||||
System.out.println("Encountered non-zero byte at "+i+", custom cursor is not empty!");
|
||||
isEmpty = false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numImages; i++) {
|
||||
int size = width * height;
|
||||
ByteBuffer image = BufferUtils.createByteBuffer(size);
|
||||
|
|
@ -248,6 +256,14 @@ public class Cursor {
|
|||
index = ++index % cursors.length;
|
||||
}
|
||||
|
||||
/**
|
||||
/* Returns wheteher the cursor image is empty or not
|
||||
*/
|
||||
|
||||
/*package-private*/ boolean isEmpty() {
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single cursor element, used when animating
|
||||
*/
|
||||
|
|
@ -266,5 +282,4 @@ public class Cursor {
|
|||
throw new RuntimeException("Error creating GLFW cursor");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package org.lwjgl.input;
|
||||
|
||||
import net.java.openjdk.cacio.ctc.ExternalMouseReader;
|
||||
import net.java.openjdk.cacio.ctc.InfdevGrabHandler;
|
||||
|
||||
public class InfdevMouse implements ExternalMouseReader, Mouse.EmptyCursorGrabListener {
|
||||
static {
|
||||
InfdevGrabHandler.setMouseReader(new InfdevMouse());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return Mouse.getAbsoluteX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
return Mouse.getAbsoluteY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGrab(boolean grabbing) {
|
||||
InfdevGrabHandler.setGrabbed(grabbing);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.input;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.security.AccessController;
|
||||
|
|
@ -144,6 +145,7 @@ public class Mouse {
|
|||
private static boolean isGrabbed;
|
||||
|
||||
private static InputImplementation implementation;
|
||||
private static EmptyCursorGrabListener grabListener = null;
|
||||
|
||||
/** Whether we need cursor animation emulation */
|
||||
private static final boolean emulateCursorAnimation = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS ||
|
||||
|
|
@ -151,6 +153,16 @@ public class Mouse {
|
|||
|
||||
private static boolean clipMouseCoordinatesToWindow = !getPrivilegedBoolean("org.lwjgl.input.Mouse.allowNegativeMouseCoords");
|
||||
|
||||
static {
|
||||
try {
|
||||
Class infdevMouse = Class.forName("org.lwjgl.input.InfdevMouse");
|
||||
Constructor constructor = infdevMouse.getConstructor();
|
||||
grabListener = (EmptyCursorGrabListener) constructor.newInstance();
|
||||
}catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouse cannot be constructed.
|
||||
*/
|
||||
|
|
@ -164,7 +176,6 @@ public class Mouse {
|
|||
*/
|
||||
public static Cursor getNativeCursor() {
|
||||
return currentCursor;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -181,6 +192,14 @@ public class Mouse {
|
|||
*/
|
||||
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
|
||||
//dummy
|
||||
if(cursor == null && currentCursor.isEmpty()) {
|
||||
Mouse.setGrabbed(false);
|
||||
if(grabListener != null) grabListener.onGrab(false);
|
||||
}
|
||||
if(cursor != null && cursor.isEmpty()) {
|
||||
Mouse.setGrabbed(true);
|
||||
if(grabListener != null) grabListener.onGrab(true);
|
||||
}
|
||||
currentCursor = cursor;
|
||||
return currentCursor;
|
||||
}
|
||||
|
|
@ -625,4 +644,18 @@ public class Mouse {
|
|||
public static boolean isInsideWindow() {
|
||||
return implementation.isInsideWindow();
|
||||
}
|
||||
|
||||
/*
|
||||
* Package private methods to get the absolute unclipped X/Y coordiates
|
||||
*/
|
||||
/*package-private*/ static int getAbsoluteX() {
|
||||
return absolute_x;
|
||||
}
|
||||
/*package-private*/ static int getAbsoluteY() {
|
||||
return absolute_y;
|
||||
}
|
||||
|
||||
interface EmptyCursorGrabListener {
|
||||
void onGrab(boolean grabbing);
|
||||
}
|
||||
}
|
||||
|
|
@ -79,7 +79,8 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
|
|||
}
|
||||
|
||||
public AWTGLCanvas() throws LWJGLException {
|
||||
Display.create();
|
||||
System.out.println("AWTGLCanvas constructor called on thread:"+Thread.currentThread().getName());
|
||||
//Display.create();
|
||||
}
|
||||
|
||||
public AWTGLCanvas(PixelFormat pixel_format) throws LWJGLException {
|
||||
|
|
@ -177,27 +178,27 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
|
|||
}
|
||||
|
||||
public void setLocation(int x, int y) {
|
||||
|
||||
super.setLocation(x, y);
|
||||
}
|
||||
|
||||
public void setLocation(Point p) {
|
||||
|
||||
super.setLocation(p);
|
||||
}
|
||||
|
||||
public void setSize(Dimension d) {
|
||||
|
||||
super.setSize(d);
|
||||
}
|
||||
|
||||
public void setSize(int width, int height) {
|
||||
|
||||
super.setSize(width, height);
|
||||
}
|
||||
|
||||
public void setBounds(int x, int y, int width, int height) {
|
||||
|
||||
super.setBounds(x, y, width, height);
|
||||
}
|
||||
|
||||
public void hierarchyChanged(HierarchyEvent e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class Display {
|
|||
|
||||
mode = desktopDisplayMode = new DisplayMode(monitorWidth, monitorHeight, monitorBitPerPixel, monitorRefreshRate);
|
||||
LWJGLUtil.log("Initial mode: " + desktopDisplayMode);
|
||||
if("opengles2".equals(System.getenv("POJAV_RENDERER"))) GLContext.initCapabilities();
|
||||
}
|
||||
|
||||
public static void setSwapInterval(int value) {
|
||||
|
|
@ -416,7 +417,7 @@ public class Display {
|
|||
|
||||
//glfwSwapInterval(0);
|
||||
glfwShowWindow(Window.handle);
|
||||
|
||||
if(parent != null) parent.setSize(displayWidth, displayHeight);
|
||||
Mouse.create();
|
||||
Keyboard.create();
|
||||
|
||||
|
|
@ -953,7 +954,7 @@ public class Display {
|
|||
}
|
||||
|
||||
public static void setResizable(boolean resizable) {
|
||||
displayResizable = resizable;
|
||||
//displayResizable = resizable;
|
||||
if (displayResizable ^ resizable) {
|
||||
if (Window.handle != 0) {
|
||||
IntBuffer width = BufferUtils.createIntBuffer(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue