Minimum haxe version supported is 3.2.0
This commit is contained in:
@@ -4,14 +4,10 @@ package lime._backend.html5;
|
||||
import haxe.Timer;
|
||||
import js.html.CanvasElement;
|
||||
import js.html.DivElement;
|
||||
#if (haxe_ver >= 3.2)
|
||||
import js.html.Element;
|
||||
import js.html.FocusEvent;
|
||||
import js.html.InputElement;
|
||||
import js.html.InputEvent;
|
||||
#else
|
||||
import js.html.HtmlElement;
|
||||
#end
|
||||
import js.html.MouseEvent;
|
||||
import js.html.TouchEvent;
|
||||
import js.Browser;
|
||||
@@ -24,11 +20,6 @@ import lime.ui.Joystick;
|
||||
import lime.ui.Touch;
|
||||
import lime.ui.Window;
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
typedef FocusEvent = js.html.Event;
|
||||
typedef InputElement = Dynamic;
|
||||
typedef InputEvent = js.html.Event;
|
||||
#end
|
||||
|
||||
@:access(lime.app.Application)
|
||||
@:access(lime.ui.Gamepad)
|
||||
@@ -44,7 +35,7 @@ class HTML5Window {
|
||||
|
||||
public var canvas:CanvasElement;
|
||||
public var div:DivElement;
|
||||
public var element:#if (haxe_ver >= 3.2) Element #else HtmlElement #end;
|
||||
public var element:Element;
|
||||
#if stats
|
||||
public var stats:Dynamic;
|
||||
#end
|
||||
@@ -91,11 +82,7 @@ class HTML5Window {
|
||||
|
||||
if (message != null) {
|
||||
|
||||
#if (haxe_ver >= 3.2)
|
||||
Browser.alert (message);
|
||||
#else
|
||||
js.Lib.alert (message);
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef WindowConfig = {
|
||||
@:optional var depthBuffer:Bool;
|
||||
@:optional var display:Int;
|
||||
#if (js && html5)
|
||||
@:optional var element:#if (haxe_ver >= 3.2) js.html.Element #else js.html.HtmlElement #end;
|
||||
@:optional var element:js.html.Element;
|
||||
#end
|
||||
@:optional var fullscreen:Bool;
|
||||
@:optional var hardware:Bool;
|
||||
|
||||
@@ -58,23 +58,6 @@ class HTML5AudioContext {
|
||||
}
|
||||
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
public function getAudioDecodedByteCount (buffer:AudioBuffer):Int {
|
||||
|
||||
#if (js && html5)
|
||||
if (buffer.__srcAudio != null) {
|
||||
|
||||
return buffer.__srcAudio.audioDecodedByteCount;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public function getAutoplay (buffer:AudioBuffer):Bool {
|
||||
|
||||
#if (js && html5)
|
||||
@@ -105,23 +88,6 @@ class HTML5AudioContext {
|
||||
}
|
||||
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
public function getController (buffer:AudioBuffer):Dynamic /*MediaController*/ {
|
||||
|
||||
#if (js && html5)
|
||||
if (buffer.__srcAudio != null) {
|
||||
|
||||
return buffer.__srcAudio.controller;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public function getCurrentSrc (buffer:AudioBuffer):String {
|
||||
|
||||
#if (js && html5)
|
||||
@@ -212,23 +178,6 @@ class HTML5AudioContext {
|
||||
}
|
||||
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
public function getInitialTime (buffer:AudioBuffer):Float {
|
||||
|
||||
#if (js && html5)
|
||||
if (buffer.__srcAudio != null) {
|
||||
|
||||
return buffer.__srcAudio.initialTime;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public function getLoop (buffer:AudioBuffer):Bool {
|
||||
|
||||
#if (js && html5)
|
||||
@@ -244,23 +193,6 @@ class HTML5AudioContext {
|
||||
}
|
||||
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
public function getMediaGroup (buffer:AudioBuffer):String {
|
||||
|
||||
#if (js && html5)
|
||||
if (buffer.__srcAudio != null) {
|
||||
|
||||
return buffer.__srcAudio.mediaGroup;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public function getMuted (buffer:AudioBuffer):Bool {
|
||||
|
||||
#if (js && html5)
|
||||
@@ -493,21 +425,6 @@ class HTML5AudioContext {
|
||||
}
|
||||
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
public function setController (buffer:AudioBuffer, value:Dynamic /*MediaController*/):Void {
|
||||
|
||||
#if (js && html5)
|
||||
if (buffer.__srcAudio != null) {
|
||||
|
||||
buffer.__srcAudio.controller = value;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public function setCurrentTime (buffer:AudioBuffer, value:Float):Void {
|
||||
|
||||
#if (js && html5)
|
||||
@@ -547,21 +464,6 @@ class HTML5AudioContext {
|
||||
}
|
||||
|
||||
|
||||
#if (haxe_ver < 3.2)
|
||||
public function setMediaGroup (buffer:AudioBuffer, value:String):Void {
|
||||
|
||||
#if (js && html5)
|
||||
if (buffer.__srcAudio != null) {
|
||||
|
||||
buffer.__srcAudio.mediaGroup = value;
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public function setMuted (buffer:AudioBuffer, value:Bool):Void {
|
||||
|
||||
#if (js && html5)
|
||||
|
||||
@@ -4,7 +4,7 @@ package lime.audio.openal;
|
||||
import lime.system.CFFIPointer;
|
||||
import lime.utils.ArrayBufferView;
|
||||
|
||||
#if ((haxe_ver >= 3.2) && cpp)
|
||||
#if cpp
|
||||
import cpp.Float32;
|
||||
#else
|
||||
typedef Float32 = Float;
|
||||
|
||||
@@ -101,11 +101,7 @@ class JPEG {
|
||||
|
||||
if (image.buffer.__srcCanvas != null) {
|
||||
|
||||
#if (haxe_ver >= 3.2)
|
||||
var data = image.buffer.__srcCanvas.toDataURL ("image/jpeg", quality / 100);
|
||||
#else
|
||||
var data = image.buffer.__srcCanvas.toDataURL ("image/jpeg");
|
||||
#end
|
||||
var buffer = Browser.window.atob (data.split (";base64,")[1]);
|
||||
var bytes = Bytes.alloc (buffer.length);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
#end
|
||||
|
||||
#if ((haxe_ver >= 3.2) && cpp)
|
||||
#if cpp
|
||||
import cpp.Float32;
|
||||
#else
|
||||
typedef Float32 = Float;
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef WindowData = {
|
||||
@:optional var stencilBuffer:Bool;
|
||||
@:optional var title:String;
|
||||
#if (js && html5)
|
||||
@:optional var element:#if (haxe_ver >= 3.2) js.html.Element #else js.html.HtmlElement #end;
|
||||
@:optional var element:js.html.Element;
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class CFFI {
|
||||
|
||||
public static macro function loadPrime (library:String, method:String, signature:String, lazy:Bool = false):Dynamic {
|
||||
|
||||
#if ((haxe_ver >= 3.2) && !display)
|
||||
#if !display
|
||||
return cpp.Prime.load (library, method, signature, lazy);
|
||||
#else
|
||||
var args = signature.length - 1;
|
||||
@@ -532,8 +532,6 @@ class CFFI {
|
||||
var cffiName = "cffi_" + field.name;
|
||||
var cffiExpr, cffiType;
|
||||
|
||||
#if (haxe_ver >= 3.2)
|
||||
|
||||
if (Context.defined ("cpp")) {
|
||||
|
||||
cffiExpr = 'new cpp.Callable<$typeString> (cpp.Prime._loadPrime ("$library", "$method", "$typeSignature", $lazy))';
|
||||
@@ -554,21 +552,6 @@ class CFFI {
|
||||
|
||||
cffiType = TPath ( { pack: [ "cpp" ], name: "Callable", params: [ TPType (TFun (type.args, type.result).toComplexType ()) ] } );
|
||||
|
||||
#else
|
||||
|
||||
var args = typeSignature.length - 1;
|
||||
|
||||
if (args > 5) {
|
||||
|
||||
args = -1;
|
||||
|
||||
}
|
||||
|
||||
cffiExpr = 'lime.system.CFFI.load ("$library", "$method", $args, $lazy)';
|
||||
cffiType = TPath ( { pack: [ ], name: "Dynamic" } );
|
||||
|
||||
#end
|
||||
|
||||
newFields.push ( { name: cffiName, access: [ APrivate, AStatic ], kind: FieldType.FVar (cffiType, Context.parse (cffiExpr, field.pos)), pos: field.pos } );
|
||||
|
||||
if (type.result.toString () != "Void" && type.result.toString () != "cpp.Void") {
|
||||
@@ -577,11 +560,7 @@ class CFFI {
|
||||
|
||||
}
|
||||
|
||||
#if (haxe_ver >= 3.2)
|
||||
expr += '$cffiName.call (';
|
||||
#else
|
||||
expr += '$cffiName (';
|
||||
#end
|
||||
|
||||
for (i in 0...type.args.length) {
|
||||
|
||||
@@ -615,7 +594,7 @@ class CFFI {
|
||||
|
||||
private static function __getFunctionType (args:Array<{ name : String, opt : Bool, t : Type }>, result:Type) {
|
||||
|
||||
#if ((haxe_ver >= 3.2) && !disable_cffi && !display)
|
||||
#if (!disable_cffi && !display)
|
||||
var useCPPTypes = Context.defined ("cpp");
|
||||
#else
|
||||
var useCPPTypes = false;
|
||||
|
||||
@@ -10,11 +10,7 @@ import flash.Lib;
|
||||
#end
|
||||
|
||||
#if (js && html5)
|
||||
#if (haxe_ver >= 3.2)
|
||||
import js.html.Element;
|
||||
#else
|
||||
import js.html.HtmlElement;
|
||||
#end
|
||||
import js.Browser;
|
||||
#end
|
||||
|
||||
@@ -51,7 +47,7 @@ class System {
|
||||
@:keep @:expose("lime.embed")
|
||||
public static function embed (element:Dynamic, width:Null<Int> = null, height:Null<Int> = null, background:String = null, assetsPrefix:String = null) {
|
||||
|
||||
var htmlElement:#if (haxe_ver >= 3.2) Element #else HtmlElement #end = null;
|
||||
var htmlElement:Element = null;
|
||||
|
||||
if (Std.is (element, String)) {
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class Font {
|
||||
}
|
||||
|
||||
|
||||
public function getGlyphs (characters:String = #if (display && haxe_ver < 3.2) "" #else "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|:;_-+=?,. " #end):Array<Glyph> {
|
||||
public function getGlyphs (characters:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|:;_-+=?,. "):Array<Glyph> {
|
||||
|
||||
#if (lime_cffi && !macro)
|
||||
var glyphs:Dynamic = lime_font_get_glyph_indices (src, characters);
|
||||
|
||||
@@ -610,19 +610,7 @@ abstract TypedArrayType(Int) from Int to Int {
|
||||
#if cpp
|
||||
untyped return __global__.__hxcpp_memory_get_i32(buffer.getData(), byteOffset);
|
||||
#else
|
||||
|
||||
#if (haxe_ver >= 3.2)
|
||||
return buffer.getInt32(byteOffset);
|
||||
#else
|
||||
|
||||
var ch1 = getInt8(buffer, byteOffset );
|
||||
var ch2 = getInt8(buffer, byteOffset+1);
|
||||
var ch3 = getInt8(buffer, byteOffset+2);
|
||||
var ch4 = getInt8(buffer, byteOffset+3);
|
||||
|
||||
return (ch4 << 24) |(ch3 << 16) |(ch2 << 8) | ch1;
|
||||
|
||||
#end //3.1.3
|
||||
return buffer.getInt32(byteOffset);
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -633,19 +621,7 @@ abstract TypedArrayType(Int) from Int to Int {
|
||||
#if cpp
|
||||
untyped return __global__.__hxcpp_memory_get_i32(buffer.getData(), byteOffset);
|
||||
#else
|
||||
|
||||
#if (haxe_ver >= 3.2)
|
||||
return buffer.getInt32(byteOffset);
|
||||
#else
|
||||
|
||||
var ch1 = getInt8(buffer, byteOffset );
|
||||
var ch2 = getInt8(buffer, byteOffset+1);
|
||||
var ch3 = getInt8(buffer, byteOffset+2);
|
||||
var ch4 = getInt8(buffer, byteOffset+3);
|
||||
|
||||
return (ch1 << 24) |(ch2 << 16) |(ch3 << 8) | ch4;
|
||||
|
||||
#end //3.1.3
|
||||
return buffer.getInt32(byteOffset);
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -659,14 +635,8 @@ abstract TypedArrayType(Int) from Int to Int {
|
||||
#if neko
|
||||
if (value == null) value = 0;
|
||||
#end
|
||||
#if (haxe_ver >= 3.2)
|
||||
buffer.setInt32(byteOffset,value);
|
||||
#else
|
||||
setInt8(buffer, byteOffset , value );
|
||||
setInt8(buffer, byteOffset+1, value >> 8);
|
||||
setInt8(buffer, byteOffset+2, value >> 16);
|
||||
setInt8(buffer, byteOffset+3, value >> 24);
|
||||
#end //3.1.3.
|
||||
|
||||
buffer.setInt32(byteOffset,value);
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -680,14 +650,8 @@ abstract TypedArrayType(Int) from Int to Int {
|
||||
#if neko
|
||||
if (value == null) value = 0;
|
||||
#end
|
||||
#if (haxe_ver >= 3.2)
|
||||
buffer.setInt32(byteOffset,value);
|
||||
#else
|
||||
setInt8(buffer, byteOffset , value >> 24);
|
||||
setInt8(buffer, byteOffset+1, value >> 16);
|
||||
setInt8(buffer, byteOffset+2, value >> 8);
|
||||
setInt8(buffer, byteOffset+3, value );
|
||||
#end //3.1.3.
|
||||
|
||||
buffer.setInt32(byteOffset,value);
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
@@ -48,11 +48,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'Float32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
function toString() return this != null ? 'Float64Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'Int16Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -45,11 +45,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'Int8Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'UInt16Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'UInt32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -47,11 +47,7 @@ package lime.utils;
|
||||
}
|
||||
|
||||
inline public function toBytes() : haxe.io.Bytes {
|
||||
#if (haxe_ver < 3.2)
|
||||
return @:privateAccess new haxe.io.Bytes( this.byteLength, cast new js.html.Uint8Array(this.buffer) );
|
||||
#else
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
#end
|
||||
return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) );
|
||||
}
|
||||
|
||||
inline function toString() return this != null ? 'UInt8ClampedArray [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||
|
||||
@@ -2155,11 +2155,7 @@ class PlatformSetup {
|
||||
|
||||
}
|
||||
|
||||
#if (haxe_ver > 3.102)
|
||||
var content = bytes.getString (0, bytes.length);
|
||||
#else
|
||||
var content = bytes.readString (0, bytes.length);
|
||||
#end
|
||||
|
||||
var startIndex = content.indexOf ("<section id=\"defines\">");
|
||||
var endIndex = content.indexOf ("</section>", startIndex);
|
||||
|
||||
Reference in New Issue
Block a user