Do not define -Dlime-legacy when using Lime hybrid

This commit is contained in:
Joshua Granick
2015-04-06 12:37:08 -07:00
parent b23ddbb2c9
commit 5df7984255
8 changed files with 55 additions and 25 deletions

View File

@@ -7,6 +7,9 @@ public class Lime {
static { static {
System.loadLibrary("openal"); System.loadLibrary("openal");
System.loadLibrary("lime"); System.loadLibrary("lime");
::if DEFINE_LIME_HYBRID::
System.loadLibrary("lime-legacy");
::end::
} }
public static final int ACTIVATE = 1; public static final int ACTIVATE = 1;

View File

@@ -343,10 +343,10 @@ class Timer {
} }
#if lime_legacy #if (lime_legacy || lime_hybrid)
@:noCompletion public static function __nextWake (limit:Float):Float { @:noCompletion public static function __nextWake (limit:Float):Float {
var now = lime_time_stamp () * 1000.0; var now = getMS ();
var sleep; var sleep;
for (timer in sRunningTimers) { for (timer in sRunningTimers) {

View File

@@ -9,10 +9,22 @@
<set name="included" value="1" if="windows || mac || linux || ios || android || blackberry || tizen || firefox || html5 || flash || emscripten" /> <set name="included" value="1" if="windows || mac || linux || ios || android || blackberry || tizen || firefox || html5 || flash || emscripten" />
<set name="lime-legacy" value="1" if="legacy || lime_legacy" /> <set name="lime-hybrid" value="1" if="hybrid || lime_hybrid" />
<set name="lime-legacy" value="1" if="legacy || lime_legacy" unless="lime-hybrid" />
<section if="web || display">
<unset name="lime-legacy" />
<unset name="lime-hybrid" />
<unset name="legacy" />
<unset name="hybrid" />
</section>
<haxedef name="lime-hybrid" if="lime-hybrid" />
<haxedef name="lime-legacy" if="lime-legacy" /> <haxedef name="lime-legacy" if="lime-legacy" />
<include path="legacy/include.xml" if="lime-legacy" unless="setup" /> <include path="legacy/include.xml" if="lime-legacy || lime-hybrid" unless="setup" />
<templatePath name="templates" unless="lime-legacy" /> <templatePath name="templates" unless="lime-legacy" />
<sample path="samples" unless="openfl" /> <sample path="samples" unless="openfl" />

View File

@@ -5,6 +5,10 @@ package org.haxe.lime;
public class Lime { public class Lime {
static { static {
::if DEFINE_LIME_HYBRID::
System.loadLibrary("openal");
System.loadLibrary("lime");
::end::
System.loadLibrary("lime-legacy"); System.loadLibrary("lime-legacy");
} }

View File

@@ -2,7 +2,7 @@
<extension> <extension>
<section unless="display"> <section unless="display">
<haxelib name="hxcpp" if="cpp" unless="rebuild" /> <haxelib name="hxcpp" if="cpp" unless="rebuild" />
<ndll name="std" haxelib="hxcpp" if="cpp" /> <ndll name="std" haxelib="hxcpp" if="cpp" />
<ndll name="regexp" haxelib="hxcpp" if="cpp" /> <ndll name="regexp" haxelib="hxcpp" if="cpp" />
@@ -25,6 +25,6 @@
</section> </section>
<templatePath name="templates" /> <templatePath name="templates" unless="lime-hybrid" />
</extension> </extension>

View File

@@ -24,7 +24,7 @@
<unset name="LEGACY_CURL" if="emscripten" /> <unset name="LEGACY_CURL" if="emscripten" />
<set name="LEGACY_SSL" value="1" /> <set name="LEGACY_SSL" value="1" />
<set name="LEGACY_SSL_EXTRA" value="_ssl" if="LEGACY_SSL" /> <set name="LEGACY_SSL_EXTRA" value="_ssl" if="LEGACY_SSL" />
<set name="LEGACY_S3D" value="1" /> <!-- <set name="LEGACY_S3D" value="1" /> -->
<set name="LEGACY_OPENAL" value="1" /> <set name="LEGACY_OPENAL" value="1" />
<set name="LEGACY_OPENAL" value="1" if="iphone" /> <set name="LEGACY_OPENAL" value="1" if="iphone" />
<!-- <set name="LEGACY_CAMERA" value="1" unless="lime" /> --> <!-- <set name="LEGACY_CAMERA" value="1" unless="lime" /> -->
@@ -144,6 +144,7 @@
<compilerflag value="-DSDL_OGL" /> <compilerflag value="-DSDL_OGL" />
<compilerflag value="-DNME_MIXER" unless="LEGACY_OPENAL" /> <compilerflag value="-DNME_MIXER" unless="LEGACY_OPENAL" />
<compilerflag value="-DNME_SDL2" /> <compilerflag value="-DNME_SDL2" />
<compilerflag value="-DNME_GLES" unless="windows || mac || linux" />
<file name="${LEGACY_SRC_DIR}/sdl/SDLSound.cpp" unless="LEGACY_OPENAL" /> <file name="${LEGACY_SRC_DIR}/sdl/SDLSound.cpp" unless="LEGACY_OPENAL" />
<file name="${LEGACY_SRC_DIR}/sdl2/SDL2Stage.cpp" /> <file name="${LEGACY_SRC_DIR}/sdl2/SDL2Stage.cpp" />

View File

@@ -882,7 +882,7 @@ class HXProject {
if (StringTools.startsWith (haxeflag, "-lib")) { if (StringTools.startsWith (haxeflag, "-lib")) {
Reflect.setField (context, "LIB_" + haxeflag.substr (5).toUpperCase (), "true"); Reflect.setField (context, "LIB_" + StringHelper.formatUppercaseVariable (haxeflag.substr (5)), "true");
} }
@@ -1038,7 +1038,7 @@ class HXProject {
#end #end
Reflect.setField (context, "LIB_" + haxelib.name.toUpperCase (), true); Reflect.setField (context, "LIB_" + StringHelper.formatUppercaseVariable (haxelib.name), true);
if (name == "nme") { if (name == "nme") {
@@ -1060,11 +1060,11 @@ class HXProject {
if (value == null || value == "") { if (value == null || value == "") {
Reflect.setField (context, "SET_" + key.toUpperCase (), true); Reflect.setField (context, "SET_" + StringHelper.formatUppercaseVariable (key), true);
} else { } else {
Reflect.setField (context, "SET_" + key.toUpperCase (), value); Reflect.setField (context, "SET_" + StringHelper.formatUppercaseVariable (key), value);
} }
@@ -1078,13 +1078,13 @@ class HXProject {
compilerFlags.push ("-D " + key); compilerFlags.push ("-D " + key);
Reflect.setField (context, "DEFINE_" + key.toUpperCase (), true); Reflect.setField (context, "DEFINE_" + StringHelper.formatUppercaseVariable (key), true);
} else { } else {
compilerFlags.push ("-D " + key + "=" + value); compilerFlags.push ("-D " + key + "=" + value);
Reflect.setField (context, "DEFINE_" + key.toUpperCase (), value); Reflect.setField (context, "DEFINE_" + StringHelper.formatUppercaseVariable (key), value);
} }

View File

@@ -111,6 +111,7 @@ class StringHelper {
public static function formatUppercaseVariable (name:String):String { public static function formatUppercaseVariable (name:String):String {
var isAlpha = ~/[A-Z0-9]/i;
var variableName = ""; var variableName = "";
var lastWasUpperCase = false; var lastWasUpperCase = false;
@@ -118,13 +119,26 @@ class StringHelper {
var char = name.charAt (i); var char = name.charAt (i);
if (char == char.toUpperCase () && i > 0) { if (!isAlpha.match (char)) {
if (lastWasUpperCase) { variableName += "_";
lastWasUpperCase = false;
} else {
if (char == char.toUpperCase () && i > 0) {
if (i == name.length - 1 || name.charAt (i + 1) == name.charAt (i + 1).toUpperCase ()) { if (lastWasUpperCase) {
variableName += char; if (i == name.length - 1 || name.charAt (i + 1) == name.charAt (i + 1).toUpperCase ()) {
variableName += char;
} else {
variableName += "_" + char;
}
} else { } else {
@@ -132,19 +146,15 @@ class StringHelper {
} }
lastWasUpperCase = true;
} else { } else {
variableName += "_" + char; variableName += char.toUpperCase ();
lastWasUpperCase = false;
} }
lastWasUpperCase = true;
} else {
variableName += char.toUpperCase ();
lastWasUpperCase = false;
} }
} }