diff --git a/include.xml b/include.xml
index 0e56056f0..41ea390e5 100644
--- a/include.xml
+++ b/include.xml
@@ -15,6 +15,8 @@
+
+
diff --git a/lime/Assets.hx b/lime/Assets.hx
index 4b09e96a0..f5e3a0ad0 100644
--- a/lime/Assets.hx
+++ b/lime/Assets.hx
@@ -568,7 +568,7 @@ class Assets {
private static function isValidImage (buffer:Image):Bool {
#if (tools && !display)
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
return (buffer != null);
//return (bitmapData.__handle != null);
diff --git a/lime/app/Application.hx b/lime/app/Application.hx
index 9a34bcc40..5cae3a68b 100644
--- a/lime/app/Application.hx
+++ b/lime/app/Application.hx
@@ -6,7 +6,7 @@ import lime.graphics.*;
import lime.system.*;
import lime.ui.*;
-#if js
+#if html5
import js.Browser;
#elseif flash
import flash.Lib;
@@ -53,7 +53,7 @@ class Application extends Module {
AudioManager.init ();
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_update_event_manager_register (__dispatch, __eventInfo);
#end
@@ -85,7 +85,7 @@ class Application extends Module {
this.config = config;
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
__handle = lime_application_create (null);
#end
@@ -119,7 +119,7 @@ class Application extends Module {
window.width = config.width;
window.height = config.height;
- #if js
+ #if html5
window.element = config.element;
#end
@@ -136,15 +136,53 @@ class Application extends Module {
*/
public function exec ():Int {
- #if (cpp || neko)
+ #if nodejs
- var result = lime_application_exec (__handle);
+ lime_application_init (__handle);
- AudioManager.shutdown ();
+ var prevTime = untyped __js__ ('Date.now ()');
+ var eventLoop = function () {
+
+ var active = lime_application_update (__handle);
+
+ if (!active) {
+
+ var result = lime_application_quit (__handle);
+ __cleanup ();
+ Sys.exit (result);
+
+ }
+
+ var time = untyped __js__ ('Date.now ()');
+ if (time - prevTime <= 16) {
+
+ untyped setTimeout (eventLoop, 0);
+
+ }
+ else {
+
+ untyped setImmediate (eventLoop);
+
+ }
+
+ prevTime = time;
+
+ }
+
+ untyped setImmediate (eventLoop);
+
+ #elseif (cpp || neko)
+
+ lime_application_init (__handle);
+
+ while (lime_application_update (__handle)) {}
+
+ var result = lime_application_quit (__handle);
+ __cleanup ();
return result;
- #elseif js
+ #elseif html5
untyped __js__ ("
var lastTime = 0;
@@ -185,6 +223,13 @@ class Application extends Module {
}
+ #if (cpp || neko || nodejs)
+ @:noCompletion private function __cleanup():Void {
+
+ AudioManager.shutdown();
+
+ }
+ #end
/**
* The init() method is called once before the first render()
@@ -364,7 +409,7 @@ class Application extends Module {
Renderer.dispatch ();
- #if js
+ #if html5
Browser.window.requestAnimationFrame (cast __triggerFrame);
#end
@@ -378,9 +423,11 @@ class Application extends Module {
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_application_create = System.load ("lime", "lime_application_create", 1);
- private static var lime_application_exec = System.load ("lime", "lime_application_exec", 1);
+ private static var lime_application_init = System.load ("lime", "lime_application_init", 1);
+ private static var lime_application_update = System.load ("lime", "lime_application_update", 1);
+ private static var lime_application_quit = System.load ("lime", "lime_application_quit", 1);
private static var lime_application_get_ticks = System.load ("lime", "lime_application_get_ticks", 0);
private static var lime_update_event_manager_register = System.load ("lime", "lime_update_event_manager_register", 2);
#end
diff --git a/lime/app/Config.hx b/lime/app/Config.hx
index 4893506e3..c24fb35fe 100644
--- a/lime/app/Config.hx
+++ b/lime/app/Config.hx
@@ -7,7 +7,7 @@ typedef Config = {
@:optional var background:Null;
@:optional var borderless:Bool;
@:optional var depthBuffer:Bool;
- #if js
+ #if html5
@:optional var element:js.html.HtmlElement;
#end
@:optional var fps:Int;
diff --git a/lime/app/Preloader.hx b/lime/app/Preloader.hx
index 3e0adc891..78aa1b43f 100644
--- a/lime/app/Preloader.hx
+++ b/lime/app/Preloader.hx
@@ -3,7 +3,7 @@ package lime.app;
import lime.Assets;
-#if js
+#if html5
import js.html.Image;
import js.Browser;
import lime.net.URLLoader;
@@ -23,7 +23,7 @@ class Preloader #if flash extends Sprite #end {
public var complete:Bool;
public var onComplete:Dynamic;
- #if js
+ #if html5
public static var images = new Map ();
public static var loaders = new Map ();
private var loaded = 0;
@@ -54,7 +54,7 @@ class Preloader #if flash extends Sprite #end {
Lib.current.addEventListener (Event.ENTER_FRAME, current_onEnter);
#end
- #if (!flash && !js)
+ #if (!flash && !html5)
start ();
#end
@@ -63,7 +63,7 @@ class Preloader #if flash extends Sprite #end {
public function load (urls:Array, types:Array):Void {
- #if js
+ #if html5
var url = null;
@@ -124,7 +124,7 @@ class Preloader #if flash extends Sprite #end {
}
- #if js
+ #if html5
private function loadFont (font:String):Void {
var node = Browser.document.createElement ("span");
@@ -229,7 +229,7 @@ class Preloader #if flash extends Sprite #end {
- #if js
+ #if html5
private function image_onLoad (_):Void {
loaded++;
diff --git a/lime/audio/AudioBuffer.hx b/lime/audio/AudioBuffer.hx
index 0500db5b8..ecf6a4214 100644
--- a/lime/audio/AudioBuffer.hx
+++ b/lime/audio/AudioBuffer.hx
@@ -6,7 +6,7 @@ import lime.system.System;
import lime.utils.ByteArray;
import lime.utils.Float32Array;
-#if js
+#if html5
import js.html.Audio;
#elseif flash
import flash.media.Sound;
@@ -22,7 +22,7 @@ class AudioBuffer {
public var id:UInt;
public var sampleRate:Int;
- #if js
+ #if html5
public var src:Audio;
#elseif flash
public var src:Sound;
@@ -47,7 +47,7 @@ class AudioBuffer {
public static function fromBytes (bytes:ByteArray):AudioBuffer {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
var data = lime_audio_load (bytes);
@@ -71,7 +71,7 @@ class AudioBuffer {
public static function fromFile (path:String):AudioBuffer {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
var data = lime_audio_load (path);
@@ -100,7 +100,7 @@ class AudioBuffer {
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_audio_load:Dynamic = System.load ("lime", "lime_audio_load", 1);
#end
diff --git a/lime/audio/AudioManager.hx b/lime/audio/AudioManager.hx
index e3369f9ef..763cc666c 100644
--- a/lime/audio/AudioManager.hx
+++ b/lime/audio/AudioManager.hx
@@ -6,7 +6,7 @@ import lime.audio.openal.ALC;
import lime.audio.openal.ALContext;
import lime.audio.openal.ALDevice;
-#if js
+#if html5
import js.Browser;
#end
@@ -21,7 +21,7 @@ class AudioManager {
if (context == null) {
- #if js
+ #if html5
try {
untyped __js__ ("window.AudioContext = window.AudioContext || window.webkitAudioContext;");
diff --git a/lime/audio/AudioSource.hx b/lime/audio/AudioSource.hx
index 330a46e82..1b78836b4 100644
--- a/lime/audio/AudioSource.hx
+++ b/lime/audio/AudioSource.hx
@@ -95,7 +95,7 @@ class AudioSource {
public function play ():Void {
- #if js
+ #if html5
#elseif flash
if (channel != null) channel.stop ();
var channel = buffer.src.play (pauseTime / 1000);
@@ -108,7 +108,7 @@ class AudioSource {
public function pause ():Void {
- #if js
+ #if html5
#elseif flash
if (channel != null) {
@@ -125,7 +125,7 @@ class AudioSource {
public function stop ():Void {
- #if js
+ #if html5
#elseif flash
pauseTime = 0;
if (channel != null) channel.stop ();
diff --git a/lime/audio/HTML5AudioContext.hx b/lime/audio/HTML5AudioContext.hx
index de68df660..f3ace3115 100644
--- a/lime/audio/HTML5AudioContext.hx
+++ b/lime/audio/HTML5AudioContext.hx
@@ -1,7 +1,7 @@
package lime.audio;
-#if js
+#if html5
import js.html.Audio;
#end
@@ -29,7 +29,7 @@ class HTML5AudioContext {
public function canPlayType (buffer:AudioBuffer, type:String):String {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.canPlayType (type);
@@ -44,7 +44,7 @@ class HTML5AudioContext {
public function createBuffer (urlString:String = null):AudioBuffer {
- #if js
+ #if html5
var buffer = new AudioBuffer ();
buffer.src = new Audio ();
buffer.src.src = urlString;
@@ -58,7 +58,7 @@ class HTML5AudioContext {
public function getAudioDecodedByteCount (buffer:AudioBuffer):Int {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.audioDecodedByteCount;
@@ -73,7 +73,7 @@ class HTML5AudioContext {
public function getAutoplay (buffer:AudioBuffer):Bool {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.autoplay;
@@ -88,7 +88,7 @@ class HTML5AudioContext {
public function getBuffered (buffer:AudioBuffer):Dynamic /*TimeRanges*/ {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.buffered;
@@ -103,7 +103,7 @@ class HTML5AudioContext {
public function getController (buffer:AudioBuffer):Dynamic /*MediaController*/ {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.controller;
@@ -118,7 +118,7 @@ class HTML5AudioContext {
public function getCurrentSrc (buffer:AudioBuffer):String {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.currentSrc;
@@ -133,7 +133,7 @@ class HTML5AudioContext {
public function getCurrentTime (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.currentTime;
@@ -148,7 +148,7 @@ class HTML5AudioContext {
public function getDefaultPlaybackRate (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.defaultPlaybackRate;
@@ -163,7 +163,7 @@ class HTML5AudioContext {
public function getDuration (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.duration;
@@ -178,7 +178,7 @@ class HTML5AudioContext {
public function getEnded (buffer:AudioBuffer):Bool {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.ended;
@@ -193,7 +193,7 @@ class HTML5AudioContext {
public function getError (buffer:AudioBuffer):Dynamic /*MediaError*/ {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.error;
@@ -208,7 +208,7 @@ class HTML5AudioContext {
public function getInitialTime (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.initialTime;
@@ -223,7 +223,7 @@ class HTML5AudioContext {
public function getLoop (buffer:AudioBuffer):Bool {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.loop;
@@ -238,7 +238,7 @@ class HTML5AudioContext {
public function getMediaGroup (buffer:AudioBuffer):String {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.mediaGroup;
@@ -253,7 +253,7 @@ class HTML5AudioContext {
public function getMuted (buffer:AudioBuffer):Bool {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.muted;
@@ -268,7 +268,7 @@ class HTML5AudioContext {
public function getNetworkState (buffer:AudioBuffer):Int {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.networkState;
@@ -283,7 +283,7 @@ class HTML5AudioContext {
public function getPaused (buffer:AudioBuffer):Bool {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.paused;
@@ -298,7 +298,7 @@ class HTML5AudioContext {
public function getPlaybackRate (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.playbackRate;
@@ -313,7 +313,7 @@ class HTML5AudioContext {
public function getPlayed (buffer:AudioBuffer):Dynamic /*TimeRanges*/ {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.played;
@@ -328,7 +328,7 @@ class HTML5AudioContext {
public function getPreload (buffer:AudioBuffer):String {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.preload;
@@ -343,7 +343,7 @@ class HTML5AudioContext {
public function getReadyState (buffer:AudioBuffer):Int {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.readyState;
@@ -358,7 +358,7 @@ class HTML5AudioContext {
public function getSeekable (buffer:AudioBuffer):Dynamic /*TimeRanges*/ {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.seekable;
@@ -373,7 +373,7 @@ class HTML5AudioContext {
public function getSeeking (buffer:AudioBuffer):Bool {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.seeking;
@@ -388,7 +388,7 @@ class HTML5AudioContext {
public function getSrc (buffer:AudioBuffer):String {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.src;
@@ -403,7 +403,7 @@ class HTML5AudioContext {
public function getStartTime (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.playbackRate;
@@ -418,7 +418,7 @@ class HTML5AudioContext {
public function getVolume (buffer:AudioBuffer):Float {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.volume;
@@ -433,7 +433,7 @@ class HTML5AudioContext {
public function load (buffer:AudioBuffer):Void {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.load ();
@@ -446,7 +446,7 @@ class HTML5AudioContext {
public function pause (buffer:AudioBuffer):Void {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.pause ();
@@ -459,7 +459,7 @@ class HTML5AudioContext {
public function play (buffer:AudioBuffer):Void {
- #if js
+ #if html5
if (buffer.src != null) {
return buffer.src.play ();
@@ -472,7 +472,7 @@ class HTML5AudioContext {
public function setAutoplay (buffer:AudioBuffer, value:Bool):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.autoplay = value;
@@ -485,7 +485,7 @@ class HTML5AudioContext {
public function setController (buffer:AudioBuffer, value:Dynamic /*MediaController*/):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.controller = value;
@@ -498,7 +498,7 @@ class HTML5AudioContext {
public function setCurrentTime (buffer:AudioBuffer, value:Float):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.currentTime = value;
@@ -511,7 +511,7 @@ class HTML5AudioContext {
public function setDefaultPlaybackRate (buffer:AudioBuffer, value:Float):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.defaultPlaybackRate = value;
@@ -524,7 +524,7 @@ class HTML5AudioContext {
public function setLoop (buffer:AudioBuffer, value:Bool):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.loop = value;
@@ -537,7 +537,7 @@ class HTML5AudioContext {
public function setMediaGroup (buffer:AudioBuffer, value:String):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.mediaGroup = value;
@@ -550,7 +550,7 @@ class HTML5AudioContext {
public function setMuted (buffer:AudioBuffer, value:Bool):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.muted = value;
@@ -563,7 +563,7 @@ class HTML5AudioContext {
public function setPlaybackRate (buffer:AudioBuffer, value:Float):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.playbackRate = value;
@@ -576,7 +576,7 @@ class HTML5AudioContext {
public function setPreload (buffer:AudioBuffer, value:String):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.preload = value;
@@ -589,7 +589,7 @@ class HTML5AudioContext {
public function setSrc (buffer:AudioBuffer, value:String):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.src = value;
@@ -602,7 +602,7 @@ class HTML5AudioContext {
public function setVolume (buffer:AudioBuffer, value:Float):Void {
- #if js
+ #if html5
if (buffer.src != null) {
buffer.src.volume = value;
diff --git a/lime/audio/WebAudioContext.hx b/lime/audio/WebAudioContext.hx
index 18a3287e5..45fb9eff3 100644
--- a/lime/audio/WebAudioContext.hx
+++ b/lime/audio/WebAudioContext.hx
@@ -1,4 +1,4 @@
-package lime.audio; #if !js
+package lime.audio; #if !html5
class WebAudioContext {
diff --git a/lime/audio/openal/AL.hx b/lime/audio/openal/AL.hx
index d8a5de0c1..f00516217 100644
--- a/lime/audio/openal/AL.hx
+++ b/lime/audio/openal/AL.hx
@@ -76,6 +76,8 @@ class AL {
#if ((cpp || neko) && lime_openal)
lime_al_buffer_data (buffer, format, data.getByteBuffer (), size, freq);
+ #elseif (nodejs && lime_openal)
+ lime_al_buffer_data (buffer, format, data, size, freq);
#end
}
@@ -83,7 +85,7 @@ class AL {
public static function buffer3f (buffer:Int, param:Int, value1:Float, value2:Float, value3:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_buffer3f (buffer, param, value1, value2, value3);
#end
@@ -92,7 +94,7 @@ class AL {
public static function buffer3i (buffer:Int, param:Int, value1:Int, value2:Int, value3:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_buffer3i (buffer, param, value1, value2, value3);
#end
@@ -101,7 +103,7 @@ class AL {
public static function bufferf (buffer:Int, param:Int, value:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_bufferf (buffer, param, value);
#end
@@ -110,7 +112,7 @@ class AL {
public static function bufferfv (buffer:Int, param:Int, values:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_bufferfv (buffer, param, values);
#end
@@ -119,7 +121,7 @@ class AL {
public static function bufferi (buffer:Int, param:Int, value:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_bufferi (buffer, param, value);
#end
@@ -128,7 +130,7 @@ class AL {
public static function bufferiv (buffer:Int, param:Int, values:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_bufferiv (buffer, param, values);
#end
@@ -137,7 +139,7 @@ class AL {
public static function deleteBuffer (buffer:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_delete_buffer (buffer);
#end
@@ -146,7 +148,7 @@ class AL {
public static function deleteBuffers (buffers:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_delete_buffers (buffers.length, buffers);
#end
@@ -155,7 +157,7 @@ class AL {
public static function deleteSource (source:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_delete_source (source);
#end
@@ -164,7 +166,7 @@ class AL {
public static function deleteSources (sources:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_delete_sources (sources.length, sources);
#end
@@ -173,7 +175,7 @@ class AL {
public static function disable (capability:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_disable (capability);
#end
@@ -182,7 +184,7 @@ class AL {
public static function distanceModel (distanceModel:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_distance_model (distanceModel);
#end
@@ -191,7 +193,7 @@ class AL {
public static function dopplerFactor (value:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_doppler_factor (value);
#end
@@ -200,7 +202,7 @@ class AL {
public static function dopplerVelocity (value:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_doppler_velocity (value);
#end
@@ -209,7 +211,7 @@ class AL {
public static function enable (capability:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_enable (capability);
#end
@@ -218,7 +220,7 @@ class AL {
public static function genSource ():Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_gen_source ();
#else
return 0;
@@ -229,7 +231,7 @@ class AL {
public static function genSources (n:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_gen_sources (n);
#else
return null;
@@ -240,7 +242,7 @@ class AL {
public static function genBuffer ():Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_gen_buffer ();
#else
return 0;
@@ -251,7 +253,7 @@ class AL {
public static function genBuffers (n:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_gen_buffers (n);
#else
return null;
@@ -262,7 +264,7 @@ class AL {
public static function getBoolean (param:Int):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_boolean (param);
#else
return false;
@@ -273,7 +275,7 @@ class AL {
public static function getBooleanv (param:Int, count:Int = 1 ):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_booleanv (param, count);
#else
return null;
@@ -284,7 +286,7 @@ class AL {
public static function getBuffer3f (buffer:Int, param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_buffer3f (buffer, param);
#else
return null;
@@ -295,7 +297,7 @@ class AL {
public static function getBuffer3i (buffer:Int, param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_buffer3i (buffer, param);
#else
return null;
@@ -306,7 +308,7 @@ class AL {
public static function getBufferf (buffer:Int, param:Int):Float {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_bufferf (buffer, param);
#else
return 0;
@@ -317,7 +319,7 @@ class AL {
public static function getBufferfv (buffer:Int, param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_bufferfv (buffer, param, count);
#else
return null;
@@ -328,7 +330,7 @@ class AL {
public static function getBufferi (buffer:Int, param:Int):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_bufferi (buffer, param);
#else
return 0;
@@ -339,7 +341,7 @@ class AL {
public static function getBufferiv (buffer:Int, param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_bufferiv (buffer, param, count);
#else
return null;
@@ -350,7 +352,7 @@ class AL {
public static function getDouble (param:Int):Float {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_double (param);
#else
return 0;
@@ -361,7 +363,7 @@ class AL {
public static function getDoublev (param:Int, count:Int = 1 ):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_doublev (param, count);
#else
return null;
@@ -372,7 +374,7 @@ class AL {
public static function getEnumValue (ename:String):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_enum_value (ename);
#else
return 0;
@@ -383,7 +385,7 @@ class AL {
public static function getError ():Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_error ();
#else
return 0;
@@ -410,7 +412,7 @@ class AL {
public static function getFloat (param:Int):Float {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_float (param);
#else
return 0;
@@ -421,7 +423,7 @@ class AL {
public static function getFloatv (param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_floatv (param, count);
#else
return null;
@@ -432,7 +434,7 @@ class AL {
public static function getInteger (param:Int):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_integer (param);
#else
return 0;
@@ -443,7 +445,7 @@ class AL {
public static function getIntegerv (param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_integerv (param, count);
#else
return null;
@@ -454,7 +456,7 @@ class AL {
public static function getListener3f (param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_listener3f (param);
#else
return null;
@@ -465,7 +467,7 @@ class AL {
public static function getListener3i (param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_listener3i (param);
#else
return null;
@@ -476,7 +478,7 @@ class AL {
public static function getListenerf (param:Int):Float {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_listenerf (param);
#else
return 0;
@@ -487,7 +489,7 @@ class AL {
public static function getListenerfv (param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_listenerfv (param, count);
#else
return null;
@@ -498,7 +500,7 @@ class AL {
public static function getListeneri (param:Int):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_listeneri (param);
#else
return 0;
@@ -509,7 +511,7 @@ class AL {
public static function getListeneriv (param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_listeneriv (param, count);
#else
return null;
@@ -527,7 +529,7 @@ class AL {
public static function getSource3f (source:Int, param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_source3f (source, param);
#else
return null;
@@ -538,7 +540,7 @@ class AL {
public static function getSourcef (source:Int, param:Int):Float {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_sourcef (source, param);
#else
return 0;
@@ -549,7 +551,7 @@ class AL {
public static function getSource3i (source:Int, param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_source3i (source, param);
#else
return null;
@@ -560,7 +562,7 @@ class AL {
public static function getSourcefv (source:Int, param:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_sourcefv (source, param);
#else
return null;
@@ -571,7 +573,7 @@ class AL {
public static function getSourcei (source:Int, param:Int):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_sourcei (source, param);
#else
return 0;
@@ -582,7 +584,7 @@ class AL {
public static function getSourceiv (source:Int, param:Int, count:Int = 1):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_sourceiv (source, param, count);
#else
return null;
@@ -593,7 +595,7 @@ class AL {
public static function getString (param:Int):String {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_get_string (param);
#else
return null;
@@ -604,7 +606,7 @@ class AL {
public static function isBuffer (buffer:Int):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_is_buffer (buffer);
#else
return false;
@@ -615,7 +617,7 @@ class AL {
public static function isEnabled (capability:Int):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_is_enabled (capability);
#else
return false;
@@ -626,7 +628,7 @@ class AL {
public static function isExtensionPresent (extname:String):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_is_extension_present (extname);
#else
return false;
@@ -637,7 +639,7 @@ class AL {
public static function isSource (source:Int):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_is_source (source);
#else
return false;
@@ -648,7 +650,7 @@ class AL {
public static function listener3f (param:Int, value1:Float, value2:Float, value3:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_listener3f (param, value1, value2, value3);
#end
@@ -657,7 +659,7 @@ class AL {
public static function listener3i (param:Int, value1:Int, value2:Int, value3:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_listener3i (param, value1, value2, value3);
#end
@@ -666,7 +668,7 @@ class AL {
public static function listenerf (param:Int, value:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_listenerf (param, value);
#end
@@ -675,7 +677,7 @@ class AL {
public static function listenerfv (param:Int, values:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_listenerfv (param, values);
#end
@@ -684,7 +686,7 @@ class AL {
public static function listeneri (param:Int, value:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_listeneri (param, value);
#end
@@ -693,7 +695,7 @@ class AL {
public static function listeneriv (param:Int, values:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_listeneriv (param, values);
#end
@@ -702,7 +704,7 @@ class AL {
public static function source3f (source:Int, param:Int, value1:Float, value2:Float, value3:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source3f (source, param, value1, value2, value3);
#end
@@ -711,7 +713,7 @@ class AL {
public static function source3i (source:Int, param:Int, value1:Int, value2:Int, value3:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source3i (source, param, value1, value2, value3);
#end
@@ -720,7 +722,7 @@ class AL {
public static function sourcef (source:Int, param:Int, value:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_sourcef (source, param, value);
#end
@@ -729,7 +731,7 @@ class AL {
public static function sourcefv (source:Int, param:Int, values:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_sourcefv (source, param, values);
#end
@@ -738,7 +740,7 @@ class AL {
public static function sourcei (source:Int, param:Int, value:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_sourcei (source, param, value);
#end
@@ -747,7 +749,7 @@ class AL {
public static function sourceiv (source:Int, param:Int, values:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_sourceiv (source, param, values);
#end
@@ -756,7 +758,7 @@ class AL {
public static function sourcePlay (source:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_play (source);
#end
@@ -765,7 +767,7 @@ class AL {
public static function sourcePlayv (sources:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_playv (sources.length, sources);
#end
@@ -774,7 +776,7 @@ class AL {
public static function sourceStop (source:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_stop (source);
#end
@@ -783,7 +785,7 @@ class AL {
public static function sourceStopv (sources:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_stopv (sources.length, sources);
#end
@@ -792,7 +794,7 @@ class AL {
public static function sourceRewind (source:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_rewind (source);
#end
@@ -801,7 +803,7 @@ class AL {
public static function sourceRewindv (sources:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_rewindv (sources.length, sources);
#end
@@ -810,7 +812,7 @@ class AL {
public static function sourcePause (source:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_pause (source);
#end
@@ -819,7 +821,7 @@ class AL {
public static function sourcePausev (sources:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_pausev (sources.length, sources);
#end
@@ -828,7 +830,7 @@ class AL {
public static function sourceQueueBuffer (source:Int, buffer:Int):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_queue_buffers (source, 1, [ buffer ]);
#end
@@ -837,7 +839,7 @@ class AL {
public static function sourceQueueBuffers (source:Int, nb:Int, buffers:Array):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_source_queue_buffers (source, nb, buffers);
#end
@@ -846,7 +848,7 @@ class AL {
public static function sourceUnqueueBuffer (source:Int):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
var res = lime_al_source_unqueue_buffers (source, 1);
return res[0];
#else
@@ -858,7 +860,7 @@ class AL {
public static function sourceUnqueueBuffers (source:Int, nb:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_al_source_unqueue_buffers (source, nb);
#else
return null;
@@ -869,14 +871,14 @@ class AL {
public static function speedOfSound (value:Float):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_al_speed_of_sound (value);
#end
}
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
private static var lime_al_buffer_data = System.load ("lime", "lime_al_buffer_data", 5);
private static var lime_al_bufferf = System.load ("lime", "lime_al_bufferf", 3);
private static var lime_al_buffer3f = System.load ("lime", "lime_al_buffer3f", 5);
diff --git a/lime/audio/openal/ALC.hx b/lime/audio/openal/ALC.hx
index 48d7ef7b2..7a558a7f8 100644
--- a/lime/audio/openal/ALC.hx
+++ b/lime/audio/openal/ALC.hx
@@ -32,7 +32,7 @@ class ALC {
public static function closeDevice (device:ALDevice):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_alc_close_device (device);
#else
return false;
@@ -43,7 +43,7 @@ class ALC {
public static function createContext (device:ALDevice, attrlist:Array = null):ALContext {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
var handle:Float = lime_alc_create_context (device, attrlist);
if (handle != 0) {
@@ -60,7 +60,7 @@ class ALC {
public static function destroyContext (context:ALContext):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_alc_destroy_context (context);
#end
@@ -69,7 +69,7 @@ class ALC {
public static function getContextsDevice (context:ALContext):ALDevice {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
var handle:Float = lime_alc_get_contexts_device (context);
if (handle != 0) {
@@ -86,7 +86,7 @@ class ALC {
public static function getCurrentContext ():ALContext {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
var handle:Float = lime_alc_get_current_context ();
if (handle != 0) {
@@ -103,7 +103,7 @@ class ALC {
public static function getError (device:ALDevice):Int {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_alc_get_error (device);
#else
return 0;
@@ -130,7 +130,7 @@ class ALC {
public static function getIntegerv (device:ALDevice, param:Int, size:Int):Array {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_alc_get_integerv (device, param, size);
#else
return null;
@@ -141,7 +141,7 @@ class ALC {
public static function getString (device:ALDevice, param:Int):String {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_alc_get_string (device, param);
#else
return null;
@@ -152,7 +152,7 @@ class ALC {
public static function makeContextCurrent (context:ALContext):Bool {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
return lime_alc_make_context_current (context);
#else
return false;
@@ -163,7 +163,7 @@ class ALC {
public static function openDevice (deviceName:String = null):ALDevice {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
var handle:Float = lime_alc_open_device (deviceName);
if (handle != 0) {
@@ -180,7 +180,7 @@ class ALC {
public static function processContext (context:ALContext):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_alc_process_context (context);
#end
@@ -189,14 +189,14 @@ class ALC {
public static function suspendContext (context:ALContext):Void {
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
lime_alc_suspend_context (context);
#end
}
- #if ((cpp || neko) && lime_openal)
+ #if ((cpp || neko || nodejs) && lime_openal)
private static var lime_alc_close_device = System.load ("lime", "lime_alc_close_device", 1);
private static var lime_alc_create_context = System.load ("lime", "lime_alc_create_context", 2);
private static var lime_alc_destroy_context = System.load ("lime", "lime_alc_destroy_context", 1);
diff --git a/lime/graphics/CanvasRenderContext.hx b/lime/graphics/CanvasRenderContext.hx
index 825c4489a..8a5d79f4f 100644
--- a/lime/graphics/CanvasRenderContext.hx
+++ b/lime/graphics/CanvasRenderContext.hx
@@ -1,5 +1,5 @@
package lime.graphics;
-#if js
+#if html5
typedef CanvasRenderContext = js.html.CanvasRenderingContext2D;
#else
diff --git a/lime/graphics/DOMRenderContext.hx b/lime/graphics/DOMRenderContext.hx
index 7213c6300..32edea063 100644
--- a/lime/graphics/DOMRenderContext.hx
+++ b/lime/graphics/DOMRenderContext.hx
@@ -1,5 +1,5 @@
package lime.graphics;
-#if js
+#if html5
typedef DOMRenderContext = js.html.DivElement;
#else
diff --git a/lime/graphics/Font.hx b/lime/graphics/Font.hx
index 4dc7b0ae6..cb500d068 100644
--- a/lime/graphics/Font.hx
+++ b/lime/graphics/Font.hx
@@ -6,7 +6,7 @@ import lime.utils.ByteArray;
import lime.utils.UInt8Array;
import lime.system.System;
-#if js
+#if html5
import js.html.CanvasElement;
import js.html.CanvasRenderingContext2D;
#end
@@ -37,7 +37,7 @@ class Font {
glyphs = new Map>();
- #if js
+ #if html5
/*
if (__canvas == null) {
@@ -169,7 +169,7 @@ class Font {
return new ImageBuffer (bd, bd.width, bd.height);*/
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
var data = lime_font_create_image (__handle);
@@ -211,7 +211,7 @@ class Font {
public function decompose ():NativeFontData {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
return lime_font_outline_decompose (__handle, 1024 * 20);
@@ -248,7 +248,7 @@ class Font {
// this.glyphs = glyphs;
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
lime_font_load_range (__handle, size, start, end);
@@ -269,7 +269,7 @@ class Font {
//this.glyphs = glyphs;
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
lime_font_load_glyphs (__handle, size, glyphs);
@@ -282,7 +282,7 @@ class Font {
__fontPath = path;
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
__handle = lime_font_load (__fontPath);
@@ -297,7 +297,7 @@ class Font {
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_font_get_family_name = System.load ("lime", "lime_font_get_family_name", 1);
private static var lime_font_load = System.load ("lime", "lime_font_load", 1);
private static var lime_font_load_glyphs = System.load ("lime", "lime_font_load_glyphs", 3);
diff --git a/lime/graphics/GLRenderContext.hx b/lime/graphics/GLRenderContext.hx
index 9c4327610..1f2d821c9 100644
--- a/lime/graphics/GLRenderContext.hx
+++ b/lime/graphics/GLRenderContext.hx
@@ -1,4 +1,4 @@
-package lime.graphics; #if !js
+package lime.graphics; #if !html5
import lime.graphics.opengl.*;
diff --git a/lime/graphics/Image.hx b/lime/graphics/Image.hx
index 3370a05af..26cc25cde 100644
--- a/lime/graphics/Image.hx
+++ b/lime/graphics/Image.hx
@@ -15,7 +15,7 @@ import lime.utils.ByteArray;
import lime.utils.UInt8Array;
import lime.system.System;
-#if js
+#if html5
import js.html.CanvasElement;
import js.html.ImageElement;
import js.Browser;
@@ -30,7 +30,7 @@ import format.png.Reader;
import format.png.Tools;
import format.png.Writer;
import format.tools.Deflate;
-#if sys
+#if (sys || nodejs)
import sys.io.File;
#end
#end
@@ -146,7 +146,7 @@ class Image {
public function clone ():Image {
- #if js
+ #if html5
ImageCanvasUtil.sync (this);
#end
@@ -169,7 +169,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -205,7 +205,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -255,7 +255,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
ImageCanvasUtil.convertToData (sourceImage);
#end
@@ -284,7 +284,7 @@ class Image {
public function encode (format:String = "png"):ByteArray {
- #if (!js && !flash)
+ #if (!html5 && !flash)
#if format
switch (format) {
@@ -344,7 +344,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -374,7 +374,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -418,7 +418,7 @@ class Image {
}
- public static function fromCanvas (canvas:#if js CanvasElement #else Dynamic #end):Image {
+ public static function fromCanvas (canvas:#if html5 CanvasElement #else Dynamic #end):Image {
var buffer = new ImageBuffer (null, canvas.width, canvas.height);
buffer.src = canvas;
@@ -436,7 +436,7 @@ class Image {
}
- public static function fromImageElement (image:#if js ImageElement #else Dynamic #end):Image {
+ public static function fromImageElement (image:#if html5 ImageElement #else Dynamic #end):Image {
var buffer = new ImageBuffer (null, image.width, image.height);
buffer.src = image;
@@ -457,7 +457,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -488,7 +488,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -519,7 +519,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -588,7 +588,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -617,7 +617,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -647,7 +647,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -667,7 +667,7 @@ class Image {
private static function __base64Encode (bytes:ByteArray):String {
- #if js
+ #if html5
var extension = switch (bytes.length % 3) {
case 1: "==";
@@ -735,7 +735,7 @@ class Image {
private function __fromBase64 (base64:String, type:String, onload:Image -> Void = null):Void {
- #if js
+ #if html5
var image:ImageElement = cast Browser.document.createElement ("img");
var image_onLoaded = function (event) {
@@ -765,7 +765,7 @@ class Image {
private function __fromBytes (bytes:ByteArray, onload:Image -> Void):Void {
- #if js
+ #if html5
var type = "";
@@ -789,7 +789,7 @@ class Image {
__fromBase64 (__base64Encode (bytes), type, onload);
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
var data = lime_image_load (bytes);
@@ -816,7 +816,7 @@ class Image {
private function __fromFile (path:String, onload:Image -> Void, onerror:Void -> Void):Void {
- #if js
+ #if html5
var image = cast Browser.document.createElement ("img");
@@ -849,16 +849,24 @@ class Image {
// (issue #1019768)
if (image.complete) { }
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
var buffer = null;
#if (sys && (!disable_cffi || !format))
var data = lime_image_load (path);
- if (data != null) buffer = new ImageBuffer (new UInt8Array (data.data), data.width, data.height, data.bpp);
+ if (data != null) {
+ var ba:ByteArray = cast(data.data, ByteArray);
+ #if nodejs
+ var u8a = ba.byteView;
+ #else
+ var u8a = new UInt8Array(ba);
+ #end
+ buffer = new ImageBuffer (u8a, data.width, data.height, data.bpp);
+ }
- #else
+ #elseif format
try {
@@ -978,7 +986,7 @@ class Image {
if (buffer.data == null && buffer.width > 0 && buffer.height > 0) {
- #if js
+ #if html5
ImageCanvasUtil.convertToCanvas (this);
ImageCanvasUtil.createImageData (this);
#elseif flash
@@ -1072,7 +1080,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -1090,7 +1098,7 @@ class Image {
case DATA:
- #if js
+ #if html5
ImageCanvasUtil.convertToData (this);
#end
@@ -1153,7 +1161,7 @@ class Image {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_image_load:Dynamic = System.load ("lime", "lime_image_load", 1);
#end
diff --git a/lime/graphics/ImageBuffer.hx b/lime/graphics/ImageBuffer.hx
index 4dbb76418..cccd9bdad 100644
--- a/lime/graphics/ImageBuffer.hx
+++ b/lime/graphics/ImageBuffer.hx
@@ -3,7 +3,7 @@ package lime.graphics;
import lime.utils.UInt8Array;
-#if js
+#if html5
import js.html.CanvasElement;
import js.html.CanvasRenderingContext2D;
import js.html.Image in HTMLImage;
@@ -27,11 +27,11 @@ class ImageBuffer {
public var width:Int;
@:noCompletion private var __srcBitmapData:#if flash BitmapData #else Dynamic #end;
- @:noCompletion private var __srcCanvas:#if js CanvasElement #else Dynamic #end;
- @:noCompletion private var __srcContext:#if js CanvasRenderingContext2D #else Dynamic #end;
+ @:noCompletion private var __srcCanvas:#if html5 CanvasElement #else Dynamic #end;
+ @:noCompletion private var __srcContext:#if html5 CanvasRenderingContext2D #else Dynamic #end;
@:noCompletion private var __srcCustom:Dynamic;
- @:noCompletion private var __srcImage:#if js HTMLImage #else Dynamic #end;
- @:noCompletion private var __srcImageData:#if js ImageData #else Dynamic #end;
+ @:noCompletion private var __srcImage:#if html5 HTMLImage #else Dynamic #end;
+ @:noCompletion private var __srcImageData:#if html5 ImageData #else Dynamic #end;
public function new (data:UInt8Array = null, width:Int = 0, height:Int = 0, bitsPerPixel:Int = 4) {
@@ -65,7 +65,7 @@ class ImageBuffer {
private function get_src ():Dynamic {
- #if js
+ #if html5
if (__srcImage != null) return __srcImage;
return __srcCanvas;
#elseif flash
@@ -79,7 +79,7 @@ class ImageBuffer {
private function set_src (value:Dynamic):Dynamic {
- #if js
+ #if html5
if (Std.is (value, HTMLImage)) {
__srcImage = cast value;
diff --git a/lime/graphics/Renderer.hx b/lime/graphics/Renderer.hx
index 4a9153a72..7d77ef327 100644
--- a/lime/graphics/Renderer.hx
+++ b/lime/graphics/Renderer.hx
@@ -8,7 +8,7 @@ import lime.graphics.GLRenderContext;
import lime.system.System;
import lime.ui.Window;
-#if js
+#if html5
import js.html.webgl.RenderingContext;
#elseif flash
import flash.Lib;
@@ -44,7 +44,7 @@ class Renderer {
public function create ():Void {
- #if js
+ #if html5
if (window.div != null) {
@@ -82,7 +82,7 @@ class Renderer {
#end
GL.context = webgl;
- #if js
+ #if html5
context = OPENGL (cast GL.context);
#else
context = OPENGL (new GLRenderContext ());
@@ -92,7 +92,7 @@ class Renderer {
}
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
handle = lime_renderer_create (window.handle);
context = OPENGL (new GLRenderContext ());
@@ -107,7 +107,7 @@ class Renderer {
registered = true;
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_render_event_manager_register (dispatch, eventInfo);
#end
@@ -149,14 +149,14 @@ class Renderer {
public function flip ():Void {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_renderer_flip (handle);
#end
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_render_event_manager_register = System.load ("lime", "lime_render_event_manager_register", 2);
private static var lime_renderer_create = System.load ("lime", "lime_renderer_create", 1);
private static var lime_renderer_flip = System.load ("lime", "lime_renderer_flip", 1);
diff --git a/lime/graphics/TextFormat.hx b/lime/graphics/TextFormat.hx
index 7532ef205..248d9ae4e 100644
--- a/lime/graphics/TextFormat.hx
+++ b/lime/graphics/TextFormat.hx
@@ -174,7 +174,7 @@ class TextFormat {
public var direction(default, null):TextDirection;
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
public var handle:Dynamic;
@@ -182,7 +182,7 @@ class TextFormat {
public function new (direction:TextDirection, script:TextScript, language:String) {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
handle = lime_text_create (direction, script, language);
@@ -194,7 +194,7 @@ class TextFormat {
public function fromString (font:Font, size:Int, text:String):Array {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
return lime_text_from_string (handle, font.handle, size, text);
@@ -202,7 +202,7 @@ class TextFormat {
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_text_create = System.load ("lime", "lime_text_create", 3);
private static var lime_text_from_string = System.load ("lime", "lime_text_from_string", 4);
#end
diff --git a/lime/graphics/opengl/GL.hx b/lime/graphics/opengl/GL.hx
index 97940a591..04dc3a467 100644
--- a/lime/graphics/opengl/GL.hx
+++ b/lime/graphics/opengl/GL.hx
@@ -8,7 +8,7 @@ import lime.utils.IMemoryRange;
import lime.utils.Int32Array;
import lime.system.System;
-#if js
+#if html5
import js.html.webgl.RenderingContext;
#end
@@ -366,16 +366,16 @@ class GL {
public static var version (get, null):Int;
- #if js
+ #if html5
private static var context:RenderingContext;
#end
public static inline function activeTexture (texture:Int):Void {
- #if js
+ #if html5
context.activeTexture (texture);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_active_texture (texture);
#end
@@ -384,9 +384,9 @@ class GL {
public static inline function attachShader (program:GLProgram, shader:GLShader):Void {
- #if js
+ #if html5
context.attachShader (program, shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
program.attach (shader);
lime_gl_attach_shader (program.id, shader.id);
#end
@@ -396,9 +396,9 @@ class GL {
public static inline function bindAttribLocation (program:GLProgram, index:Int, name:String):Void {
- #if js
+ #if html5
context.bindAttribLocation (program, index, name);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_bind_attrib_location (program.id, index, name);
#end
@@ -407,9 +407,9 @@ class GL {
public static inline function bindBuffer (target:Int, buffer:GLBuffer):Void {
- #if js
+ #if html5
context.bindBuffer (target, buffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_bind_buffer (target, buffer == null ? 0 : buffer.id);
#end
@@ -418,9 +418,9 @@ class GL {
public static inline function bindFramebuffer (target:Int, framebuffer:GLFramebuffer):Void {
- #if js
+ #if html5
context.bindFramebuffer (target, framebuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_bind_framebuffer (target, framebuffer == null ? 0 : framebuffer.id);
#end
@@ -429,9 +429,9 @@ class GL {
public static inline function bindRenderbuffer (target:Int, renderbuffer:GLRenderbuffer):Void {
- #if js
+ #if html5
context.bindRenderbuffer (target, renderbuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_bind_renderbuffer (target, renderbuffer == null ? 0 : renderbuffer.id);
#end
@@ -440,9 +440,9 @@ class GL {
public static inline function bindTexture (target:Int, texture:GLTexture):Void {
- #if js
+ #if html5
context.bindTexture (target, texture);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_bind_texture(target, texture == null ? 0 : texture.id);
#end
@@ -451,9 +451,9 @@ class GL {
public static inline function blendColor (red:Float, green:Float, blue:Float, alpha:Float):Void {
- #if js
+ #if html5
context.blendColor (red, green, blue, alpha);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_blend_color (red, green, blue, alpha);
#end
@@ -462,9 +462,9 @@ class GL {
public static inline function blendEquation (mode:Int):Void {
- #if js
+ #if html5
context.blendEquation (mode);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_blend_equation (mode);
#end
@@ -473,9 +473,9 @@ class GL {
public static inline function blendEquationSeparate (modeRGB:Int, modeAlpha:Int):Void {
- #if js
+ #if html5
context.blendEquationSeparate (modeRGB, modeAlpha);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_blend_equation_separate (modeRGB, modeAlpha);
#end
@@ -484,9 +484,9 @@ class GL {
public static inline function blendFunc (sfactor:Int, dfactor:Int):Void {
- #if js
+ #if html5
context.blendFunc (sfactor, dfactor);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_blend_func (sfactor, dfactor);
#end
@@ -495,9 +495,9 @@ class GL {
public static inline function blendFuncSeparate (srcRGB:Int, dstRGB:Int, srcAlpha:Int, dstAlpha:Int):Void {
- #if js
+ #if html5
context.blendFuncSeparate (srcRGB, dstRGB, srcAlpha, dstAlpha);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_blend_func_separate (srcRGB, dstRGB, srcAlpha, dstAlpha);
#end
@@ -506,10 +506,12 @@ class GL {
public static inline function bufferData (target:Int, data:ArrayBufferView, usage:Int):Void {
- #if js
+ #if html5
context.bufferData (target, data, usage);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_buffer_data (target, data.getByteBuffer (), data.getStart (), data.getLength (), usage);
+ #elseif (nodejs && lime_opengl)
+ lime_gl_buffer_data (target, data, data.byteOffset, data.byteLength, usage);
#end
}
@@ -517,10 +519,12 @@ class GL {
public static inline function bufferSubData (target:Int, offset:Int, data:ArrayBufferView):Void {
- #if js
+ #if html5
context.bufferSubData (target, offset, data);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_buffer_sub_data (target, offset, data.getByteBuffer (), data.getStart (), data.getLength ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_buffer_sub_data (target, offset, data, data.byteOffset, data.byteLength);
#end
}
@@ -528,9 +532,9 @@ class GL {
public static inline function checkFramebufferStatus (target:Int):Int {
- #if js
+ #if html5
return context.checkFramebufferStatus (target);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_check_framebuffer_status (target);
#else
return 0;
@@ -541,9 +545,9 @@ class GL {
public static inline function clear (mask:Int):Void {
- #if js
+ #if html5
context.clear (mask);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_clear (mask);
#end
@@ -552,9 +556,9 @@ class GL {
public static inline function clearColor (red:Float, green:Float, blue:Float, alpha:Float):Void {
- #if js
+ #if html5
context.clearColor (red, green, blue, alpha);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_clear_color (red, green, blue, alpha);
#end
@@ -563,9 +567,9 @@ class GL {
public static inline function clearDepth (depth:Float):Void {
- #if js
+ #if html5
context.clearDepth (depth);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_clear_depth (depth);
#end
@@ -574,9 +578,9 @@ class GL {
public static inline function clearStencil (s:Int):Void {
- #if js
+ #if html5
context.clearStencil (s);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_clear_stencil (s);
#end
@@ -585,9 +589,9 @@ class GL {
public static inline function colorMask (red:Bool, green:Bool, blue:Bool, alpha:Bool):Void {
- #if js
+ #if html5
context.colorMask (red, green, blue, alpha);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_color_mask (red, green, blue, alpha);
#end
@@ -596,9 +600,9 @@ class GL {
public static inline function compileShader (shader:GLShader):Void {
- #if js
+ #if html5
context.compileShader (shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_compile_shader (shader.id);
#end
@@ -607,10 +611,12 @@ class GL {
public static inline function compressedTexImage2D (target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, data:ArrayBufferView):Void {
- #if js
+ #if html5
context.compressedTexImage2D (target, level, internalformat, width, height, border, data);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_compressed_tex_image_2d (target, level, internalformat, width, height, border, data == null ? null : data.getByteBuffer (), data == null ? null : data.getStart ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_compressed_tex_image_2d (target, level, internalformat, width, height, border, data == null ? null : data.buffer , data == null ? null : data.byteOffset);
#end
}
@@ -618,10 +624,12 @@ class GL {
public static inline function compressedTexSubImage2D (target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, data:ArrayBufferView):Void {
- #if js
+ #if html5
context.compressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, data);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_compressed_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, data == null ? null : data.getByteBuffer (), data == null ? null : data.getStart ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_compressed_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, data == null ? null : data.buffer, data == null ? null : data.byteOffset);
#end
}
@@ -629,9 +637,9 @@ class GL {
public static inline function copyTexImage2D (target:Int, level:Int, internalformat:Int, x:Int, y:Int, width:Int, height:Int, border:Int):Void {
- #if js
+ #if html5
context.copyTexImage2D (target, level, internalformat, x, y, width, height, border);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_copy_tex_image_2d (target, level, internalformat, x, y, width, height, border);
#end
@@ -640,9 +648,9 @@ class GL {
public static inline function copyTexSubImage2D (target:Int, level:Int, xoffset:Int, yoffset:Int, x:Int, y:Int, width:Int, height:Int):Void {
- #if js
+ #if html5
context.copyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, height);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_copy_tex_sub_image_2d (target, level, xoffset, yoffset, x, y, width, height);
#end
@@ -651,9 +659,9 @@ class GL {
public static inline function createBuffer ():GLBuffer {
- #if js
+ #if html5
return context.createBuffer ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return new GLBuffer (version, lime_gl_create_buffer ());
#else
return null;
@@ -664,9 +672,9 @@ class GL {
public static inline function createFramebuffer ():GLFramebuffer {
- #if js
+ #if html5
return context.createFramebuffer ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return new GLFramebuffer (version, lime_gl_create_framebuffer ());
#else
return null;
@@ -677,9 +685,9 @@ class GL {
public static inline function createProgram ():GLProgram {
- #if js
+ #if html5
return context.createProgram ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return new GLProgram (version, lime_gl_create_program ());
#else
return null;
@@ -690,9 +698,9 @@ class GL {
public static inline function createRenderbuffer ():GLRenderbuffer {
- #if js
+ #if html5
return context.createRenderbuffer ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return new GLRenderbuffer (version, lime_gl_create_render_buffer ());
#else
return null;
@@ -703,9 +711,9 @@ class GL {
public static inline function createShader (type:Int):GLShader {
- #if js
+ #if html5
return context.createShader (type);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return new GLShader (version, lime_gl_create_shader (type));
#else
return null;
@@ -716,9 +724,9 @@ class GL {
public static inline function createTexture ():GLTexture {
- #if js
+ #if html5
return context.createTexture ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return new GLTexture (version, lime_gl_create_texture ());
#else
return null;
@@ -729,9 +737,9 @@ class GL {
public static inline function cullFace (mode:Int):Void {
- #if js
+ #if html5
context.cullFace (mode);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_cull_face (mode);
#end
@@ -740,9 +748,9 @@ class GL {
public static inline function deleteBuffer (buffer:GLBuffer):Void {
- #if js
+ #if html5
context.deleteBuffer (buffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_delete_buffer (buffer.id);
buffer.invalidate ();
#end
@@ -752,9 +760,9 @@ class GL {
public static inline function deleteFramebuffer (framebuffer:GLFramebuffer):Void {
- #if js
+ #if html5
context.deleteFramebuffer (framebuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_delete_framebuffer (framebuffer.id);
framebuffer.invalidate ();
#end
@@ -764,9 +772,9 @@ class GL {
public static inline function deleteProgram (program:GLProgram):Void {
- #if js
+ #if html5
context.deleteProgram (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_delete_program (program.id);
program.invalidate ();
#end
@@ -776,9 +784,9 @@ class GL {
public static inline function deleteRenderbuffer (renderbuffer:GLRenderbuffer):Void {
- #if js
+ #if html5
context.deleteRenderbuffer (renderbuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_delete_render_buffer (renderbuffer.id);
renderbuffer.invalidate ();
#end
@@ -788,9 +796,9 @@ class GL {
public static inline function deleteShader (shader:GLShader):Void {
- #if js
+ #if html5
context.deleteShader (shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_delete_shader (shader.id);
shader.invalidate ();
#end
@@ -800,9 +808,9 @@ class GL {
public static inline function deleteTexture (texture:GLTexture):Void {
- #if js
+ #if html5
context.deleteTexture (texture);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_delete_texture (texture.id);
texture.invalidate ();
#end
@@ -812,9 +820,9 @@ class GL {
public static inline function depthFunc (func:Int):Void {
- #if js
+ #if html5
context.depthFunc (func);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_depth_func (func);
#end
@@ -823,9 +831,9 @@ class GL {
public static inline function depthMask (flag:Bool):Void {
- #if js
+ #if html5
context.depthMask (flag);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_depth_mask (flag);
#end
@@ -834,9 +842,9 @@ class GL {
public static inline function depthRange (zNear:Float, zFar:Float):Void {
- #if js
+ #if html5
context.depthRange (zNear, zFar);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_depth_range (zNear, zFar);
#end
@@ -845,9 +853,9 @@ class GL {
public static inline function detachShader (program:GLProgram, shader:GLShader):Void {
- #if js
+ #if html5
context.detachShader (program, shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_detach_shader (program.id, shader.id);
#end
@@ -856,9 +864,9 @@ class GL {
public static inline function disable (cap:Int):Void {
- #if js
+ #if html5
context.disable (cap);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_disable (cap);
#end
@@ -867,9 +875,9 @@ class GL {
public static inline function disableVertexAttribArray (index:Int):Void {
- #if js
+ #if html5
context.disableVertexAttribArray (index);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_disable_vertex_attrib_array (index);
#end
@@ -878,9 +886,9 @@ class GL {
public static inline function drawArrays (mode:Int, first:Int, count:Int):Void {
- #if js
+ #if html5
context.drawArrays (mode, first, count);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_draw_arrays (mode, first, count);
#end
@@ -889,9 +897,9 @@ class GL {
public static inline function drawElements (mode:Int, count:Int, type:Int, offset:Int):Void {
- #if js
+ #if html5
context.drawElements (mode, count, type, offset);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_draw_elements (mode, count, type, offset);
#end
@@ -900,9 +908,9 @@ class GL {
public static inline function enable (cap:Int):Void {
- #if js
+ #if html5
context.enable (cap);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_enable (cap);
#end
@@ -911,9 +919,9 @@ class GL {
public static inline function enableVertexAttribArray (index:Int):Void {
- #if js
+ #if html5
context.enableVertexAttribArray (index);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_enable_vertex_attrib_array (index);
#end
@@ -922,9 +930,9 @@ class GL {
public static inline function finish ():Void {
- #if js
+ #if html5
context.finish ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_finish ();
#end
@@ -933,9 +941,9 @@ class GL {
public static inline function flush ():Void {
- #if js
+ #if html5
context.flush ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_flush ();
#end
@@ -944,9 +952,9 @@ class GL {
public static inline function framebufferRenderbuffer (target:Int, attachment:Int, renderbuffertarget:Int, renderbuffer:GLRenderbuffer):Void {
- #if js
+ #if html5
context.framebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_framebuffer_renderbuffer (target, attachment, renderbuffertarget, renderbuffer.id);
#end
@@ -955,9 +963,9 @@ class GL {
public static inline function framebufferTexture2D (target:Int, attachment:Int, textarget:Int, texture:GLTexture, level:Int):Void {
- #if js
+ #if html5
context.framebufferTexture2D (target, attachment, textarget, texture, level);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_framebuffer_texture2D (target, attachment, textarget, texture.id, level);
#end
@@ -966,9 +974,9 @@ class GL {
public static inline function frontFace (mode:Int):Void {
- #if js
+ #if html5
context.frontFace (mode);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_front_face (mode);
#end
@@ -977,9 +985,9 @@ class GL {
public static inline function generateMipmap (target:Int):Void {
- #if js
+ #if html5
context.generateMipmap (target);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_generate_mipmap (target);
#end
@@ -988,9 +996,9 @@ class GL {
public static inline function getActiveAttrib (program:GLProgram, index:Int):GLActiveInfo {
- #if js
+ #if html5
return context.getActiveAttrib (program, index);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_active_attrib (program.id, index);
#else
return null;
@@ -1001,9 +1009,9 @@ class GL {
public static inline function getActiveUniform (program:GLProgram, index:Int):GLActiveInfo {
- #if js
+ #if html5
return context.getActiveUniform (program, index);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_active_uniform (program.id, index);
#else
return null;
@@ -1014,9 +1022,9 @@ class GL {
public static inline function getAttachedShaders (program:GLProgram):Array {
- #if js
+ #if html5
return context.getAttachedShaders (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return program.getShaders ();
#else
return null;
@@ -1027,9 +1035,9 @@ class GL {
public static inline function getAttribLocation (program:GLProgram, name:String):Int {
- #if js
+ #if html5
return context.getAttribLocation (program, name);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_attrib_location (program.id, name);
#else
return 0;
@@ -1040,9 +1048,9 @@ class GL {
public static inline function getBufferParameter (target:Int, pname:Int):Int /*Dynamic*/ {
- #if js
+ #if html5
return context.getBufferParameter (target, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_buffer_paramerter (target, pname);
#else
return 0;
@@ -1053,9 +1061,9 @@ class GL {
public static inline function getContextAttributes ():GLContextAttributes {
- #if js
+ #if html5
return context.getContextAttributes ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
var base = lime_gl_get_context_attributes ();
base.premultipliedAlpha = false;
base.preserveDrawingBuffer = false;
@@ -1069,9 +1077,9 @@ class GL {
public static inline function getError ():Int {
- #if js
+ #if html5
return context.getError ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_error ();
#else
return 0;
@@ -1082,9 +1090,9 @@ class GL {
public static inline function getExtension (name:String):Dynamic {
- #if js
+ #if html5
return context.getExtension (name);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
//todo?!
return null;
// return lime_gl_get_extension(name);
@@ -1097,9 +1105,9 @@ class GL {
public static inline function getFramebufferAttachmentParameter (target:Int, attachment:Int, pname:Int):Int /*Dynamic*/ {
- #if js
+ #if html5
return context.getFramebufferAttachmentParameter (target, attachment, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_framebuffer_attachment_parameter (target, attachment, pname);
#else
return 0;
@@ -1110,9 +1118,9 @@ class GL {
public static inline function getParameter (pname:Int):Dynamic {
- #if js
+ #if html5
return context.getParameter (pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_parameter (pname);
#else
return null;
@@ -1123,9 +1131,9 @@ class GL {
public static inline function getProgramInfoLog (program:GLProgram):String {
- #if js
+ #if html5
return context.getProgramInfoLog (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_program_info_log (program.id);
#else
return null;
@@ -1136,9 +1144,9 @@ class GL {
public static inline function getProgramParameter (program:GLProgram, pname:Int):Int {
- #if js
+ #if html5
return context.getProgramParameter (program, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_program_parameter (program.id, pname);
#else
return 0;
@@ -1149,9 +1157,9 @@ class GL {
public static inline function getRenderbufferParameter (target:Int, pname:Int):Int /*Dynamic*/ {
- #if js
+ #if html5
return context.getRenderbufferParameter (target, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_render_buffer_parameter (target, pname);
#else
return 0;
@@ -1162,9 +1170,9 @@ class GL {
public static inline function getShaderInfoLog (shader:GLShader):String {
- #if js
+ #if html5
return context.getShaderInfoLog (shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_shader_info_log (shader.id);
#else
return null;
@@ -1175,9 +1183,9 @@ class GL {
public static inline function getShaderParameter (shader:GLShader, pname:Int):Int {
- #if js
+ #if html5
return context.getShaderParameter (shader, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_shader_parameter (shader.id, pname);
#else
return 0;
@@ -1188,9 +1196,9 @@ class GL {
public static inline function getShaderPrecisionFormat (shadertype:Int, precisiontype:Int):GLShaderPrecisionFormat {
- #if js
+ #if html5
return context.getShaderPrecisionFormat (shadertype, precisiontype);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_shader_precision_format (shadertype, precisiontype);
#else
return null;
@@ -1201,9 +1209,9 @@ class GL {
public static inline function getShaderSource (shader:GLShader):String {
- #if js
+ #if html5
return context.getShaderSource (shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_shader_source (shader.id);
#else
return null;
@@ -1214,9 +1222,9 @@ class GL {
public static inline function getSupportedExtensions ():Array {
- #if js
+ #if html5
return context.getSupportedExtensions ();
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
var result = new Array ();
lime_gl_get_supported_extensions (result);
return result;
@@ -1229,9 +1237,9 @@ class GL {
public static inline function getTexParameter (target:Int, pname:Int):Int /*Dynamic*/ {
- #if js
+ #if html5
return context.getTexParameter (target, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_tex_parameter (target, pname);
#else
return 0;
@@ -1242,9 +1250,9 @@ class GL {
public static inline function getUniform (program:GLProgram, location:GLUniformLocation):Dynamic {
- #if js
+ #if html5
return context.getUniform (program, location);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_uniform (program.id, location);
#else
return null;
@@ -1255,9 +1263,9 @@ class GL {
public static inline function getUniformLocation (program:GLProgram, name:String):GLUniformLocation {
- #if js
+ #if html5
return context.getUniformLocation (program, name);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_uniform_location (program.id, name);
#else
return 0;
@@ -1268,9 +1276,9 @@ class GL {
public static inline function getVertexAttrib (index:Int, pname:Int):Int /*Dynamic*/ {
- #if js
+ #if html5
return context.getVertexAttrib (index, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_vertex_attrib (index, pname);
#else
return 0;
@@ -1281,9 +1289,9 @@ class GL {
public static inline function getVertexAttribOffset (index:Int, pname:Int):Int {
- #if js
+ #if html5
return context.getVertexAttribOffset (index, pname);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_get_vertex_attrib_offset (index, pname);
#else
return 0;
@@ -1294,9 +1302,9 @@ class GL {
public static inline function hint (target:Int, mode:Int):Void {
- #if js
+ #if html5
context.hint (target, mode);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_hint (target, mode);
#end
@@ -1305,9 +1313,9 @@ class GL {
public static inline function isBuffer (buffer:GLBuffer):Bool {
- #if js
+ #if html5
return context.isBuffer (buffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return buffer != null && buffer.id > 0 && lime_gl_is_buffer (buffer.id);
#else
return false;
@@ -1322,9 +1330,9 @@ class GL {
public static inline function isEnabled (cap:Int):Bool {
- #if js
+ #if html5
return context.isEnabled (cap);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return lime_gl_is_enabled (cap);
#else
return false;
@@ -1335,9 +1343,9 @@ class GL {
public static inline function isFramebuffer (framebuffer:GLFramebuffer):Bool {
- #if js
+ #if html5
return context.isFramebuffer (framebuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return framebuffer != null && framebuffer.id > 0 && lime_gl_is_framebuffer (framebuffer.id);
#else
return false;
@@ -1348,9 +1356,9 @@ class GL {
public static inline function isProgram (program:GLProgram):Bool {
- #if js
+ #if html5
return context.isProgram (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return program != null && program.id > 0 && lime_gl_is_program (program.id);
#else
return false;
@@ -1361,9 +1369,9 @@ class GL {
public static inline function isRenderbuffer (renderbuffer:GLRenderbuffer):Bool {
- #if js
+ #if html5
return context.isRenderbuffer (renderbuffer);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return renderbuffer != null && renderbuffer.id > 0 && lime_gl_is_renderbuffer (renderbuffer.id);
#else
return false;
@@ -1374,9 +1382,9 @@ class GL {
public static inline function isShader (shader:GLShader):Bool {
- #if js
+ #if html5
return context.isShader (shader);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return shader != null && shader.id > 0 && lime_gl_is_shader (shader.id);
#else
return false;
@@ -1387,9 +1395,9 @@ class GL {
public static inline function isTexture (texture:GLTexture):Bool {
- #if js
+ #if html5
return context.isTexture (texture);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
return texture != null && texture.id > 0 && lime_gl_is_texture (texture.id);
#else
return false;
@@ -1400,9 +1408,9 @@ class GL {
public static inline function lineWidth (width:Float):Void {
- #if js
+ #if html5
context.lineWidth (width);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_line_width (width);
#end
@@ -1411,9 +1419,9 @@ class GL {
public static inline function linkProgram (program:GLProgram):Void {
- #if js
+ #if html5
context.linkProgram (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_link_program (program.id);
#end
@@ -1422,9 +1430,9 @@ class GL {
public static inline function pixelStorei (pname:Int, param:Int):Void {
- #if js
+ #if html5
context.pixelStorei (pname, param);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_pixel_storei (pname, param);
#end
@@ -1433,9 +1441,9 @@ class GL {
public static inline function polygonOffset (factor:Float, units:Float):Void {
- #if js
+ #if html5
context.polygonOffset (factor, units);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_polygon_offset (factor, units);
#end
@@ -1444,10 +1452,12 @@ class GL {
public static inline function readPixels (x:Int, y:Int, width:Int, height:Int, format:Int, type:Int, pixels:ArrayBufferView):Void {
- #if js
+ #if html5
context.readPixels (x, y, width, height, format, type, pixels);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_read_pixels (x, y, width, height, format, type, pixels == null ? null : pixels.getByteBuffer (), pixels == null ? null : pixels.getStart ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_read_pixels (x, y, width, height, format, type, pixels == null ? null : pixels.buffer, pixels == null ? null : pixels.byteOffset);
#end
}
@@ -1455,9 +1465,9 @@ class GL {
public static inline function renderbufferStorage (target:Int, internalformat:Int, width:Int, height:Int):Void {
- #if js
+ #if html5
context.renderbufferStorage (target, internalformat, width, height);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_renderbuffer_storage (target, internalformat, width, height);
#end
@@ -1466,9 +1476,9 @@ class GL {
public static inline function sampleCoverage (value:Float, invert:Bool):Void {
- #if js
+ #if html5
context.sampleCoverage (value, invert);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_sample_coverage (value, invert);
#end
@@ -1477,9 +1487,9 @@ class GL {
public static inline function scissor (x:Int, y:Int, width:Int, height:Int):Void {
- #if js
+ #if html5
context.scissor (x, y, width, height);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_scissor (x, y, width, height);
#end
@@ -1488,9 +1498,9 @@ class GL {
public static inline function shaderSource (shader:GLShader, source:String):Void {
- #if js
+ #if html5
context.shaderSource (shader, source);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_shader_source (shader.id, source);
#end
@@ -1499,9 +1509,9 @@ class GL {
public static inline function stencilFunc (func:Int, ref:Int, mask:Int):Void {
- #if js
+ #if html5
context.stencilFunc (func, ref, mask);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_stencil_func (func, ref, mask);
#end
@@ -1510,9 +1520,9 @@ class GL {
public static inline function stencilFuncSeparate (face:Int, func:Int, ref:Int, mask:Int):Void {
- #if js
+ #if html5
context.stencilFuncSeparate (face, func, ref, mask);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_stencil_func_separate (face, func, ref, mask);
#end
@@ -1521,9 +1531,9 @@ class GL {
public static inline function stencilMask (mask:Int):Void {
- #if js
+ #if html5
context.stencilMask (mask);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_stencil_mask (mask);
#end
@@ -1532,9 +1542,9 @@ class GL {
public static inline function stencilMaskSeparate (face:Int, mask:Int):Void {
- #if js
+ #if html5
context.stencilMaskSeparate (face, mask);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_stencil_mask_separate (face, mask);
#end
@@ -1543,9 +1553,9 @@ class GL {
public static inline function stencilOp (fail:Int, zfail:Int, zpass:Int):Void {
- #if js
+ #if html5
context.stencilOp (fail, zfail, zpass);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_stencil_op (fail, zfail, zpass);
#end
@@ -1554,9 +1564,9 @@ class GL {
public static inline function stencilOpSeparate (face:Int, fail:Int, zfail:Int, zpass:Int):Void {
- #if js
+ #if html5
context.stencilOpSeparate (face, fail, zfail, zpass);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_stencil_op_separate (face, fail, zfail, zpass);
#end
@@ -1565,10 +1575,12 @@ class GL {
public static inline function texImage2D (target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, pixels:ArrayBufferView):Void {
- #if js
+ #if html5
context.texImage2D (target, level, internalformat, width, height, border, format, type, pixels);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_tex_image_2d (target, level, internalformat, width, height, border, format, type, pixels == null ? null : pixels.getByteBuffer (), pixels == null ? null : pixels.getStart ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_tex_image_2d (target, level, internalformat, width, height, border, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset);
#end
}
@@ -1576,9 +1588,9 @@ class GL {
public static inline function texParameterf (target:Int, pname:Int, param:Float):Void {
- #if js
+ #if html5
context.texParameterf (target, pname, param);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_tex_parameterf (target, pname, param);
#end
@@ -1587,9 +1599,9 @@ class GL {
public static inline function texParameteri (target:Int, pname:Int, param:Int):Void {
- #if js
+ #if html5
context.texParameteri (target, pname, param);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_tex_parameteri (target, pname, param);
#end
@@ -1598,10 +1610,12 @@ class GL {
public static inline function texSubImage2D (target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, pixels:ArrayBufferView):Void {
- #if js
+ #if html5
context.texSubImage2D (target, level, xoffset, yoffset, width, height, format, type, pixels);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, type, pixels == null ? null : pixels.getByteBuffer(), pixels == null ? null : pixels.getStart());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, type, pixels == null ? null : pixels.buffer, pixels == null ? null : pixels.byteOffset);
#end
}
@@ -1609,9 +1623,9 @@ class GL {
public static inline function uniform1f (location:GLUniformLocation, x:Float):Void {
- #if js
+ #if html5
context.uniform1f (location, x);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform1f (location, x);
#end
@@ -1620,10 +1634,12 @@ class GL {
public static inline function uniform1fv (location:GLUniformLocation, x:Float32Array):Void {
- #if js
+ #if html5
context.uniform1fv (location, x);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform1fv (location, x.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform1fv (location, x.buffer);
#end
}
@@ -1631,9 +1647,9 @@ class GL {
public static inline function uniform1i (location:GLUniformLocation, x:Int):Void {
- #if js
+ #if html5
context.uniform1i (location, x);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform1i (location, x);
#end
@@ -1642,10 +1658,12 @@ class GL {
public static inline function uniform1iv (location:GLUniformLocation, v:Int32Array):Void {
- #if js
+ #if html5
context.uniform1iv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform1iv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform1iv (location, v.buffer);
#end
}
@@ -1653,9 +1671,9 @@ class GL {
public static inline function uniform2f (location:GLUniformLocation, x:Float, y:Float):Void {
- #if js
+ #if html5
context.uniform2f (location, x, y);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform2f (location, x, y);
#end
@@ -1664,10 +1682,12 @@ class GL {
public static inline function uniform2fv (location:GLUniformLocation, v:Float32Array):Void {
- #if js
+ #if html5
context.uniform2fv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform2fv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform2fv (location, v.buffer);
#end
}
@@ -1675,9 +1695,9 @@ class GL {
public static inline function uniform2i (location:GLUniformLocation, x:Int, y:Int):Void {
- #if js
+ #if html5
context.uniform2i (location, x, y);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform2i (location, x, y);
#end
@@ -1686,10 +1706,12 @@ class GL {
public static inline function uniform2iv (location:GLUniformLocation, v:Int32Array):Void {
- #if js
+ #if html5
context.uniform2iv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform2iv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform2iv (location, v.buffer);
#end
}
@@ -1697,9 +1719,9 @@ class GL {
public static inline function uniform3f (location:GLUniformLocation, x:Float, y:Float, z:Float):Void {
- #if js
+ #if html5
context.uniform3f (location, x, y, z);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform3f (location, x, y, z);
#end
@@ -1708,10 +1730,12 @@ class GL {
public static inline function uniform3fv (location:GLUniformLocation, v:Float32Array):Void {
- #if js
+ #if html5
context.uniform3fv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform3fv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform3fv (location, v.buffer);
#end
}
@@ -1719,9 +1743,9 @@ class GL {
public static inline function uniform3i (location:GLUniformLocation, x:Int, y:Int, z:Int):Void {
- #if js
+ #if html5
context.uniform3i (location, x, y, z);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform3i (location, x, y, z);
#end
@@ -1730,10 +1754,12 @@ class GL {
public static inline function uniform3iv (location:GLUniformLocation, v:Int32Array):Void {
- #if js
+ #if html5
context.uniform3iv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform3iv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform3iv (location, v.buffer);
#end
}
@@ -1741,9 +1767,9 @@ class GL {
public static inline function uniform4f (location:GLUniformLocation, x:Float, y:Float, z:Float, w:Float):Void {
- #if js
+ #if html5
context.uniform4f (location, x, y, z, w);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform4f (location, x, y, z, w);
#end
@@ -1752,10 +1778,12 @@ class GL {
public static inline function uniform4fv (location:GLUniformLocation, v:Float32Array):Void {
- #if js
+ #if html5
context.uniform4fv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform4fv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform4fv (location, v.buffer);
#end
}
@@ -1763,9 +1791,9 @@ class GL {
public static inline function uniform4i (location:GLUniformLocation, x:Int, y:Int, z:Int, w:Int):Void {
- #if js
+ #if html5
context.uniform4i (location, x, y, z, w);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_uniform4i (location, x, y, z, w);
#end
@@ -1774,10 +1802,12 @@ class GL {
public static inline function uniform4iv (location:GLUniformLocation, v:Int32Array):Void {
- #if js
+ #if html5
context.uniform4iv (location, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform4iv (location, v.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform4iv (location, v.buffer);
#end
}
@@ -1785,10 +1815,12 @@ class GL {
public static inline function uniformMatrix2fv (location:GLUniformLocation, transpose:Bool, v:Float32Array):Void {
- #if js
+ #if html5
context.uniformMatrix2fv (location, transpose, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform_matrix (location, transpose, v.getByteBuffer (), 2);
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform_matrix (location, transpose, v.buffer, 2);
#end
}
@@ -1796,10 +1828,12 @@ class GL {
public static inline function uniformMatrix3fv (location:GLUniformLocation, transpose:Bool, v:Float32Array):Void {
- #if js
+ #if html5
context.uniformMatrix3fv (location, transpose, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform_matrix (location, transpose, v.getByteBuffer (), 3);
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform_matrix (location, transpose, v.buffer, 3);
#end
}
@@ -1807,10 +1841,12 @@ class GL {
public static inline function uniformMatrix4fv (location:GLUniformLocation, transpose:Bool, v:Float32Array):Void {
- #if js
+ #if html5
context.uniformMatrix4fv (location, transpose, v);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_uniform_matrix (location, transpose, v.getByteBuffer (), 4);
+ #elseif (nodejs && lime_opengl)
+ lime_gl_uniform_matrix (location, transpose, v.buffer, 4);
#end
}
@@ -1825,9 +1861,9 @@ class GL {
public static inline function useProgram (program:GLProgram):Void {
- #if js
+ #if html5
context.useProgram (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_use_program (program == null ? 0 : program.id);
#end
@@ -1836,9 +1872,9 @@ class GL {
public static inline function validateProgram (program:GLProgram):Void {
- #if js
+ #if html5
context.validateProgram (program);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_validate_program (program.id);
#end
@@ -1847,9 +1883,9 @@ class GL {
public static inline function vertexAttrib1f (indx:Int, x:Float):Void {
- #if js
+ #if html5
context.vertexAttrib1f (indx, x);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_vertex_attrib1f (indx, x);
#end
@@ -1858,10 +1894,12 @@ class GL {
public static inline function vertexAttrib1fv (indx:Int, values:Float32Array):Void {
- #if js
+ #if html5
context.vertexAttrib1fv (indx, values);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_vertex_attrib1fv (indx, values.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_vertex_attrib1fv (indx, values.buffer);
#end
}
@@ -1869,9 +1907,9 @@ class GL {
public static inline function vertexAttrib2f (indx:Int, x:Float, y:Float):Void {
- #if js
+ #if html5
context.vertexAttrib2f (indx, x, y);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_vertex_attrib2f (indx, x, y);
#end
@@ -1880,10 +1918,12 @@ class GL {
public static inline function vertexAttrib2fv (indx:Int, values:Float32Array):Void {
- #if js
+ #if html5
context.vertexAttrib2fv (indx, values);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_vertex_attrib2fv (indx, values.getByteBuffer());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_vertex_attrib2fv (indx, values.buffer);
#end
}
@@ -1891,9 +1931,9 @@ class GL {
public static inline function vertexAttrib3f (indx:Int, x:Float, y:Float, z:Float):Void {
- #if js
+ #if html5
context.vertexAttrib3f (indx, x, y, z);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_vertex_attrib3f (indx, x, y, z);
#end
@@ -1902,10 +1942,12 @@ class GL {
public static inline function vertexAttrib3fv (indx:Int, values:Float32Array):Void {
- #if js
+ #if html5
context.vertexAttrib3fv (indx, values);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_vertex_attrib3fv (indx, values.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_vertex_attrib3fv (indx, values.buffer);
#end
}
@@ -1913,9 +1955,9 @@ class GL {
public static inline function vertexAttrib4f (indx:Int, x:Float, y:Float, z:Float, w:Float):Void {
- #if js
+ #if html5
context.vertexAttrib4f (indx, x, y, z, w);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_vertex_attrib4f (indx, x, y, z, w);
#end
@@ -1924,10 +1966,12 @@ class GL {
public static inline function vertexAttrib4fv (indx:Int, values:Float32Array):Void {
- #if js
+ #if html5
context.vertexAttrib4fv (indx, values);
#elseif ((cpp || neko) && lime_opengl)
lime_gl_vertex_attrib4fv (indx, values.getByteBuffer ());
+ #elseif (nodejs && lime_opengl)
+ lime_gl_vertex_attrib4fv (indx, values.buffer);
#end
}
@@ -1935,9 +1979,9 @@ class GL {
public static inline function vertexAttribPointer (indx:Int, size:Int, type:Int, normalized:Bool, stride:Int, offset:Int):Void {
- #if js
+ #if html5
context.vertexAttribPointer (indx, size, type, normalized, stride, offset);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_vertex_attrib_pointer (indx, size, type, normalized, stride, offset);
#end
@@ -1946,9 +1990,9 @@ class GL {
public static inline function viewport (x:Int, y:Int, width:Int, height:Int):Void {
- #if js
+ #if html5
context.viewport (x, y, width, height);
- #elseif ((cpp || neko) && lime_opengl)
+ #elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_viewport (x, y, width, height);
#end
@@ -1958,7 +2002,7 @@ class GL {
private static function get_version ():Int { return 2; }
- #if ((cpp || neko) && lime_opengl)
+ #if ((cpp || neko || nodejs) && lime_opengl)
private static var lime_gl_active_texture = System.load ("lime", "lime_gl_active_texture", 1);
private static var lime_gl_attach_shader = System.load ("lime", "lime_gl_attach_shader", 2);
diff --git a/lime/graphics/opengl/GLActiveInfo.hx b/lime/graphics/opengl/GLActiveInfo.hx
index eef699ca0..e53c6258d 100644
--- a/lime/graphics/opengl/GLActiveInfo.hx
+++ b/lime/graphics/opengl/GLActiveInfo.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
typedef GLActiveInfo = {
diff --git a/lime/graphics/opengl/GLBuffer.hx b/lime/graphics/opengl/GLBuffer.hx
index b83f23bfe..089f88c3b 100644
--- a/lime/graphics/opengl/GLBuffer.hx
+++ b/lime/graphics/opengl/GLBuffer.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
class GLBuffer extends GLObject {
diff --git a/lime/graphics/opengl/GLContextAttributes.hx b/lime/graphics/opengl/GLContextAttributes.hx
index bdb9cbf0b..487002536 100644
--- a/lime/graphics/opengl/GLContextAttributes.hx
+++ b/lime/graphics/opengl/GLContextAttributes.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
typedef GLContextAttributes = {
diff --git a/lime/graphics/opengl/GLFramebuffer.hx b/lime/graphics/opengl/GLFramebuffer.hx
index 847df1870..431bf585e 100644
--- a/lime/graphics/opengl/GLFramebuffer.hx
+++ b/lime/graphics/opengl/GLFramebuffer.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
class GLFramebuffer extends GLObject {
diff --git a/lime/graphics/opengl/GLProgram.hx b/lime/graphics/opengl/GLProgram.hx
index ad31f7cad..fd2367131 100644
--- a/lime/graphics/opengl/GLProgram.hx
+++ b/lime/graphics/opengl/GLProgram.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
class GLProgram extends GLObject {
diff --git a/lime/graphics/opengl/GLRenderbuffer.hx b/lime/graphics/opengl/GLRenderbuffer.hx
index 1d68682e0..d7df8c2d5 100644
--- a/lime/graphics/opengl/GLRenderbuffer.hx
+++ b/lime/graphics/opengl/GLRenderbuffer.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
class GLRenderbuffer extends GLObject {
diff --git a/lime/graphics/opengl/GLShader.hx b/lime/graphics/opengl/GLShader.hx
index 9837adfe3..6e41897a7 100644
--- a/lime/graphics/opengl/GLShader.hx
+++ b/lime/graphics/opengl/GLShader.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
class GLShader extends GLObject {
diff --git a/lime/graphics/opengl/GLShaderPrecisionFormat.hx b/lime/graphics/opengl/GLShaderPrecisionFormat.hx
index 8c2636595..3a3181bb6 100644
--- a/lime/graphics/opengl/GLShaderPrecisionFormat.hx
+++ b/lime/graphics/opengl/GLShaderPrecisionFormat.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
typedef GLShaderPrecisionFormat = {
diff --git a/lime/graphics/opengl/GLTexture.hx b/lime/graphics/opengl/GLTexture.hx
index 91bf6c526..402f69e46 100644
--- a/lime/graphics/opengl/GLTexture.hx
+++ b/lime/graphics/opengl/GLTexture.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
class GLTexture extends GLObject {
diff --git a/lime/graphics/opengl/GLUniformLocation.hx b/lime/graphics/opengl/GLUniformLocation.hx
index 4b2c7875e..25706e014 100644
--- a/lime/graphics/opengl/GLUniformLocation.hx
+++ b/lime/graphics/opengl/GLUniformLocation.hx
@@ -1,4 +1,4 @@
-package lime.graphics.opengl; #if !js
+package lime.graphics.opengl; #if !html5
typedef GLUniformLocation = Int;
diff --git a/lime/graphics/utils/ImageCanvasUtil.hx b/lime/graphics/utils/ImageCanvasUtil.hx
index 10f20e5e1..eafd26cac 100644
--- a/lime/graphics/utils/ImageCanvasUtil.hx
+++ b/lime/graphics/utils/ImageCanvasUtil.hx
@@ -10,7 +10,7 @@ import lime.math.Vector2;
import lime.utils.ByteArray;
import lime.utils.UInt8Array;
-#if js
+#if html5
import js.Browser;
#end
@@ -52,7 +52,7 @@ class ImageCanvasUtil {
public static function convertToData (image:Image):Void {
- #if js
+ #if html5
if (image.buffer.data == null) {
convertToCanvas (image);
@@ -118,7 +118,7 @@ class ImageCanvasUtil {
public static function createCanvas (image:Image, width:Int, height:Int):Void {
- #if js
+ #if html5
var buffer = image.buffer;
if (buffer.__srcCanvas == null) {
@@ -293,7 +293,7 @@ class ImageCanvasUtil {
public static function sync (image:Image):Void {
- #if js
+ #if html5
if (image.dirty && image.type != DATA) {
image.buffer.__srcContext.putImageData (image.buffer.__srcImageData, 0, 0);
diff --git a/lime/net/URLLoader.hx b/lime/net/URLLoader.hx
index 432711380..9cc209cad 100644
--- a/lime/net/URLLoader.hx
+++ b/lime/net/URLLoader.hx
@@ -4,7 +4,7 @@ package lime.net;
import lime.app.Event;
import lime.utils.ByteArray;
-#if js
+#if html5
import js.html.EventTarget;
import js.html.XMLHttpRequest;
import js.Browser;
@@ -77,7 +77,7 @@ class URLLoader {
public function load (request:URLRequest):Void {
- #if js
+ #if html5
requestUrl (request.url, request.method, request.data, request.formatRequestHeaders ());
#elseif lime_curl
requestUrl (request.url, request.method, request.data, request.formatRequestHeaders ());
@@ -86,7 +86,7 @@ class URLLoader {
}
- #if js
+ #if html5
private function registerEvents (subject:EventTarget):Void {
var self = this;
@@ -398,7 +398,7 @@ class URLLoader {
private function __onData (_):Void {
- #if js
+ #if html5
var content:Dynamic = getData ();
switch (dataFormat) {
@@ -434,7 +434,7 @@ class URLLoader {
private function set_dataFormat (inputVal:URLLoaderDataFormat):URLLoaderDataFormat {
- #if js
+ #if html5
// prevent inadvertently using typed arrays when they are unsupported
// @todo move these sorts of tests somewhere common in the vein of Modernizr
diff --git a/lime/net/curl/CURL.hx b/lime/net/curl/CURL.hx
index 0bb2ddcbb..6dd83fa60 100644
--- a/lime/net/curl/CURL.hx
+++ b/lime/net/curl/CURL.hx
@@ -17,7 +17,7 @@ abstract CURL(Int) from Int to Int {
public static function getDate (date:String, now:Int):Int {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_getdate (date, now);
#else
return 0;
@@ -28,7 +28,7 @@ abstract CURL(Int) from Int to Int {
public static function globalCleanup ():Void {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
lime_curl_global_cleanup ();
#end
@@ -37,7 +37,7 @@ abstract CURL(Int) from Int to Int {
public static function globalInit (flags:Int):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_global_init (flags);
#else
return cast 0;
@@ -48,7 +48,7 @@ abstract CURL(Int) from Int to Int {
public static function version ():String {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_version ();
#else
return null;
@@ -59,7 +59,7 @@ abstract CURL(Int) from Int to Int {
public static function versionInfo (type:CURLVersion):String {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_version_info (cast (type, Int));
#else
return null;
@@ -75,7 +75,7 @@ abstract CURL(Int) from Int to Int {
}
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
private static var lime_curl_getdate = System.load ("lime", "lime_curl_getdate", 2);
private static var lime_curl_global_cleanup = System.load ("lime", "lime_curl_global_cleanup", 0);
private static var lime_curl_global_init = System.load ("lime", "lime_curl_global_init", 1);
diff --git a/lime/net/curl/CURLEasy.hx b/lime/net/curl/CURLEasy.hx
index f04089483..eba3bf523 100644
--- a/lime/net/curl/CURLEasy.hx
+++ b/lime/net/curl/CURLEasy.hx
@@ -10,7 +10,7 @@ class CURLEasy {
public static function cleanup (handle:CURL):Void {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
lime_curl_easy_cleanup (handle);
#end
@@ -19,7 +19,7 @@ class CURLEasy {
public static function duphandle (handle:CURL):CURL {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_easy_duphandle (handle);
#else
return 0;
@@ -30,7 +30,7 @@ class CURLEasy {
public static function escape (handle:CURL, url:String, length:Int):String {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_easy_escape (handle, url, length);
#else
return null;
@@ -41,7 +41,7 @@ class CURLEasy {
public static function getinfo (handle:CURL, info:CURLInfo):Dynamic {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_easy_getinfo (handle, cast (info, Int));
#else
return null;
@@ -52,7 +52,7 @@ class CURLEasy {
public static function init ():CURL {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_easy_init ();
#else
return 0;
@@ -63,7 +63,7 @@ class CURLEasy {
public static function pause (handle:CURL, bitMask:Int):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_easy_pause (handle, bitMask);
#else
return cast 0;
@@ -74,7 +74,7 @@ class CURLEasy {
public static function perform (handle:CURL):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_easy_perform (handle);
#else
return cast 0;
@@ -85,7 +85,7 @@ class CURLEasy {
/*public static function recv (handle:Dynamic):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_easy_perform (handle);
#else
return cast 0;
@@ -96,7 +96,7 @@ class CURLEasy {
public static function reset (handle:CURL):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_easy_reset (handle);
#else
return cast 0;
@@ -107,7 +107,7 @@ class CURLEasy {
/*public static function send (handle:Dynamic):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_easy_perform (handle);
#else
return cast 0;
@@ -118,7 +118,7 @@ class CURLEasy {
public static function setopt (handle:CURL, option:CURLOption, parameter:Dynamic):CURLCode {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return cast lime_curl_easy_setopt (handle, cast (option, Int), parameter);
#else
return cast 0;
@@ -129,7 +129,7 @@ class CURLEasy {
public static function strerror (code:CURLCode):String {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_easy_strerror (cast (code, Int));
#else
return null;
@@ -140,7 +140,7 @@ class CURLEasy {
public static function unescape (handle:CURL, url:String, inLength:Int, outLength:Int):String {
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
return lime_curl_easy_unescape (handle, url, inLength, outLength);
#else
return null;
@@ -149,7 +149,7 @@ class CURLEasy {
}
- #if ((cpp || neko) && lime_curl)
+ #if ((cpp || neko || nodejs) && lime_curl)
private static var lime_curl_easy_cleanup = System.load ("lime", "lime_curl_easy_cleanup", 1);
private static var lime_curl_easy_duphandle = System.load ("lime", "lime_curl_easy_duphandle", 1);
private static var lime_curl_easy_escape = System.load ("lime", "lime_curl_easy_escape", 3);
diff --git a/lime/system/System.hx b/lime/system/System.hx
index 7049e7889..8dadd4fa2 100644
--- a/lime/system/System.hx
+++ b/lime/system/System.hx
@@ -2,12 +2,12 @@ package lime.system;
#if !macro
-#if js
+#if html5
import js.html.HtmlElement;
import js.Browser;
#end
-#if sys
+#if (sys && !html5)
import sys.io.Process;
#end
@@ -25,7 +25,7 @@ class System {
#end
- #if js
+ #if html5
@:keep @:expose("lime.embed")
public static function embed (elementName:String, width:Null = null, height:Null = null, background:String = null) {
@@ -83,7 +83,7 @@ class System {
static private function findHaxeLib (library:String):String {
- #if sys
+ #if (sys && !html5)
try {
@@ -149,7 +149,7 @@ class System {
}
#if !disable_cffi
- #if sys
+ #if (sys && !html5)
#if (iphone || emscripten || android || static_link)
return cpp.Lib.load (library, method, args);
@@ -162,6 +162,8 @@ class System {
return cpp.Lib.load (__moduleNames.get (library), method, args);
#elseif neko
return neko.Lib.load (__moduleNames.get (library), method, args);
+ #elseif nodejs
+ return js.Lib.load (__moduleNames.get (library), method, args);
#else
return null;
#end
@@ -239,7 +241,7 @@ class System {
private static function sysName ():String {
- #if sys
+ #if (sys && !html5)
#if cpp
var sys_string = cpp.Lib.load ("std", "sys_string", 0);
return sys_string ();
@@ -255,7 +257,7 @@ class System {
private static function tryLoad (name:String, library:String, func:String, args:Int):Dynamic {
- #if sys
+ #if (sys && !html5 || nodejs)
try {
@@ -263,6 +265,8 @@ class System {
var result = cpp.Lib.load (name, func, args);
#elseif (neko)
var result = neko.Lib.load (name, func, args);
+ #elseif nodejs
+ var result = js.Lib.load (name, func, args);
#else
var result = null;
#end
@@ -290,7 +294,7 @@ class System {
private static function loaderTrace (message:String) {
- #if sys
+ #if (sys && !html5)
#if cpp
var get_env = cpp.Lib.load ("std", "get_env", 1);
diff --git a/lime/ui/KeyEventManager.hx b/lime/ui/KeyEventManager.hx
index 8d9f6e781..ba2a2287d 100644
--- a/lime/ui/KeyEventManager.hx
+++ b/lime/ui/KeyEventManager.hx
@@ -4,7 +4,7 @@ package lime.ui;
import lime.app.Event;
import lime.system.System;
-#if js
+#if html5
import js.Browser;
#elseif flash
import flash.Lib;
@@ -24,7 +24,7 @@ class KeyEventManager {
eventInfo = new KeyEventInfo ();
- #if js
+ #if html5
Browser.window.addEventListener ("keydown", handleEvent, false);
Browser.window.addEventListener ("keyup", handleEvent, false);
@@ -34,7 +34,7 @@ class KeyEventManager {
Lib.current.stage.addEventListener (flash.events.KeyboardEvent.KEY_DOWN, handleEvent);
Lib.current.stage.addEventListener (flash.events.KeyboardEvent.KEY_UP, handleEvent);
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
lime_key_event_manager_register (handleEvent, eventInfo);
@@ -45,7 +45,7 @@ class KeyEventManager {
private static function convertKeyCode (keyCode:Int):KeyCode {
- #if js
+ #if html5
if (keyCode >= 65 && keyCode <= 90) {
return cast keyCode + 32;
@@ -145,9 +145,9 @@ class KeyEventManager {
}
- private static function handleEvent (#if js event:js.html.KeyboardEvent #elseif flash event:flash.events.KeyboardEvent #end):Void {
+ private static function handleEvent (#if html5 event:js.html.KeyboardEvent #elseif flash event:flash.events.KeyboardEvent #end):Void {
- #if js
+ #if html5
// space and arrow keys
switch (event.keyCode) {
@@ -199,7 +199,7 @@ class KeyEventManager {
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_key_event_manager_register = System.load ("lime", "lime_key_event_manager_register", 2);
#end
diff --git a/lime/ui/MouseEventManager.hx b/lime/ui/MouseEventManager.hx
index f8ff39a86..cb35b3050 100644
--- a/lime/ui/MouseEventManager.hx
+++ b/lime/ui/MouseEventManager.hx
@@ -4,7 +4,7 @@ package lime.ui;
import lime.app.Event;
import lime.system.System;
-#if js
+#if html5
import js.Browser;
#elseif flash
import flash.Lib;
@@ -23,7 +23,7 @@ class MouseEventManager {
private static var created:Bool;
private static var eventInfo:MouseEventInfo;
- #if js
+ #if html5
private static var window:Window;
#end
@@ -32,16 +32,16 @@ class MouseEventManager {
eventInfo = new MouseEventInfo ();
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_mouse_event_manager_register (handleEvent, eventInfo);
#end
}
- private static function handleEvent (#if js event:js.html.MouseEvent #elseif flash event:flash.events.MouseEvent #end):Void {
+ private static function handleEvent (#if html5 event:js.html.MouseEvent #elseif flash event:flash.events.MouseEvent #end):Void {
- #if js
+ #if html5
eventInfo.type = switch (event.type) {
@@ -157,7 +157,7 @@ class MouseEventManager {
private static function registerWindow (_window:Window):Void {
- #if js
+ #if html5
var events = [ "mousedown", "mousemove", "mouseup", "wheel" ];
@@ -193,7 +193,7 @@ class MouseEventManager {
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_mouse_event_manager_register = System.load ("lime", "lime_mouse_event_manager_register", 2);
#end
diff --git a/lime/ui/TouchEventManager.hx b/lime/ui/TouchEventManager.hx
index 5fe6c3fbd..1c271cb7c 100644
--- a/lime/ui/TouchEventManager.hx
+++ b/lime/ui/TouchEventManager.hx
@@ -20,7 +20,7 @@ import flash.Lib;
private static var eventInfo:TouchEventInfo;
- #if js
+ #if html5
private static var window:Window;
#end
@@ -29,16 +29,16 @@ import flash.Lib;
eventInfo = new TouchEventInfo ();
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_touch_event_manager_register (handleEvent, eventInfo);
#end
}
- private static function handleEvent (#if js event:js.html.TouchEvent #elseif flash event:flash.events.TouchEvent #end):Void {
+ private static function handleEvent (#if html5 event:js.html.TouchEvent #elseif flash event:flash.events.TouchEvent #end):Void {
- #if js
+ #if html5
event.preventDefault ();
@@ -127,7 +127,7 @@ import flash.Lib;
private static function registerWindow (window:Window):Void {
- #if js
+ #if html5
window.element.addEventListener ("touchstart", handleEvent, true);
window.element.addEventListener ("touchmove", handleEvent, true);
@@ -147,7 +147,7 @@ import flash.Lib;
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_touch_event_manager_register = System.load ("lime", "lime_touch_event_manager_register", 2);
#end
diff --git a/lime/ui/Window.hx b/lime/ui/Window.hx
index 692b49017..3d72a595e 100644
--- a/lime/ui/Window.hx
+++ b/lime/ui/Window.hx
@@ -7,7 +7,7 @@ import lime.app.Event;
import lime.graphics.Renderer;
import lime.system.System;
-#if js
+#if html5
import js.html.CanvasElement;
import js.html.DivElement;
import js.html.HtmlElement;
@@ -42,14 +42,14 @@ class Window {
public var x:Int;
public var y:Int;
- #if js
+ #if html5
public var canvas:CanvasElement;
public var div:DivElement;
public var element:HtmlElement;
#if stats
public var stats:Dynamic;
#end
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
public var handle:Dynamic;
#end
@@ -65,7 +65,7 @@ class Window {
registered = true;
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_window_event_manager_register (dispatch, eventInfo);
#end
@@ -79,7 +79,7 @@ class Window {
setWidth = width;
setHeight = height;
- #if js
+ #if html5
if (Std.is (element, CanvasElement)) {
@@ -174,7 +174,7 @@ class Window {
Browser.document.body.appendChild (stats.domElement);
#end
- #elseif (cpp || neko)
+ #elseif (cpp || neko || nodejs)
var flags = 0;
@@ -202,7 +202,7 @@ class Window {
MouseEventManager.registerWindow (this);
TouchEventManager.registerWindow (this);
- #if js
+ #if html5
Browser.window.addEventListener ("focus", handleDOMEvent, false);
Browser.window.addEventListener ("blur", handleDOMEvent, false);
Browser.window.addEventListener ("resize", handleDOMEvent, false);
@@ -267,7 +267,7 @@ class Window {
}
- #if js
+ #if html5
private function handleDOMEvent (event:js.html.Event):Void {
switch (event.type) {
@@ -409,7 +409,7 @@ class Window {
public function move (x:Int, y:Int):Void {
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_window_move (handle, x, y);
#end
@@ -421,14 +421,14 @@ class Window {
setWidth = width;
setHeight = height;
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
lime_window_resize (handle, width, height);
#end
}
- #if (cpp || neko)
+ #if (cpp || neko || nodejs)
private static var lime_window_create = System.load ("lime", "lime_window_create", 5);
private static var lime_window_event_manager_register = System.load ("lime", "lime_window_event_manager_register", 2);
private static var lime_window_move = System.load ("lime", "lime_window_move", 3);
diff --git a/lime/utils/ByteArray.hx b/lime/utils/ByteArray.hx
index 60abb0887..a326635ca 100644
--- a/lime/utils/ByteArray.hx
+++ b/lime/utils/ByteArray.hx
@@ -31,7 +31,7 @@ import sys.io.File;
@:autoBuild(openfl.Assets.embedFile())
-class ByteArray #if !js extends Bytes #end implements ArrayAccess #if !js implements IDataInput implements IMemoryRange #end {
+class ByteArray #if !js extends Bytes implements ArrayAccess implements IDataInput implements IMemoryRange #end {
public var bytesAvailable (get, null):Int;
@@ -54,11 +54,16 @@ class ByteArray #if !js extends Bytes #end implements ArrayAccess #if !js i
#end
- #if (!js && !disable_cffi)
+ #if (!html5 && !disable_cffi)
private static function __init__ () {
var factory = function (length:Int) { return new ByteArray (length); };
+ #if js
+ var resize = function (bytes:ByteArray, length:Int) {
+ bytes.___resizeBuffer(length);
+ }
+ #else
var resize = function (bytes:ByteArray, length:Int) {
if (length > 0)
@@ -66,9 +71,39 @@ class ByteArray #if !js extends Bytes #end implements ArrayAccess #if !js i
bytes.length = length;
};
+ #end
+ #if html5
+ var bytes = function (bytes:ByteArray) { return bytes == null ? null : bytes.byteView; }
+ #elseif nodejs
+ var bytes = function (bytes:Dynamic) {
+ if (Std.is (bytes, ByteArray))
+ return untyped bytes.byteView;
+ else if (Std.is (bytes, UInt8Array) ||
+ Std.is (bytes, UInt16Array) ||
+ Std.is (bytes, Int16Array) ||
+ Std.is (bytes, Float32Array))
+ return bytes;
+
+ if (bytes != null)
+ trace("Couldn't get BytesData:" + bytes);
+ return null;
+ }
+ var slen = function (bytes:ByteArray) {
+ if (Std.is (bytes, ByteArray))
+ return untyped bytes.length;
+ else if (Std.is (bytes, UInt8Array) ||
+ Std.is (bytes, UInt16Array) ||
+ Std.is (bytes, Int16Array) ||
+ Std.is (bytes, Float32Array))
+ return untyped bytes.byteLength;
+
+ return 0;
+ }
+ #else
var bytes = function (bytes:ByteArray) { return bytes == null ? null : bytes.b; }
- var slen = function (bytes:ByteArray) { return bytes == null ? 0 : bytes.length; }
+ var slen = function (bytes:ByteArray){ return bytes == null ? 0 : bytes.length; }
+ #end
var init = System.load ("lime", "lime_byte_array_init", 4);
init (factory, slen, resize, bytes);
@@ -350,7 +385,7 @@ class ByteArray #if !js extends Bytes #end implements ArrayAccess #if !js i
public static function readFile (path:String):ByteArray {
- #if js
+ #if html5
return null;
#elseif disable_cffi
return ByteArray.fromBytes (File.getBytes (path));
diff --git a/project/include/app/Application.h b/project/include/app/Application.h
index 3f5d5ee1a..214e6d16c 100644
--- a/project/include/app/Application.h
+++ b/project/include/app/Application.h
@@ -18,6 +18,9 @@ namespace lime {
static AutoGCRoot* callback;
virtual int Exec () = 0;
+ virtual void Init () = 0;
+ virtual int Quit () = 0;
+ virtual bool Update () = 0;
};
diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp
index af38196af..d34c3f3a8 100644
--- a/project/src/ExternalInterface.cpp
+++ b/project/src/ExternalInterface.cpp
@@ -51,6 +51,15 @@ namespace lime {
}
+ value lime_application_init (value application) {
+
+ Application* app = (Application*)(intptr_t)val_float (application);
+ app->Init ();
+ return alloc_null ();
+
+ }
+
+
value lime_application_get_ticks (value application) {
return alloc_float (Application::GetTicks ());
@@ -58,6 +67,22 @@ namespace lime {
}
+ value lime_application_quit (value application) {
+
+ Application* app = (Application*)(intptr_t)val_float (application);
+ return alloc_int (app->Quit ());
+
+ }
+
+
+ value lime_application_update (value application) {
+
+ Application* app = (Application*)(intptr_t)val_float (application);
+ return alloc_bool (app->Update ());
+
+ }
+
+
value lime_audio_load (value data) {
AudioBuffer audioBuffer;
@@ -398,7 +423,10 @@ namespace lime {
DEFINE_PRIM (lime_application_create, 1);
DEFINE_PRIM (lime_application_exec, 1);
+ DEFINE_PRIM (lime_application_init, 1);
DEFINE_PRIM (lime_application_get_ticks, 0);
+ DEFINE_PRIM (lime_application_quit, 1);
+ DEFINE_PRIM (lime_application_update, 1);
DEFINE_PRIM (lime_audio_load, 1);
DEFINE_PRIM (lime_font_create_image, 1);
DEFINE_PRIM (lime_font_get_family_name, 1);
diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp
index a7d7d66bd..32d724f3f 100644
--- a/project/src/backend/sdl/SDLApplication.cpp
+++ b/project/src/backend/sdl/SDLApplication.cpp
@@ -56,85 +56,17 @@ namespace lime {
}
- static SDL_TimerID timerID = 0;
- bool timerActive = false;
-
-
- Uint32 OnTimer (Uint32 interval, void *) {
-
- SDL_Event event;
- SDL_UserEvent userevent;
- userevent.type = SDL_USEREVENT;
- userevent.code = 0;
- userevent.data1 = NULL;
- userevent.data2 = NULL;
- event.type = SDL_USEREVENT;
- event.user = userevent;
-
- timerActive = false;
- timerID = 0;
-
- SDL_PushEvent (&event);
-
- return 0;
-
- }
-
-
int SDLApplication::Exec () {
- framePeriod = 1000.0 / 60.0;
- SDL_Event event;
- active = true;
- lastUpdate = SDL_GetTicks ();
- nextUpdate = lastUpdate;
-
- bool firstTime = true;
+ Init ();
while (active) {
- event.type = -1;
-
- while (active && (firstTime || SDL_WaitEvent (&event))) {
-
- firstTime = false;
-
- HandleEvent (&event);
- event.type = -1;
- if (!active) break;
-
- while (active && SDL_PollEvent (&event)) {
-
- HandleEvent (&event);
- event.type = -1;
- if (!active) break;
-
- }
-
- currentUpdate = SDL_GetTicks ();
-
- if (currentUpdate >= nextUpdate) {
-
- SDL_RemoveTimer (timerID);
- OnTimer (0, 0);
-
- } else if (!timerActive) {
-
- timerActive = true;
- timerID = SDL_AddTimer (nextUpdate - currentUpdate, OnTimer, 0);
-
- }
-
- }
+ Update ();
}
- windowEvent.type = WINDOW_DEACTIVATE;
- WindowEvent::Dispatch (&windowEvent);
-
- SDL_Quit ();
-
- return 0;
+ return Quit ();
}
@@ -229,6 +161,16 @@ namespace lime {
}
+ void SDLApplication::Init() {
+
+ framePeriod = 1000.0 / 60.0;
+ active = true;
+ lastUpdate = SDL_GetTicks ();
+ nextUpdate = lastUpdate;
+
+ }
+
+
void SDLApplication::ProcessKeyEvent (SDL_Event* event) {
if (KeyEvent::callback) {
@@ -324,6 +266,85 @@ namespace lime {
}
+ int SDLApplication::Quit () {
+
+ windowEvent.type = WINDOW_DEACTIVATE;
+ WindowEvent::Dispatch (&windowEvent);
+
+ SDL_Quit ();
+
+ return 0;
+
+ }
+
+
+ static SDL_TimerID timerID = 0;
+ bool timerActive = false;
+ bool firstTime = true;
+
+ Uint32 OnTimer (Uint32 interval, void *) {
+
+ SDL_Event event;
+ SDL_UserEvent userevent;
+ userevent.type = SDL_USEREVENT;
+ userevent.code = 0;
+ userevent.data1 = NULL;
+ userevent.data2 = NULL;
+ event.type = SDL_USEREVENT;
+ event.user = userevent;
+
+ timerActive = false;
+ timerID = 0;
+
+ SDL_PushEvent (&event);
+
+ return 0;
+
+ }
+
+
+ bool SDLApplication::Update () {
+
+ SDL_Event event;
+ event.type = -1;
+
+ if (active && (firstTime || SDL_WaitEvent (&event))) {
+
+ firstTime = false;
+
+ HandleEvent (&event);
+ event.type = -1;
+ if (!active)
+ return active;
+
+ if (SDL_PollEvent (&event)) {
+
+ HandleEvent (&event);
+ event.type = -1;
+
+ }
+
+ currentUpdate = SDL_GetTicks ();
+
+ if (currentUpdate >= nextUpdate) {
+
+ SDL_RemoveTimer (timerID);
+ OnTimer (0, 0);
+
+ } else if (!timerActive) {
+
+ timerActive = true;
+ timerID = SDL_AddTimer (nextUpdate - currentUpdate, OnTimer, 0);
+
+ }
+
+ }
+
+ return active;
+
+ }
+
+
Application* CreateApplication () {
return new SDLApplication ();
diff --git a/project/src/backend/sdl/SDLApplication.h b/project/src/backend/sdl/SDLApplication.h
index 1602025ca..30e19a9cb 100644
--- a/project/src/backend/sdl/SDLApplication.h
+++ b/project/src/backend/sdl/SDLApplication.h
@@ -23,6 +23,9 @@ namespace lime {
~SDLApplication ();
virtual int Exec ();
+ virtual void Init ();
+ virtual int Quit ();
+ virtual bool Update ();
private:
diff --git a/templates/haxe/ApplicationMain.hx b/templates/haxe/ApplicationMain.hx
index ed657fd99..cfdcdeb22 100644
--- a/templates/haxe/ApplicationMain.hx
+++ b/templates/haxe/ApplicationMain.hx
@@ -76,7 +76,7 @@ class ApplicationMain {
var result = app.exec ();
- #if sys
+ #if (sys && !nodejs)
Sys.exit (result);
#end
diff --git a/templates/haxe/DefaultAssetLibrary.hx b/templates/haxe/DefaultAssetLibrary.hx
index 1461e6d14..3e6257df4 100644
--- a/templates/haxe/DefaultAssetLibrary.hx
+++ b/templates/haxe/DefaultAssetLibrary.hx
@@ -12,7 +12,7 @@ import lime.utils.ByteArray;
import lime.utils.UInt8Array;
import lime.Assets;
-#if sys
+#if (sys || nodejs)
import sys.FileSystem;
#end
@@ -168,7 +168,7 @@ class DefaultAssetLibrary extends AssetLibrary {
buffer.src = cast (Type.createInstance (className.get (id), []), Sound);
return buffer;
- #elseif js
+ #elseif html5
return null;
//return new Sound (new URLRequest (path.get (id)));
@@ -190,7 +190,7 @@ class DefaultAssetLibrary extends AssetLibrary {
return cast (Type.createInstance (className.get (id), []), ByteArray);
- #elseif js
+ #elseif html5
var bytes:ByteArray = null;
var data = Preloader.loaders.get (path.get (id)).data;
@@ -269,7 +269,7 @@ class DefaultAssetLibrary extends AssetLibrary {
return Image.fromBitmapData (cast (Type.createInstance (className.get (id), []), BitmapData));
- #elseif js
+ #elseif html5
return Image.fromImageElement (Preloader.images.get (path.get (id)));
@@ -296,7 +296,7 @@ class DefaultAssetLibrary extends AssetLibrary {
//return sound;
return null;
- #elseif js
+ #elseif html5
return null;
//return new Sound (new URLRequest (path.get (id)));
@@ -329,7 +329,7 @@ class DefaultAssetLibrary extends AssetLibrary {
public override function getText (id:String):String {
- #if js
+ #if html5
var bytes:ByteArray = null;
var data = Preloader.loaders.get (path.get (id)).data;
@@ -597,7 +597,7 @@ class DefaultAssetLibrary extends AssetLibrary {
public override function loadText (id:String, handler:String -> Void):Void {
- //#if js
+ //#if html5
/*if (path.exists (id)) {
diff --git a/templates/nodejs/hxml/debug.hxml b/templates/nodejs/hxml/debug.hxml
new file mode 100755
index 000000000..af5050e0a
--- /dev/null
+++ b/templates/nodejs/hxml/debug.hxml
@@ -0,0 +1,7 @@
+-main ApplicationMain ::HAXE_FLAGS::
+-js ::NODE_FILE::
+-cp ::BUILD_DIR::/nodejs/haxe
+--macro allowPackage("flash")
+-D nodejs
+-D js-flatten
+-debug
\ No newline at end of file
diff --git a/templates/nodejs/hxml/final.hxml b/templates/nodejs/hxml/final.hxml
new file mode 100644
index 000000000..328ffe3be
--- /dev/null
+++ b/templates/nodejs/hxml/final.hxml
@@ -0,0 +1,7 @@
+-main ApplicationMain ::HAXE_FLAGS::
+-js ::NODE_FILE::
+-cp ::BUILD_DIR::/nodejs/haxe
+--macro allowPackage("flash")
+-D nodejs
+-D js-flatten
+-D final
\ No newline at end of file
diff --git a/templates/nodejs/hxml/release.hxml b/templates/nodejs/hxml/release.hxml
new file mode 100755
index 000000000..84f6c3836
--- /dev/null
+++ b/templates/nodejs/hxml/release.hxml
@@ -0,0 +1,6 @@
+-main ApplicationMain ::HAXE_FLAGS::
+-js ::NODE_FILE::
+-cp ::BUILD_DIR::/nodejs/haxe
+--macro allowPackage("flash")
+-D nodejs
+-D js-flatten
\ No newline at end of file
diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx
index 01d1c09e4..bf7c1c96b 100644
--- a/tools/CommandLineTools.hx
+++ b/tools/CommandLineTools.hx
@@ -1092,7 +1092,12 @@ class CommandLineTools {
target = PlatformHelper.hostPlatform;
targetFlags.set ("neko", "");
+
+ case "nodejs":
+ target = PlatformHelper.hostPlatform;
+ targetFlags.set ("nodejs", "");
+
case "iphone", "iphoneos":
target = Platform.IOS;
diff --git a/tools/helpers/NodeJSHelper.hx b/tools/helpers/NodeJSHelper.hx
new file mode 100644
index 000000000..e87be1180
--- /dev/null
+++ b/tools/helpers/NodeJSHelper.hx
@@ -0,0 +1,61 @@
+package helpers;
+
+
+import haxe.io.Path;
+import project.Architecture;
+import project.Haxelib;
+import project.HXProject;
+import project.Platform;
+
+
+class NodeJSHelper {
+
+
+ public static function run (project:HXProject, modulePath:String, args:Array = null):Void {
+
+ var suffix = switch (PlatformHelper.hostPlatform) {
+
+ case Platform.WINDOWS: "-windows.exe";
+ case Platform.MAC: "-mac";
+ case Platform.LINUX: "-linux";
+ default: return;
+
+ }
+
+ if (suffix == "-linux") {
+
+ if (PlatformHelper.hostArchitecture == Architecture.X86) {
+
+ suffix += "32";
+
+ } else {
+
+ suffix += "64";
+
+ }
+
+ }
+
+ var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths);
+ var node = PathHelper.findTemplate (templatePaths, "bin/node/node" + suffix);
+
+ if (PlatformHelper.hostPlatform != Platform.WINDOWS) {
+
+ Sys.command ("chmod", [ "+x", node ]);
+
+ }
+
+ if (args == null) {
+
+ args = [];
+
+ }
+
+ args.unshift (Path.withoutDirectory (modulePath));
+
+ ProcessHelper.runCommand (Path.directory (modulePath), node, args);
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx
index 1f7fbb688..d30f199e9 100644
--- a/tools/platforms/LinuxPlatform.hx
+++ b/tools/platforms/LinuxPlatform.hx
@@ -7,6 +7,7 @@ import helpers.AssetHelper;
import helpers.CPPHelper;
import helpers.FileHelper;
import helpers.NekoHelper;
+import helpers.NodeJSHelper;
import helpers.PathHelper;
import helpers.PlatformHelper;
import helpers.ProcessHelper;
@@ -28,7 +29,7 @@ class LinuxPlatform extends PlatformTarget {
private var is64:Bool;
private var isRaspberryPi:Bool;
private var targetDirectory:String;
- private var useNeko:Bool;
+ private var targetType:String;
public function new (command:String, _project:HXProject, targetFlags:Map ) {
@@ -69,11 +70,19 @@ class LinuxPlatform extends PlatformTarget {
if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) {
- useNeko = true;
+ targetType = "neko";
+
+ } else if (project.targetFlags.exists ("nodejs")) {
+
+ targetType = "nodejs";
+
+ } else {
+
+ targetType = "cpp";
}
- targetDirectory = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : "") + "/" + (useNeko ? "neko" : "cpp");
+ targetDirectory = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : "") + "/" + targetType;
applicationDirectory = targetDirectory + "/bin/";
executablePath = PathHelper.combine (applicationDirectory, project.app.file);
@@ -98,7 +107,7 @@ class LinuxPlatform extends PlatformTarget {
PathHelper.mkdir (targetDirectory);
- if (!project.targetFlags.exists ("static")) {
+ if (!project.targetFlags.exists ("static") || targetType != "cpp") {
for (ndll in project.ndlls) {
@@ -116,12 +125,18 @@ class LinuxPlatform extends PlatformTarget {
}
- if (useNeko) {
+ if (targetType == "neko") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
+ } else if (targetType == "nodejs") {
+
+ ProcessHelper.runCommand ("", "haxe", [ hxml ]);
+ //NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
+ NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
+
} else {
var haxeArgs = [ hxml ];
@@ -154,7 +169,7 @@ class LinuxPlatform extends PlatformTarget {
}
- if (PlatformHelper.hostPlatform != Platform.WINDOWS) {
+ if (PlatformHelper.hostPlatform != Platform.WINDOWS && targetType != "nodejs") {
ProcessHelper.runCommand ("", "chmod", [ "755", executablePath ]);
@@ -188,7 +203,7 @@ class LinuxPlatform extends PlatformTarget {
}
- var hxml = PathHelper.findTemplate (project.templatePaths, (useNeko ? "neko" : "cpp") + "/hxml/" + type + ".hxml");
+ var hxml = PathHelper.findTemplate (project.templatePaths, targetType + "/hxml/" + type + ".hxml");
var template = new Template (File.getContent (hxml));
Sys.println (template.execute (generateContext ()));
@@ -208,6 +223,7 @@ class LinuxPlatform extends PlatformTarget {
var context = project.templateContext;
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
+ context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js";
context.CPP_DIR = targetDirectory + "/obj/";
context.BUILD_DIR = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : "");
context.WIN_ALLOW_SHADERS = false;
@@ -250,7 +266,11 @@ class LinuxPlatform extends PlatformTarget {
var arguments = additionalArguments.copy ();
- if (project.target == PlatformHelper.hostPlatform) {
+ if (targetType == "nodejs") {
+
+ NodeJSHelper.run (project, targetDirectory + "/bin/ApplicationMain.js", arguments);
+
+ } else if (project.target == PlatformHelper.hostPlatform) {
arguments = arguments.concat ([ "-livereload" ]);
ProcessHelper.runCommand (applicationDirectory, "./" + Path.withoutDirectory (executablePath), arguments);
@@ -273,7 +293,7 @@ class LinuxPlatform extends PlatformTarget {
var context = generateContext ();
- if (project.targetFlags.exists ("static")) {
+ if (targetType == "cpp" && project.targetFlags.exists ("static")) {
for (i in 0...project.ndlls.length) {
@@ -305,9 +325,9 @@ class LinuxPlatform extends PlatformTarget {
//SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe");
FileHelper.recursiveCopyTemplate (project.templatePaths, "haxe", targetDirectory + "/haxe", context);
- FileHelper.recursiveCopyTemplate (project.templatePaths, (useNeko ? "neko" : "cpp") + "/hxml", targetDirectory + "/haxe", context);
+ FileHelper.recursiveCopyTemplate (project.templatePaths, targetType + "/hxml", targetDirectory + "/haxe", context);
- if (project.targetFlags.exists ("static")) {
+ if (targetType == "cpp" && project.targetFlags.exists ("static")) {
FileHelper.recursiveCopyTemplate (project.templatePaths, "cpp/static", targetDirectory + "/obj", context);
diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx
index d4f7e33db..2d5c0ee53 100644
--- a/tools/platforms/MacPlatform.hx
+++ b/tools/platforms/MacPlatform.hx
@@ -8,6 +8,7 @@ import helpers.CPPHelper;
import helpers.FileHelper;
import helpers.IconHelper;
import helpers.NekoHelper;
+import helpers.NodeJSHelper;
import helpers.PathHelper;
import helpers.PlatformHelper;
import helpers.ProcessHelper;
@@ -29,19 +30,13 @@ class MacPlatform extends PlatformTarget {
private var executablePath:String;
private var is64:Bool;
private var targetDirectory:String;
- private var useNeko:Bool;
+ private var targetType:String;
public function new (command:String, _project:HXProject, targetFlags:Map ) {
super (command, _project, targetFlags);
- if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) {
-
- useNeko = true;
-
- }
-
for (architecture in project.architectures) {
if (architecture == Architecture.X64) {
@@ -52,16 +47,21 @@ class MacPlatform extends PlatformTarget {
}
- if (!useNeko) {
+ if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) {
- targetDirectory = project.app.path + "/mac" + (is64 ? "64" : "") + "/cpp";
+ targetType = "neko";
+
+ } else if (project.targetFlags.exists ("nodejs")) {
+
+ targetType = "nodejs";
} else {
- targetDirectory = project.app.path + "/mac" + (is64 ? "64" : "") + "/neko";
+ targetType = "cpp";
}
+ targetDirectory = project.app.path + "/mac" + (is64 ? "64" : "") + "/" + targetType;
applicationDirectory = targetDirectory + "/bin/" + project.app.file + ".app";
contentDirectory = applicationDirectory + "/Contents/Resources";
executableDirectory = applicationDirectory + "/Contents/MacOS";
@@ -88,7 +88,7 @@ class MacPlatform extends PlatformTarget {
PathHelper.mkdir (targetDirectory);
- if (!project.targetFlags.exists ("static")) {
+ if (!project.targetFlags.exists ("static") || targetType != "cpp") {
for (ndll in project.ndlls) {
@@ -98,12 +98,18 @@ class MacPlatform extends PlatformTarget {
}
- if (useNeko) {
+ if (targetType == "neko") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
NekoHelper.createExecutable (project.templatePaths, "Mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory);
+ } else if (targetType == "nodejs") {
+
+ ProcessHelper.runCommand ("", "haxe", [ hxml ]);
+ //NekoHelper.createExecutable (project.templatePaths, "Mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
+ NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory);
+
} else {
var haxeArgs = [ hxml, "-D", "HXCPP_CLANG" ];
@@ -136,7 +142,7 @@ class MacPlatform extends PlatformTarget {
}
- if (PlatformHelper.hostPlatform != Platform.WINDOWS) {
+ if (PlatformHelper.hostPlatform != Platform.WINDOWS && targetType != "nodejs") {
ProcessHelper.runCommand ("", "chmod", [ "755", executablePath ]);
@@ -170,7 +176,7 @@ class MacPlatform extends PlatformTarget {
}
- var hxml = PathHelper.findTemplate (project.templatePaths, (useNeko ? "neko" : "cpp") + "/hxml/" + type + ".hxml");
+ var hxml = PathHelper.findTemplate (project.templatePaths, targetType + "/hxml/" + type + ".hxml");
var template = new Template (File.getContent (hxml));
Sys.println (template.execute (generateContext ()));
@@ -181,6 +187,7 @@ class MacPlatform extends PlatformTarget {
var context = project.templateContext;
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
+ context.NODE_FILE = executableDirectory + "/ApplicationMain.js";
context.CPP_DIR = targetDirectory + "/obj/";
context.BUILD_DIR = project.app.path + "/mac" + (is64 ? "64" : "");
@@ -214,7 +221,11 @@ class MacPlatform extends PlatformTarget {
var arguments = additionalArguments.copy ();
- if (project.target == PlatformHelper.hostPlatform) {
+ if (targetType == "nodejs") {
+
+ NodeJSHelper.run (project, executableDirectory + "/ApplicationMain.js", arguments);
+
+ } else if (project.target == PlatformHelper.hostPlatform) {
arguments = arguments.concat ([ "-livereload" ]);
ProcessHelper.runCommand (executableDirectory, "./" + Path.withoutDirectory (executablePath), arguments);
@@ -236,7 +247,7 @@ class MacPlatform extends PlatformTarget {
var context = generateContext ();
- if (project.targetFlags.exists ("static")) {
+ if (targetType == "cpp" && project.targetFlags.exists ("static")) {
for (i in 0...project.ndlls.length) {
@@ -261,9 +272,9 @@ class MacPlatform extends PlatformTarget {
//SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe");
FileHelper.recursiveCopyTemplate (project.templatePaths, "haxe", targetDirectory + "/haxe", context);
- FileHelper.recursiveCopyTemplate (project.templatePaths, (useNeko ? "neko" : "cpp") + "/hxml", targetDirectory + "/haxe", context);
+ FileHelper.recursiveCopyTemplate (project.templatePaths, targetType + "/hxml", targetDirectory + "/haxe", context);
- if (project.targetFlags.exists ("static")) {
+ if (targetType == "cpp" && project.targetFlags.exists ("static")) {
FileHelper.recursiveCopyTemplate (project.templatePaths, "cpp/static", targetDirectory + "/obj", context);
diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx
index fb8f1dd2a..5974955dd 100644
--- a/tools/platforms/WindowsPlatform.hx
+++ b/tools/platforms/WindowsPlatform.hx
@@ -8,6 +8,7 @@ import helpers.CPPHelper;
import helpers.FileHelper;
import helpers.IconHelper;
import helpers.NekoHelper;
+import helpers.NodeJSHelper;
import helpers.PathHelper;
import helpers.PlatformHelper;
import helpers.ProcessHelper;
@@ -25,22 +26,28 @@ class WindowsPlatform extends PlatformTarget {
private var applicationDirectory:String;
private var executablePath:String;
private var targetDirectory:String;
- private var useNeko:Bool;
+ private var targetType:String;
public function new (command:String, _project:HXProject, targetFlags:Map ) {
super (command, _project, targetFlags);
- targetDirectory = project.app.path + "/windows/cpp";
-
if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) {
- targetDirectory = project.app.path + "/windows/neko";
- useNeko = true;
+ targetType = "neko";
+
+ } else if (project.targetFlags.exists ("nodejs")) {
+
+ targetType = "nodejs";
+
+ } else {
+
+ targetType = "cpp";
}
+ targetDirectory = project.app.path + "/windows/" + targetType;
applicationDirectory = targetDirectory + "/bin/";
executablePath = applicationDirectory + "/" + project.app.file + ".exe";
@@ -76,7 +83,7 @@ class WindowsPlatform extends PlatformTarget {
}
- if (!project.targetFlags.exists ("static")) {
+ if (!project.targetFlags.exists ("static") || targetType != "cpp") {
for (ndll in project.ndlls) {
@@ -86,12 +93,18 @@ class WindowsPlatform extends PlatformTarget {
}
- if (useNeko) {
+ if (targetType == "neko") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
NekoHelper.createExecutable (project.templatePaths, "windows", targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "windows", applicationDirectory);
+ } else if (targetType == "nodejs") {
+
+ ProcessHelper.runCommand ("", "haxe", [ hxml ]);
+ //NekoHelper.createExecutable (project.templatePaths, "windows", targetDirectory + "/obj/ApplicationMain.n", executablePath);
+ NekoHelper.copyLibraries (project.templatePaths, "windows", applicationDirectory);
+
} else {
var haxeArgs = [ hxml ];
@@ -161,7 +174,7 @@ class WindowsPlatform extends PlatformTarget {
}
- var hxml = PathHelper.findTemplate (project.templatePaths, (useNeko ? "neko" : "cpp") + "/hxml/" + type + ".hxml");
+ var hxml = PathHelper.findTemplate (project.templatePaths, targetType + "/hxml/" + type + ".hxml");
var template = new Template (File.getContent (hxml));
Sys.println (template.execute (generateContext ()));
@@ -173,6 +186,7 @@ class WindowsPlatform extends PlatformTarget {
var context = project.templateContext;
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
+ context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js";
context.CPP_DIR = targetDirectory + "/obj";
context.BUILD_DIR = project.app.path + "/windows";
@@ -199,7 +213,11 @@ class WindowsPlatform extends PlatformTarget {
var arguments = additionalArguments.copy ();
- if (project.target == PlatformHelper.hostPlatform) {
+ if (targetType == "nodejs") {
+
+ NodeJSHelper.run (project, targetDirectory + "/bin/ApplicationMain.js", arguments);
+
+ } else if (project.target == PlatformHelper.hostPlatform) {
arguments = arguments.concat ([ "-livereload" ]);
ProcessHelper.runCommand (applicationDirectory, Path.withoutDirectory (executablePath), arguments);
@@ -221,7 +239,7 @@ class WindowsPlatform extends PlatformTarget {
var context = generateContext ();
- if (project.targetFlags.exists ("static")) {
+ if (targetType == "cpp" && project.targetFlags.exists ("static")) {
for (i in 0...project.ndlls.length) {
@@ -245,9 +263,9 @@ class WindowsPlatform extends PlatformTarget {
//SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe");
FileHelper.recursiveCopyTemplate (project.templatePaths, "haxe", targetDirectory + "/haxe", context);
- FileHelper.recursiveCopyTemplate (project.templatePaths, (useNeko ? "neko" : "cpp") + "/hxml", targetDirectory + "/haxe", context);
+ FileHelper.recursiveCopyTemplate (project.templatePaths, targetType + "/hxml", targetDirectory + "/haxe", context);
- if (project.targetFlags.exists ("static")) {
+ if (targetType == "cpp" && project.targetFlags.exists ("static")) {
FileHelper.recursiveCopyTemplate (project.templatePaths, "cpp/static", targetDirectory + "/obj", context);
diff --git a/tools/project/ProjectXMLParser.hx b/tools/project/ProjectXMLParser.hx
index a9f870662..5b13ad709 100644
--- a/tools/project/ProjectXMLParser.hx
+++ b/tools/project/ProjectXMLParser.hx
@@ -79,6 +79,11 @@ class ProjectXMLParser extends HXProject {
defines.set ("native", "1");
defines.set ("neko", "1");
+ } else if (targetFlags.exists ("nodejs")) {
+
+ defines.set ("native", "1");
+ defines.set ("nodejs", "1");
+
} else if (target == Platform.FIREFOX) {
defines.set ("html5", "1");