Minor fixes
This commit is contained in:
@@ -298,7 +298,7 @@ class Image {
|
||||
|
||||
return lime_image_encode (buffer, 0, quality);
|
||||
|
||||
#else
|
||||
#elseif !js
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ class ImageDataUtil {
|
||||
|
||||
for (i in 0...length) {
|
||||
|
||||
#if html5
|
||||
#if js
|
||||
data[i] = r;
|
||||
data[i + 1] = g;
|
||||
data[i + 2] = b;
|
||||
@@ -263,7 +263,7 @@ class ImageDataUtil {
|
||||
|
||||
offset = (row * stride) + (column * 4);
|
||||
|
||||
#if html5
|
||||
#if js
|
||||
data[offset] = r;
|
||||
data[offset + 1] = g;
|
||||
data[offset + 2] = b;
|
||||
|
||||
@@ -22,6 +22,8 @@ class System {
|
||||
|
||||
#if neko
|
||||
private static var __loadedNekoAPI:Bool;
|
||||
#elseif nodejs
|
||||
private static var __nodeNDLLModule:Dynamic;
|
||||
#end
|
||||
|
||||
|
||||
@@ -165,7 +167,7 @@ class System {
|
||||
#elseif neko
|
||||
return neko.Lib.load (__moduleNames.get (library), method, args);
|
||||
#elseif nodejs
|
||||
return js.Lib.load (__moduleNames.get (library), method, args);
|
||||
return untyped __nodeNDLLModule.load_lib (__moduleNames.get (library), method, args);
|
||||
#else
|
||||
return null;
|
||||
#end
|
||||
@@ -177,6 +179,12 @@ class System {
|
||||
|
||||
flash.Lib.load ("waxe", "wx_boot", 1);
|
||||
|
||||
}
|
||||
#elseif nodejs
|
||||
if (__nodeNDLLModule == null) {
|
||||
|
||||
__nodeNDLLModule = untyped require('bindings')('node_ndll');
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -268,7 +276,7 @@ class System {
|
||||
#elseif (neko)
|
||||
var result = neko.Lib.load (name, func, args);
|
||||
#elseif nodejs
|
||||
var result = js.Lib.load (name, func, args);
|
||||
var result = untyped __nodeNDLLModule.load_lib (name, func, args);
|
||||
#else
|
||||
var result = null;
|
||||
#end
|
||||
|
||||
@@ -8,8 +8,12 @@ import lime.system.System;
|
||||
import js.Browser;
|
||||
#elseif flash
|
||||
import flash.Lib;
|
||||
#elseif java
|
||||
import org.lwjgl.system.glfw.GLFW;
|
||||
#end
|
||||
|
||||
@:allow(lime.ui.Window)
|
||||
|
||||
|
||||
class KeyEventManager {
|
||||
|
||||
@@ -145,7 +149,7 @@ class KeyEventManager {
|
||||
}
|
||||
|
||||
|
||||
private static function handleEvent (#if (js && html5) event:js.html.KeyboardEvent #elseif flash event:flash.events.KeyboardEvent #end):Void {
|
||||
private static function handleEvent (#if (js && html5) event:js.html.KeyboardEvent #elseif flash event:flash.events.KeyboardEvent #elseif java _window, key, scancode, action, mods #end):Void {
|
||||
|
||||
#if (js && html5)
|
||||
|
||||
@@ -182,6 +186,11 @@ class KeyEventManager {
|
||||
|
||||
eventInfo.type = (event.type == flash.events.KeyboardEvent.KEY_DOWN ? KEY_DOWN : KEY_UP);
|
||||
|
||||
#elseif java
|
||||
|
||||
eventInfo.keyCode = cast convertKeyCode (key);
|
||||
eventInfo.type == (action == GLFW.GLFW_RELEASE ? KEY_UP : KEY_DOWN);
|
||||
|
||||
#end
|
||||
|
||||
switch (eventInfo.type) {
|
||||
@@ -199,6 +208,23 @@ class KeyEventManager {
|
||||
}
|
||||
|
||||
|
||||
private static function registerWindow (_window:Window):Void {
|
||||
|
||||
#if java
|
||||
|
||||
/*GLFW.glfwSetKeyCallback (_window.handle, keyfun = new GLFW.GLFWkeyfun() {
|
||||
@Override
|
||||
public void invoke(long window, int key, int scancode, int action, int mods) {
|
||||
if ( key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE )
|
||||
glfwSetWindowShouldClose(window, GL_TRUE); // We will detect this in our rendering loop
|
||||
}
|
||||
}));*/
|
||||
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if (cpp || neko || nodejs)
|
||||
private static var lime_key_event_manager_register = System.load ("lime", "lime_key_event_manager_register", 2);
|
||||
#end
|
||||
|
||||
@@ -10,8 +10,9 @@ import js.Browser;
|
||||
import flash.Lib;
|
||||
#end
|
||||
|
||||
|
||||
@:allow(lime.ui.Window)
|
||||
|
||||
|
||||
class MouseEventManager {
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.system.glfw.GLFW;
|
||||
#end
|
||||
|
||||
|
||||
@:access(lime.app.Application)
|
||||
|
||||
|
||||
@@ -219,6 +218,7 @@ class Window {
|
||||
|
||||
#end
|
||||
|
||||
KeyEventManager.registerWindow (this);
|
||||
MouseEventManager.registerWindow (this);
|
||||
TouchEventManager.registerWindow (this);
|
||||
|
||||
|
||||
@@ -698,6 +698,7 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
|
||||
|
||||
private inline function write_uncheck (byte:Int) {
|
||||
|
||||
#if !js
|
||||
#if cpp
|
||||
untyped b.__unsafe_set (position++, byte);
|
||||
#elseif neko
|
||||
@@ -705,6 +706,7 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
|
||||
#else
|
||||
b[position++] = byte & 0xff;
|
||||
#end
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user