Merge openfl-native templates
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
</section>
|
||||
|
||||
<templatePath name="templates" unless="openfl" />
|
||||
<templatePath name="templates" />
|
||||
<sample path="samples" unless="openfl" />
|
||||
|
||||
</extension>
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
-D android
|
||||
-D android-9
|
||||
-debug
|
||||
-D no-compilation
|
||||
--macro keep("::APP_MAIN::")
|
||||
@@ -1,6 +1,6 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/android/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D android
|
||||
-D android-9
|
||||
-D no-compilation
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<uses-sdk android:minSdkVersion="::ANDROID_MINIMUM_SDK_VERSION::" android:targetSdkVersion="::ANDROID_TARGET_SDK_VERSION::"/>
|
||||
|
||||
<application android:label="::APP_TITLE::" android:debuggable="true"::if (HAS_ICON):: android:icon="@drawable/icon"::end::>
|
||||
<application android:label="::APP_TITLE::" android:debuggable="::DEBUG::"::if (HAS_ICON):: android:icon="@drawable/icon"::end::>
|
||||
|
||||
<activity android:name="MainActivity" android:launchMode="singleTask" android:label="::APP_TITLE::" android:configChanges="keyboard|keyboardHidden|orientation"::if (WIN_ORIENTATION=="portrait"):: android:screenOrientation="sensorPortrait"::end::::if (WIN_ORIENTATION=="landscape"):: android:screenOrientation="sensorLandscape"::end::>
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Vibrator;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
@@ -99,6 +98,7 @@ public class GameActivity extends Activity implements SensorEventListener {
|
||||
//getResources().getAssets();
|
||||
|
||||
requestWindowFeature (Window.FEATURE_NO_TITLE);
|
||||
|
||||
::if WIN_FULLSCREEN::
|
||||
::if (ANDROID_TARGET_SDK_VERSION < 19)::
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
@@ -139,6 +139,8 @@ public class GameActivity extends Activity implements SensorEventListener {
|
||||
mView = new MainView (getApplication (), this);
|
||||
setContentView (mView);
|
||||
|
||||
Extension.mainView = mView;
|
||||
|
||||
sensorManager = (SensorManager)activity.getSystemService (Context.SENSOR_SERVICE);
|
||||
|
||||
if (sensorManager != null) {
|
||||
@@ -165,7 +167,7 @@ public class GameActivity extends Activity implements SensorEventListener {
|
||||
}
|
||||
|
||||
// IMMERSIVE MODE SUPPORT
|
||||
::if (ANDROID_TARGET_SDK_VERSION >= 19)::
|
||||
::if (WIN_FULLSCREEN)::::if (ANDROID_TARGET_SDK_VERSION >= 19)::
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
@@ -188,7 +190,7 @@ public class GameActivity extends Activity implements SensorEventListener {
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
|
||||
::end::
|
||||
::end::::end::
|
||||
|
||||
public static double CapabilitiesGetPixelAspectRatio () {
|
||||
|
||||
@@ -717,6 +719,12 @@ public class GameActivity extends Activity implements SensorEventListener {
|
||||
|
||||
public static void showKeyboard (boolean show) {
|
||||
|
||||
if (activity == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
InputMethodManager mgr = (InputMethodManager)activity.getSystemService (Context.INPUT_METHOD_SERVICE);
|
||||
mgr.hideSoftInputFromWindow (activity.mView.getWindowToken (), 0);
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@@ -36,16 +35,29 @@ class MainView extends GLSurfaceView {
|
||||
static final int etTouchTap = 18;
|
||||
static final int resTerminate = -1;
|
||||
|
||||
boolean isPollImminent;
|
||||
Activity mActivity;
|
||||
static MainView mRefreshView;
|
||||
Timer mTimer = new Timer ();
|
||||
int mTimerID = 0;
|
||||
TimerTask pendingTimer;
|
||||
Runnable pollMe;
|
||||
boolean renderPending = false;
|
||||
|
||||
|
||||
public MainView (Context context, Activity inActivity) {
|
||||
|
||||
super (context);
|
||||
|
||||
isPollImminent = false;
|
||||
final MainView me = this;
|
||||
|
||||
pollMe = new Runnable () {
|
||||
|
||||
@Override public void run () { me.onPoll (); }
|
||||
|
||||
};
|
||||
|
||||
int eglVersion = 1;
|
||||
|
||||
if (::WIN_ALLOW_SHADERS:: || ::WIN_REQUIRE_SHADERS::) {
|
||||
@@ -196,6 +208,7 @@ class MainView extends GLSurfaceView {
|
||||
}
|
||||
|
||||
|
||||
// Haxe Thread
|
||||
public void HandleResult (int inCode) {
|
||||
|
||||
if (inCode == resTerminate) {
|
||||
@@ -206,39 +219,38 @@ class MainView extends GLSurfaceView {
|
||||
}
|
||||
|
||||
double wake = Lime.getNextWake ();
|
||||
final MainView me = this;
|
||||
int delayMS = (int)(wake * 1000);
|
||||
|
||||
if (wake <= 0) {
|
||||
if (renderPending && delayMS < 5) {
|
||||
|
||||
queueEvent (new Runnable () {
|
||||
|
||||
public void run () {
|
||||
|
||||
me.onPoll ();
|
||||
delayMS = 5;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
if (delayMS <= 1) {
|
||||
|
||||
queuePoll ();
|
||||
|
||||
} else {
|
||||
|
||||
final int tid = ++mTimerID;
|
||||
Date end = new Date ();
|
||||
end.setTime (end.getTime () + (int)(wake * 1000));
|
||||
if (pendingTimer != null) {
|
||||
|
||||
mTimer.schedule (new TimerTask () {
|
||||
pendingTimer.cancel ();
|
||||
|
||||
public void run () {
|
||||
}
|
||||
|
||||
if (tid == me.mTimerID) {
|
||||
final MainView me = this;
|
||||
pendingTimer = new TimerTask () {
|
||||
|
||||
@Override public void run () {
|
||||
|
||||
me.queuePoll ();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}, end);
|
||||
mTimer.schedule (pendingTimer, delayMS);
|
||||
|
||||
}
|
||||
|
||||
@@ -303,11 +315,8 @@ class MainView extends GLSurfaceView {
|
||||
|
||||
if (range != null) {
|
||||
|
||||
final float flat = range.getFlat ();
|
||||
final float value = event.getAxisValue (axis);
|
||||
|
||||
if (Math.abs (value) > flat) {
|
||||
|
||||
queueEvent (new Runnable () {
|
||||
|
||||
public void run () {
|
||||
@@ -318,19 +327,6 @@ class MainView extends GLSurfaceView {
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
queueEvent (new Runnable () {
|
||||
|
||||
public void run () {
|
||||
|
||||
me.HandleResult (Lime.onJoyMotion (deviceId, axis, 0));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -442,8 +438,10 @@ class MainView extends GLSurfaceView {
|
||||
}
|
||||
|
||||
|
||||
// Haxe Thread
|
||||
void onPoll () {
|
||||
|
||||
isPollImminent = false;
|
||||
HandleResult (Lime.onPoll ());
|
||||
|
||||
}
|
||||
@@ -520,26 +518,23 @@ class MainView extends GLSurfaceView {
|
||||
}
|
||||
|
||||
|
||||
// GUI/Timer Thread
|
||||
void queuePoll () {
|
||||
|
||||
final MainView me = this;
|
||||
if (!isPollImminent) {
|
||||
|
||||
queueEvent (new Runnable () {
|
||||
|
||||
public void run () {
|
||||
|
||||
me.onPoll ();
|
||||
isPollImminent = true;
|
||||
queueEvent (pollMe);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public void renderNow () { //Called directly from C++
|
||||
|
||||
mRefreshView.renderPending = true;
|
||||
mRefreshView.requestRender ();
|
||||
|
||||
}
|
||||
@@ -601,6 +596,7 @@ class MainView extends GLSurfaceView {
|
||||
|
||||
public void onDrawFrame (GL10 gl) {
|
||||
|
||||
mMainView.renderPending = false;
|
||||
mMainView.HandleResult (Lime.onRender ());
|
||||
Sound.checkSoundCompletion ();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/blackberry/cpp/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D blackberry
|
||||
-debug
|
||||
@@ -1,4 +1,5 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/blackberry/cpp/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D blackberry
|
||||
@@ -1,4 +1,5 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cpp ::CPP_DIR::
|
||||
-cp ::BUILD_DIR::/cpp/haxe
|
||||
--macro keep("::APP_MAIN::")
|
||||
-debug
|
||||
@@ -1,3 +1,4 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/cpp/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
@@ -1,6 +1,7 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/emscripten/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-lib openfl-native
|
||||
-D emscripten
|
||||
-D webgl
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/emscripten/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D emscripten
|
||||
-D webgl
|
||||
@@ -1,115 +0,0 @@
|
||||
import nme.display.Sprite;
|
||||
import nme.events.Event;
|
||||
|
||||
|
||||
class NMEPreloader extends Sprite
|
||||
{
|
||||
private var outline:Sprite;
|
||||
private var progress:Sprite;
|
||||
|
||||
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
||||
var backgroundColor = getBackgroundColor ();
|
||||
var r = backgroundColor >> 16 & 0xFF;
|
||||
var g = backgroundColor >> 8 & 0xFF;
|
||||
var b = backgroundColor & 0xFF;
|
||||
var perceivedLuminosity = (0.299 * r + 0.587 * g + 0.114 * b);
|
||||
var color = 0x000000;
|
||||
|
||||
if (perceivedLuminosity < 70) {
|
||||
|
||||
color = 0xFFFFFF;
|
||||
|
||||
}
|
||||
|
||||
var x = 30;
|
||||
var height = 9;
|
||||
var y = getHeight () / 2 - height / 2;
|
||||
var width = getWidth () - x * 2;
|
||||
|
||||
var padding = 3;
|
||||
|
||||
outline = new Sprite ();
|
||||
outline.graphics.lineStyle (1, color, 0.15, true);
|
||||
outline.graphics.drawRoundRect (0, 0, width, height, padding * 2, padding * 2);
|
||||
outline.x = x;
|
||||
outline.y = y;
|
||||
addChild (outline);
|
||||
|
||||
progress = new Sprite ();
|
||||
progress.graphics.beginFill (color, 0.35);
|
||||
progress.graphics.drawRect (0, 0, width - padding * 2, height - padding * 2);
|
||||
progress.x = x + padding;
|
||||
progress.y = y + padding;
|
||||
progress.scaleX = 0;
|
||||
addChild (progress);
|
||||
}
|
||||
|
||||
|
||||
public function getBackgroundColor():Int
|
||||
{
|
||||
return ::WIN_BACKGROUND::;
|
||||
}
|
||||
|
||||
|
||||
public function getHeight():Float
|
||||
{
|
||||
var height = ::WIN_HEIGHT::;
|
||||
|
||||
if (height > 0) {
|
||||
|
||||
return height;
|
||||
|
||||
} else {
|
||||
|
||||
return nme.Lib.current.stage.stageHeight;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getWidth():Float
|
||||
{
|
||||
var width = ::WIN_WIDTH::;
|
||||
|
||||
if (width > 0) {
|
||||
|
||||
return width;
|
||||
|
||||
} else {
|
||||
|
||||
return nme.Lib.current.stage.stageWidth;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function onInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function onLoaded()
|
||||
{
|
||||
dispatchEvent (new Event (Event.COMPLETE));
|
||||
}
|
||||
|
||||
|
||||
public function onUpdate(bytesLoaded:Int, bytesTotal:Int)
|
||||
{
|
||||
var percentLoaded = bytesLoaded / bytesTotal;
|
||||
|
||||
if (percentLoaded > 1)
|
||||
{
|
||||
percentLoaded == 1;
|
||||
}
|
||||
|
||||
progress.scaleX = percentLoaded;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-D iphone
|
||||
-D ios
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D no-compilation
|
||||
@@ -1,4 +1,5 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/neko/haxe
|
||||
-neko ::NEKO_FILE::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-debug
|
||||
@@ -1,3 +1,4 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/neko/haxe
|
||||
-neko ::NEKO_FILE::
|
||||
--macro keep("::APP_MAIN::")
|
||||
0
templates/neko/ndll/mac/libneko.dylib
Normal file → Executable file
0
templates/neko/ndll/mac/libneko.dylib
Normal file → Executable file
0
templates/neko/ndll/mac/regexp.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/regexp.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/sqlite.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/sqlite.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/std.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/std.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/zlib.ndll
Normal file → Executable file
0
templates/neko/ndll/mac/zlib.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/libneko.dylib
Normal file → Executable file
0
templates/neko/ndll/mac64/libneko.dylib
Normal file → Executable file
0
templates/neko/ndll/mac64/regexp.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/regexp.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/sqlite.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/sqlite.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/std.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/std.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/zlib.ndll
Normal file → Executable file
0
templates/neko/ndll/mac64/zlib.ndll
Normal file → Executable file
@@ -1,6 +1,7 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/tizen/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D tizen
|
||||
-debug
|
||||
-D no-compilation
|
||||
@@ -1,5 +1,6 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/tizen/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D tizen
|
||||
-D no-compilation
|
||||
@@ -1,4 +1,4 @@
|
||||
PLATFORM_VER:Tizen 2.2
|
||||
ARCHITECTURE:armel
|
||||
ARCHITECTURE:::if (SIMULATOR)::i386::else::armel::end::
|
||||
TOOLCHAIN:GCC-4.5
|
||||
TYPE:app
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
|
||||
<Id>::APP_PACKAGE::</Id>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>::APP_VERSION::</Version>
|
||||
<Type>C++App</Type>
|
||||
<Requirements>
|
||||
<Feature Name="http://tizen.org/feature/platform.native.api.version">2.2</Feature>
|
||||
<Feature Name="http://tizen.org/feature/screen.size.all">true</Feature>
|
||||
<Feature Name="http://tizen.org/api/filesystem">true</Feature>
|
||||
</Requirements>
|
||||
<Apps>
|
||||
<ApiVersion>2.2</ApiVersion>
|
||||
<Privileges></Privileges>
|
||||
<UiApp Name="::APP_FILE::" Main="True" MenuIconVisible="False">
|
||||
<UiScalability CoordinateSystem="Logical" BaseScreenSize="Normal" LogicalCoordinate="720"></UiScalability>
|
||||
<UiTheme SystemTheme="White"></UiTheme>
|
||||
<Privileges>
|
||||
<Privilege>http://tizen.org/privilege/application.launch</Privilege>
|
||||
</Privileges>
|
||||
<UiApp HwAcceleration="On" Name="::APP_FILE::" Main="True" MenuIconVisible="True">
|
||||
<UiScalability CoordinateSystem="Physical"></UiScalability>
|
||||
<UiTheme SystemTheme="Black"></UiTheme>
|
||||
<DisplayNames>
|
||||
<DisplayName Locale="eng-GB">::APP_TITLE::</DisplayName>
|
||||
</DisplayNames>
|
||||
<Icons>
|
||||
<Icon Section="MainMenu">mainmenu.png</Icon>
|
||||
</Icons>
|
||||
<LaunchConditions/>
|
||||
</UiApp>
|
||||
</Apps>
|
||||
</Manifest>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/webos/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D webos
|
||||
-D HXCPP_LOAD_DEBUG
|
||||
-D HXCPP_RTLD_LAZY
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-main ApplicationMain ::HAXE_FLAGS::
|
||||
-cp ::BUILD_DIR::/webos/haxe
|
||||
-cpp ::CPP_DIR::
|
||||
--macro keep("::APP_MAIN::")
|
||||
-D webos
|
||||
-D HXCPP_RTLD_LAZY
|
||||
Reference in New Issue
Block a user