Initial bindings for LWJGL on Java
This commit is contained in:
@@ -10,6 +10,9 @@ import lime.ui.*;
|
||||
import js.Browser;
|
||||
#elseif flash
|
||||
import flash.Lib;
|
||||
#elseif java
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.system.glfw.GLFW;
|
||||
#end
|
||||
|
||||
|
||||
@@ -87,6 +90,8 @@ class Application extends Module {
|
||||
|
||||
#if (cpp || neko || nodejs)
|
||||
__handle = lime_application_create (null);
|
||||
#elseif java
|
||||
GLFW.glfwInit ();
|
||||
#end
|
||||
|
||||
KeyEventManager.create ();
|
||||
@@ -220,6 +225,21 @@ class Application extends Module {
|
||||
|
||||
Lib.current.stage.addEventListener (flash.events.Event.ENTER_FRAME, __triggerFrame);
|
||||
|
||||
#elseif java
|
||||
|
||||
if (window != null) {
|
||||
|
||||
while (GLFW.glfwWindowShouldClose (window.handle) == GL11.GL_FALSE) {
|
||||
|
||||
__triggerFrame ();
|
||||
|
||||
GLFW.glfwSwapBuffers (window.handle);
|
||||
GLFW.glfwPollEvents ();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -12,6 +12,9 @@ import lime.ui.Window;
|
||||
import js.html.webgl.RenderingContext;
|
||||
#elseif flash
|
||||
import flash.Lib;
|
||||
#elseif java
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.system.glfw.GLFW;
|
||||
#end
|
||||
|
||||
|
||||
@@ -50,6 +53,11 @@ class Renderer {
|
||||
|
||||
handle = lime_renderer_create (window.handle);
|
||||
|
||||
#elseif java
|
||||
|
||||
GLFW.glfwMakeContextCurrent (window.handle);
|
||||
GLContext.createFromCurrent ();
|
||||
|
||||
#end
|
||||
|
||||
createContext ();
|
||||
@@ -132,7 +140,7 @@ class Renderer {
|
||||
|
||||
}
|
||||
|
||||
#elseif (cpp || neko || nodejs)
|
||||
#elseif (cpp || neko || nodejs || java)
|
||||
|
||||
context = OPENGL (new GLRenderContext ());
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ import js.html.HtmlElement;
|
||||
import js.Browser;
|
||||
#elseif flash
|
||||
import flash.Lib;
|
||||
#elseif java
|
||||
import haxe.Int64;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.system.glfw.GLFW;
|
||||
#end
|
||||
|
||||
|
||||
@@ -51,6 +55,8 @@ class Window {
|
||||
#end
|
||||
#elseif (cpp || neko || nodejs)
|
||||
public var handle:Dynamic;
|
||||
#elseif java
|
||||
public var handle:Int64;
|
||||
#end
|
||||
|
||||
private var setHeight:Int;
|
||||
@@ -197,6 +203,20 @@ class Window {
|
||||
|
||||
handle = lime_window_create (application.__handle, width, height, flags, config.title);
|
||||
|
||||
#elseif java
|
||||
|
||||
GLFW.glfwWindowHint (GLFW.GLFW_SAMPLES, config.antialiasing);
|
||||
|
||||
if (config.borderless) GLFW.glfwWindowHint (GLFW.GLFW_DECORATED, GL11.GL_TRUE);
|
||||
if (!config.depthBuffer) GLFW.glfwWindowHint (GLFW.GLFW_DEPTH_BITS, 0);
|
||||
//if (config.fullscreen) GLFW.glfwWindowHint (GLFW.GLFW_DECORATED, GL11.GL_TRUE);
|
||||
if (!config.resizable) GLFW.glfwWindowHint (GLFW.GLFW_RESIZABLE, GL11.GL_FALSE);
|
||||
if (!config.stencilBuffer) GLFW.glfwWindowHint (GLFW.GLFW_STENCIL_BITS, 0);
|
||||
|
||||
handle = GLFW.glfwCreateWindow (width, height, config.title, null, null);
|
||||
|
||||
if (config.vsync) GLFW.glfwSwapInterval (1);
|
||||
|
||||
#end
|
||||
|
||||
MouseEventManager.registerWindow (this);
|
||||
|
||||
BIN
templates/java/lib/disruptor.jar
Executable file
BIN
templates/java/lib/disruptor.jar
Executable file
Binary file not shown.
BIN
templates/java/lib/lwjgl.jar
Executable file
BIN
templates/java/lib/lwjgl.jar
Executable file
Binary file not shown.
BIN
templates/java/ndll/Linux/liblwjgl.so
Executable file
BIN
templates/java/ndll/Linux/liblwjgl.so
Executable file
Binary file not shown.
BIN
templates/java/ndll/Linux/libopenal.so
Executable file
BIN
templates/java/ndll/Linux/libopenal.so
Executable file
Binary file not shown.
BIN
templates/java/ndll/Linux64/liblwjgl.so
Executable file
BIN
templates/java/ndll/Linux64/liblwjgl.so
Executable file
Binary file not shown.
BIN
templates/java/ndll/Linux64/libopenal.so
Executable file
BIN
templates/java/ndll/Linux64/libopenal.so
Executable file
Binary file not shown.
BIN
templates/java/ndll/Mac64/liblwjgl.dylib
Executable file
BIN
templates/java/ndll/Mac64/liblwjgl.dylib
Executable file
Binary file not shown.
BIN
templates/java/ndll/Mac64/libopenal.dylib
Executable file
BIN
templates/java/ndll/Mac64/libopenal.dylib
Executable file
Binary file not shown.
BIN
templates/java/ndll/Windows/OpenAL32.dll
Executable file
BIN
templates/java/ndll/Windows/OpenAL32.dll
Executable file
Binary file not shown.
BIN
templates/java/ndll/Windows/lwjgl.dll
Executable file
BIN
templates/java/ndll/Windows/lwjgl.dll
Executable file
Binary file not shown.
17
tools/helpers/JavaHelper.hx
Normal file
17
tools/helpers/JavaHelper.hx
Normal file
@@ -0,0 +1,17 @@
|
||||
package helpers;
|
||||
|
||||
|
||||
import sys.io.File;
|
||||
|
||||
|
||||
class JavaHelper {
|
||||
|
||||
|
||||
public static function copyLibraries (templatePaths:Array <String>, platformName:String, targetPath:String) {
|
||||
|
||||
FileHelper.recursiveCopyTemplate (templatePaths, "java/ndll/" + platformName, targetPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import helpers.AssetHelper;
|
||||
import helpers.CPPHelper;
|
||||
import helpers.FileHelper;
|
||||
import helpers.IconHelper;
|
||||
import helpers.JavaHelper;
|
||||
import helpers.NekoHelper;
|
||||
import helpers.NodeJSHelper;
|
||||
import helpers.PathHelper;
|
||||
@@ -14,6 +15,7 @@ import helpers.PlatformHelper;
|
||||
import helpers.ProcessHelper;
|
||||
import project.AssetType;
|
||||
import project.Architecture;
|
||||
import project.Haxelib;
|
||||
import project.HXProject;
|
||||
import project.Platform;
|
||||
import project.PlatformTarget;
|
||||
@@ -110,10 +112,13 @@ class MacPlatform extends PlatformTarget {
|
||||
|
||||
} else if (targetType == "java") {
|
||||
|
||||
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
|
||||
var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/");
|
||||
|
||||
ProcessHelper.runCommand ("", "haxe", [ hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar" ]);
|
||||
ProcessHelper.runCommand (targetDirectory + "/obj", "haxelib", [ "run", "hxjava", "hxjava_build.txt", "--haxe-version", "3103" ]);
|
||||
FileHelper.recursiveCopy (targetDirectory + "/obj/lib", PathHelper.combine (executableDirectory, "lib"));
|
||||
FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", PathHelper.combine (executableDirectory, project.app.file + ".jar"));
|
||||
NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory);
|
||||
JavaHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory);
|
||||
|
||||
} else if (targetType == "nodejs") {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user