Minor fixes
This commit is contained in:
@@ -298,7 +298,7 @@ class Image {
|
|||||||
|
|
||||||
return lime_image_encode (buffer, 0, quality);
|
return lime_image_encode (buffer, 0, quality);
|
||||||
|
|
||||||
#else
|
#elseif !js
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class ImageDataUtil {
|
|||||||
|
|
||||||
for (i in 0...length) {
|
for (i in 0...length) {
|
||||||
|
|
||||||
#if html5
|
#if js
|
||||||
data[i] = r;
|
data[i] = r;
|
||||||
data[i + 1] = g;
|
data[i + 1] = g;
|
||||||
data[i + 2] = b;
|
data[i + 2] = b;
|
||||||
@@ -263,7 +263,7 @@ class ImageDataUtil {
|
|||||||
|
|
||||||
offset = (row * stride) + (column * 4);
|
offset = (row * stride) + (column * 4);
|
||||||
|
|
||||||
#if html5
|
#if js
|
||||||
data[offset] = r;
|
data[offset] = r;
|
||||||
data[offset + 1] = g;
|
data[offset + 1] = g;
|
||||||
data[offset + 2] = b;
|
data[offset + 2] = b;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class System {
|
|||||||
|
|
||||||
#if neko
|
#if neko
|
||||||
private static var __loadedNekoAPI:Bool;
|
private static var __loadedNekoAPI:Bool;
|
||||||
|
#elseif nodejs
|
||||||
|
private static var __nodeNDLLModule:Dynamic;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
@@ -165,7 +167,7 @@ class System {
|
|||||||
#elseif neko
|
#elseif neko
|
||||||
return neko.Lib.load (__moduleNames.get (library), method, args);
|
return neko.Lib.load (__moduleNames.get (library), method, args);
|
||||||
#elseif nodejs
|
#elseif nodejs
|
||||||
return js.Lib.load (__moduleNames.get (library), method, args);
|
return untyped __nodeNDLLModule.load_lib (__moduleNames.get (library), method, args);
|
||||||
#else
|
#else
|
||||||
return null;
|
return null;
|
||||||
#end
|
#end
|
||||||
@@ -177,6 +179,12 @@ class System {
|
|||||||
|
|
||||||
flash.Lib.load ("waxe", "wx_boot", 1);
|
flash.Lib.load ("waxe", "wx_boot", 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
#elseif nodejs
|
||||||
|
if (__nodeNDLLModule == null) {
|
||||||
|
|
||||||
|
__nodeNDLLModule = untyped require('bindings')('node_ndll');
|
||||||
|
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -268,7 +276,7 @@ class System {
|
|||||||
#elseif (neko)
|
#elseif (neko)
|
||||||
var result = neko.Lib.load (name, func, args);
|
var result = neko.Lib.load (name, func, args);
|
||||||
#elseif nodejs
|
#elseif nodejs
|
||||||
var result = js.Lib.load (name, func, args);
|
var result = untyped __nodeNDLLModule.load_lib (name, func, args);
|
||||||
#else
|
#else
|
||||||
var result = null;
|
var result = null;
|
||||||
#end
|
#end
|
||||||
|
|||||||
@@ -8,8 +8,12 @@ import lime.system.System;
|
|||||||
import js.Browser;
|
import js.Browser;
|
||||||
#elseif flash
|
#elseif flash
|
||||||
import flash.Lib;
|
import flash.Lib;
|
||||||
|
#elseif java
|
||||||
|
import org.lwjgl.system.glfw.GLFW;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
@:allow(lime.ui.Window)
|
||||||
|
|
||||||
|
|
||||||
class KeyEventManager {
|
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)
|
#if (js && html5)
|
||||||
|
|
||||||
@@ -182,6 +186,11 @@ class KeyEventManager {
|
|||||||
|
|
||||||
eventInfo.type = (event.type == flash.events.KeyboardEvent.KEY_DOWN ? KEY_DOWN : KEY_UP);
|
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
|
#end
|
||||||
|
|
||||||
switch (eventInfo.type) {
|
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)
|
#if (cpp || neko || nodejs)
|
||||||
private static var lime_key_event_manager_register = System.load ("lime", "lime_key_event_manager_register", 2);
|
private static var lime_key_event_manager_register = System.load ("lime", "lime_key_event_manager_register", 2);
|
||||||
#end
|
#end
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import js.Browser;
|
|||||||
import flash.Lib;
|
import flash.Lib;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
@:allow(lime.ui.Window)
|
@:allow(lime.ui.Window)
|
||||||
|
|
||||||
|
|
||||||
class MouseEventManager {
|
class MouseEventManager {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.lwjgl.opengl.GL11;
|
|||||||
import org.lwjgl.system.glfw.GLFW;
|
import org.lwjgl.system.glfw.GLFW;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
@:access(lime.app.Application)
|
@:access(lime.app.Application)
|
||||||
|
|
||||||
|
|
||||||
@@ -219,6 +218,7 @@ class Window {
|
|||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
KeyEventManager.registerWindow (this);
|
||||||
MouseEventManager.registerWindow (this);
|
MouseEventManager.registerWindow (this);
|
||||||
TouchEventManager.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) {
|
private inline function write_uncheck (byte:Int) {
|
||||||
|
|
||||||
|
#if !js
|
||||||
#if cpp
|
#if cpp
|
||||||
untyped b.__unsafe_set (position++, byte);
|
untyped b.__unsafe_set (position++, byte);
|
||||||
#elseif neko
|
#elseif neko
|
||||||
@@ -705,6 +706,7 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
|
|||||||
#else
|
#else
|
||||||
b[position++] = byte & 0xff;
|
b[position++] = byte & 0xff;
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user