Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android

This commit is contained in:
Gerhard Stein
2014-07-03 16:07:05 +02:00
42 changed files with 1399 additions and 1257 deletions

4
.gitignore vendored
View File

@@ -13,4 +13,8 @@ project/jni/application/*/libapplication*.so
project/jni/application/src
project/res/drawable-xhdpi/ouya_icon.png
project/res/drawable/app_icon.png
project/proguard-project.txt
project/themes/converter

View File

@@ -6,7 +6,7 @@ APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' |
ARCHIVER=gzip
EXT=gz
which xz > /dev/null && ARCHIVER="xz -z" && EXT=xz
which pxz > /dev/null && ARCHIVER=pxz && EXT=xz
which pxz > /dev/null && ARCHIVER=pxz && EXT=xz || echo "Install pxz for faster archiving: sudo apt-get isntall pxz"
# TODO: Boost, Python and ffmpeg are stored in repository as precompiled binaries, the proper way to fix that is to build them using scripts, and remove that binaries
# --exclude="*.a" --exclude="*.so"

View File

@@ -13,7 +13,6 @@
android:label="@string/app_name"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask"
android:screenOrientation="sensorLandscape"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode|screenSize|smallestScreenSize"
android:windowSoftInputMode="stateUnspecified|adjustPan"
>

View File

@@ -90,25 +90,30 @@ class AccelerometerReader implements SensorEventListener
static class GyroscopeListener implements SensorEventListener
{
public float x1 = 0.0f, x2 = 0.0f, xc = 0.0f, y1 = 0.0f, y2 = 0.0f, yc = 0.0f, z1 = 0.0f, z2 = 0.0f, zc = 0.0f;
public boolean invertedOrientation = false;
public GyroscopeListener()
{
}
public void onSensorChanged(SensorEvent event)
{
// TODO: vertical orientation
if( Globals.HorizontalOrientation )
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
{
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
nativeGyroscope(event.values[0] - xc, event.values[1] - yc, event.values[2] - zc);
}
else
{
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
nativeGyroscope(-(event.values[1] - yc), event.values[0] - xc, event.values[2] - zc);
if( Globals.HorizontalOrientation )
{
if( invertedOrientation )
nativeGyroscope(-(event.values[0] - xc), -(event.values[1] - yc), event.values[2] - zc);
else
nativeGyroscope(event.values[0] - xc, event.values[1] - yc, event.values[2] - zc);
}
else
{
if( invertedOrientation )
nativeGyroscope(-(event.values[1] - yc), event.values[0] - xc, event.values[2] - zc);
else
nativeGyroscope(event.values[1] - yc, -(event.values[0] - xc), event.values[2] - zc);
}
}
}
public void onAccuracyChanged(Sensor s, int a)

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,6 @@ class Globals
public static final boolean Using_SDL_1_3 = false;
public static final boolean Using_SDL_2_0 = false;
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
public static int VideoDepthBpp = 16;
public static boolean SwVideoMode = false;
public static boolean NeedDepthBuffer = false;
public static boolean NeedStencilBuffer = false;
@@ -44,7 +43,6 @@ class Globals
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
public static boolean CompatibilityHacksStaticInit = false;
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
public static boolean HorizontalOrientation = true;
public static boolean KeepAspectRatioDefaultSetting = false;
public static boolean InhibitSuspend = false;
public static boolean CreateService = false;
@@ -55,7 +53,6 @@ class Globals
public static boolean RightMouseButtonLongPress = true;
public static boolean ForceRelativeMouseMode = false; // If both on-screen keyboard and mouse are needed, this will only set the default setting, user may override it later
public static boolean ShowMouseCursor = false;
public static boolean GenerateSubframeTouchEvents = false;
public static boolean AppNeedsArrowKeys = true;
public static boolean AppNeedsTextInput = true;
public static boolean AppUsesJoystick = false;
@@ -65,7 +62,6 @@ class Globals
public static boolean AppUsesGyroscope = false;
public static boolean AppUsesMultitouch = false;
public static boolean NonBlockingSwapBuffers = false;
public static boolean ImmersiveMode = true;
public static boolean ResetSdlConfigForThisVersion = false;
public static String DeleteFilesOnUpgrade = "";
public static int AppTouchscreenKeyboardKeysAmount = 4;
@@ -79,6 +75,9 @@ class Globals
public static String AdmobBannerSize = "";
// Phone-specific config, modified by user in "Change phone config" startup dialog
public static int VideoDepthBpp = 16;
public static boolean HorizontalOrientation = true;
public static boolean ImmersiveMode = true;
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasTrackball = false;
public static boolean PhoneHasArrowKeys = false;
@@ -115,6 +114,7 @@ class Globals
public static int ClickScreenTouchspotSize = 0;
public static boolean FingerHover = true;
public static boolean HoverJitterFilter = true;
public static boolean GenerateSubframeTouchEvents = false;
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
public static int RemapScreenKbKeycode[] = new int[6];

View File

@@ -79,6 +79,8 @@ import android.content.pm.ActivityInfo;
import android.view.Display;
import android.text.InputType;
import android.util.Log;
import android.view.Surface;
public class MainActivity extends Activity
{
@@ -87,12 +89,7 @@ public class MainActivity extends Activity
{
super.onCreate(savedInstanceState);
//if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2 )
// setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
else
setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setScreenOrientation();
instance = this;
// fullscreen mode
@@ -127,6 +124,7 @@ public class MainActivity extends Activity
setUpStatusLabel();
Log.i("SDL", "libSDL: User clicked change phone config button");
loadedLibraries.acquireUninterruptibly();
setScreenOrientation();
SettingsMenu.showConfig(p, false);
}
};
@@ -235,7 +233,7 @@ public class MainActivity extends Activity
if( Parent._tv == null )
{
//Get the display so we can know the screen size
Display display = getWindowManager().getDefaultDisplay();
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
Parent._tv = new TextView(Parent);
@@ -269,6 +267,9 @@ public class MainActivity extends Activity
public void initSDL()
{
setScreenOrientation();
updateScreenOrientation();
Log.i("SDL", "onConfigurationChanged(): screen orientation: inverted " + AccelerometerReader.gyro.invertedOrientation);
(new Thread(new Runnable()
{
public void run()
@@ -312,6 +313,7 @@ public class MainActivity extends Activity
Log.i("SDL", "libSDL: Initializing video and SDL application");
sdlInited = true;
DimSystemStatusBar.get().dim(_videoLayout);
_videoLayout.removeView(_layout);
if( _ad.getView() != null )
_videoLayout.removeView(_ad.getView());
@@ -334,7 +336,6 @@ public class MainActivity extends Activity
_videoLayout.addView(_ad.getView());
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT));
}
// Receive keyboard events
DimSystemStatusBar.get().dim(_videoLayout);
DimSystemStatusBar.get().dim(mGLView);
}
@@ -839,10 +840,20 @@ public class MainActivity extends Activity
@Override
public void onConfigurationChanged(Configuration newConfig)
{
// This function is actually never called
super.onConfigurationChanged(newConfig);
// Do nothing here
updateScreenOrientation();
}
public void updateScreenOrientation()
{
int rotation = Surface.ROTATION_0;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO )
rotation = getWindowManager().getDefaultDisplay().getRotation();
AccelerometerReader.gyro.invertedOrientation = ( rotation == Surface.ROTATION_180 || rotation == Surface.ROTATION_270 );
//Log.d("SDL", "updateScreenOrientation(): screen orientation: " + rotation + " inverted " + AccelerometerReader.gyro.invertedOrientation);
}
public void setText(final String t)
{
class Callback implements Runnable
@@ -1184,6 +1195,14 @@ public class MainActivity extends Activity
return getOrient.getWidth() >= getOrient.getHeight();
}
void setScreenOrientation()
{
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
else
setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
public FrameLayout getVideoLayout() { return _videoLayout; }
static int NOTIFY_ID = 12367098; // Random ID

View File

@@ -178,6 +178,10 @@ class Settings
out.writeInt(Globals.MoveMouseWithGyroscopeSpeed);
out.writeBoolean(Globals.FingerHover);
out.writeBoolean(Globals.FloatingScreenJoystick);
out.writeBoolean(Globals.GenerateSubframeTouchEvents);
out.writeInt(Globals.VideoDepthBpp);
out.writeBoolean(Globals.HorizontalOrientation);
out.writeBoolean(Globals.ImmersiveMode);
out.close();
settingsLoaded = true;
@@ -366,6 +370,10 @@ class Settings
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
Globals.FingerHover = settingsFile.readBoolean();
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
Globals.GenerateSubframeTouchEvents = settingsFile.readBoolean();
Globals.VideoDepthBpp = settingsFile.readInt();
Globals.HorizontalOrientation = settingsFile.readBoolean();
Globals.ImmersiveMode = settingsFile.readBoolean();
settingsLoaded = true;

View File

@@ -96,6 +96,7 @@ class SettingsMenuKeyboard extends SettingsMenu
new ScreenKeyboardTransparencyConfig(),
new RemapScreenKbConfig(),
new CustomizeScreenKbLayout(),
new ScreenKeyboardAdvanced(),
new OkButton(),
};
showMenuOptionsList(p, options);
@@ -850,5 +851,53 @@ class SettingsMenuKeyboard extends SettingsMenu
}
}
}
static class ScreenKeyboardAdvanced extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.advanced);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.screenkb_floating_joystick),
};
boolean defaults[] = {
Globals.FloatingScreenJoystick,
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.advanced));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.FloatingScreenJoystick = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
}

View File

@@ -345,11 +345,17 @@ class SettingsMenuMisc extends SettingsMenu
debugMenuShowCount++;
CharSequence[] items = {
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth)
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_immersive),
p.getResources().getString(R.string.video_orientation_vertical),
p.getResources().getString(R.string.video_bpp_24),
};
boolean defaults[] = {
boolean defaults[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter
Globals.VideoLinearFilter,
Globals.ImmersiveMode,
!Globals.HorizontalOrientation,
Globals.VideoDepthBpp == 24,
};
if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo)
@@ -357,12 +363,18 @@ class SettingsMenuMisc extends SettingsMenu
CharSequence[] items2 = {
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_immersive),
p.getResources().getString(R.string.video_orientation_vertical),
p.getResources().getString(R.string.video_bpp_24),
p.getResources().getString(R.string.video_separatethread),
};
boolean defaults2[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
Globals.MultiThreadedVideo
Globals.ImmersiveMode,
!Globals.HorizontalOrientation,
Globals.VideoDepthBpp == 24,
Globals.MultiThreadedVideo,
};
items = items2;
defaults = defaults2;
@@ -391,6 +403,12 @@ class SettingsMenuMisc extends SettingsMenu
if( item == 1 )
Globals.VideoLinearFilter = isChecked;
if( item == 2 )
Globals.ImmersiveMode = isChecked;
if( item == 3 )
Globals.HorizontalOrientation = !isChecked;
if( item == 4 )
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
if( item == 5 )
Globals.MultiThreadedVideo = isChecked;
}
});

View File

@@ -409,7 +409,7 @@ class SettingsMenuMouse extends SettingsMenu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.mouse_question);
return p.getResources().getString(R.string.advanced);
}
void run (final MainActivity p)
{
@@ -420,6 +420,7 @@ class SettingsMenuMouse extends SettingsMenu
p.getResources().getString(R.string.mouse_relative),
p.getResources().getString(R.string.mouse_gyroscope_mouse),
p.getResources().getString(R.string.mouse_finger_hover),
p.getResources().getString(R.string.mouse_subframe_touch_events),
};
boolean defaults[] = {
@@ -429,11 +430,11 @@ class SettingsMenuMouse extends SettingsMenu
Globals.RelativeMouseMovement,
Globals.MoveMouseWithGyroscope,
Globals.FingerHover,
Globals.GenerateSubframeTouchEvents,
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.mouse_question));
builder.setTitle(p.getResources().getString(R.string.advanced));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
@@ -450,6 +451,8 @@ class SettingsMenuMouse extends SettingsMenu
Globals.MoveMouseWithGyroscope = isChecked;
if( item == 5 )
Globals.FingerHover = isChecked;
if( item == 6 )
Globals.GenerateSubframeTouchEvents = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()

View File

@@ -380,7 +380,7 @@ abstract class DifferentTouchInput
}
buttonState = buttonStateNew;
}
super.process(event); // Push mouse coordinate first
super.process(event);
}
public void processGenericEvent(final MotionEvent event)
{
@@ -427,7 +427,7 @@ abstract class DifferentTouchInput
DemoGLSurfaceView.nativeMotionEvent( (int)event.getHistoricalX(i), (int)event.getHistoricalY(i),
Mouse.SDL_FINGER_MOVE, ptr, (int)( event.getHistoricalPressure(i) * Mouse.MAX_PRESSURE ), (int)( event.getHistoricalSize(i) * Mouse.MAX_PRESSURE ) );
}
super.process(event); // Push mouse coordinate first
super.process(event);
}
}
private static class CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad extends IcsTouchInput
@@ -719,6 +719,16 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
Thread.sleep(50); // Give some time to the keyboard input thread
} catch(Exception e) { };
}
// We will not receive onConfigurationChanged() inside MainActivity with SCREEN_ORIENTATION_SENSOR_LANDSCAPE
// so we need to create a hacky frame counter to update screen orientation, because this call takes up some time
mOrientationFrameHackyCounter++;
if( mOrientationFrameHackyCounter > 100 )
{
mOrientationFrameHackyCounter = 0;
context.updateScreenOrientation();
}
return 1;
}
@@ -913,6 +923,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public int mWidth = 0;
public int mHeight = 0;
private ClipboardManager clipboard = null;
int mOrientationFrameHackyCounter = 0;
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
}
@@ -960,7 +971,12 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
try
{
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
} catch (InterruptedException e) { }
}
catch (InterruptedException e)
{
Log.v("SDL", "DemoGLSurfaceView::limitEventRate(): Who dared to interrupt my slumber?");
Thread.interrupted();
}
}
}
}

View File

@@ -62,7 +62,7 @@
<string name="rightclick_menu">Menütaste</string>
<string name="rightclick_multitouch">Touch-Screen mit dem zweiten Finger</string>
<string name="rightclick_pressure">Touchscreen mit Kraft</string>
<string name="mouse_question">Erweiterte Funktionen</string>
<string name="advanced">Erweiterte Funktionen</string>
<string name="mouse_keepaspectratio">Halten 4:3-Bildschirm Seitenverhältnis</string>
<string name="mouse_showcreenunderfinger">Show-Bildschirm unter dem Finger in einem separaten Fenster</string>
<string name="measurepressure_touchplease">Bitte schieben Sie den Finger über den Bildschirm für zwei Sekunden</string>

View File

@@ -62,7 +62,7 @@
<string name="rightclick_menu">Valikkonäppäin</string>
<string name="rightclick_multitouch">Kosketusnäyttö on toinen sormi</string>
<string name="rightclick_pressure">Kosketusnäyttö voimalla</string>
<string name="mouse_question">Lisäominaisuudet</string>
<string name="advanced">Lisäominaisuudet</string>
<string name="mouse_keepaspectratio">Pidä 04:03 kuvasuhde</string>
<string name="mouse_showcreenunderfinger">Näytä näytön alle sormi erillisessä ikkunassa</string>
<string name="measurepressure_touchplease">Ole hyvä ja liu\u0026#39;uttamalla sormea näytöllä kaksi sekuntia</string>

View File

@@ -98,7 +98,7 @@
<string name="leftclick_timeout_time_4">1,5 sec</string>
<string name="click_with_dpadcenter">Cliquez gauche de la souris avec le Trackball / centre du joystick </string>
<string name="mouse_question">Fonctionnalités avancées</string>
<string name="advanced">Fonctionnalités avancées</string>
<string name="mouse_keepaspectratio">Gardez le format 4:3 écran</string>
<string name="mouse_showcreenunderfinger">Afficher l\'écran sous le doigt dans une fenêtre séparée</string>
<string name="mouse_showcreenunderfinger2">Loupe à l\'écran</string>

View File

@@ -46,7 +46,7 @@
<string name="rightclick_menu">Кнопка меню</string>
<string name="rightclick_multitouch">Касание экрана вторым пальцем</string>
<string name="rightclick_pressure">Нажатие на экран с силой</string>
<string name="mouse_question">Расширенные функции</string>
<string name="advanced">Расширенные функции</string>
<string name="mouse_keepaspectratio">Сохранять соотношение сторон 4:3 на экране</string>
<string name="mouse_showcreenunderfinger">Экранная лупа</string>
<string name="measurepressure_touchplease">Пожалуйста, проведите пальцем по экрану в течение двух секунд</string>

View File

@@ -46,7 +46,7 @@
<string name="rightclick_menu">Кнопка меню</string>
<string name="rightclick_multitouch">Торкання екрана другим пальцем</string>
<string name="rightclick_pressure">Натиск на екран силою</string>
<string name="mouse_question">Розширені функції</string>
<string name="advanced">Розширені функції</string>
<string name="mouse_keepaspectratio">Зберігати співвідношення сторін 4:3 на екрані</string>
<string name="mouse_showcreenunderfinger">Наекранна лупа</string>
<string name="measurepressure_touchplease">Будь-ласка, проведіть пальцем по екрану на протязі двох секунд</string>

View File

@@ -98,7 +98,7 @@
<string name="leftclick_timeout_time_4">1.5 sec</string>
<string name="click_with_dpadcenter">Left mouse click with trackball / joystick center</string>
<string name="mouse_question">Advanced features</string>
<string name="advanced">Advanced features</string>
<string name="mouse_keepaspectratio">Keep 4:3 screen aspect ratio</string>
<string name="mouse_showcreenunderfinger">Show screen under finger in separate window</string>
<string name="mouse_showcreenunderfinger2">On-screen magnifying glass</string>
@@ -112,6 +112,7 @@
<string name="mouse_gyroscope_mouse">Control mouse with gyroscope</string>
<string name="mouse_gyroscope_mouse_sensitivity">Gyroscope sensitivity</string>
<string name="mouse_finger_hover">Finger hover</string>
<string name="mouse_subframe_touch_events">Multiple touch events per video frame</string>
<string name="none">None</string>
@@ -144,13 +145,17 @@
<string name="screenkb_custom_layout">Customize on-screen keyboard layout</string>
<string name="screenkb_custom_layout_help">Press BACK when done. Resize buttons by sliding on empty space.</string>
<string name="screenkb_floating_joystick">Floating joystick</string>
<string name="calibrate_touchscreen">Calibrate touchscreen</string>
<string name="calibrate_touchscreen_touch">Touch all edges of the screen, press BACK when done</string>
<string name="video">Video settings</string>
<string name="video_smooth">Linear video filtering</string>
<string name="video_separatethread">Separate thread for video, will increase FPS on some devices</string>
<string name="video_separatethread">Separate thread for video, it can increase FPS, it also can crash the app</string>
<string name="video_orientation_vertical">Portrait/vertical screen orientation</string>
<string name="video_bpp_24">24 bpp screen color depth</string>
<string name="video_immersive">Hide system navigation buttons / immersive mode</string>
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>

View File

@@ -0,0 +1 @@
openttd-build-*

View File

@@ -7,10 +7,10 @@ AppName="OpenTTD"
AppFullName=org.openttd.sdl
# Application version code (integer)
AppVersionCode=14132
AppVersionCode=14133
# Application user-visible version name (string)
AppVersionName="1.4.1.32"
AppVersionName="1.4.1.33"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -21,7 +21,7 @@ AppVersionName="1.4.1.32"
AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.1.zip/download^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!!Internationalization files|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip/download"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
ResetSdlConfigForThisVersion=n
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade=""
@@ -201,7 +201,7 @@ FirstStartMenuOptions=''
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)
MultiABI=all
MultiABI=armeabi-v7a
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0

View File

@@ -2,7 +2,7 @@
LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
VER=1.4.0-beta5
VER=build
[ -d openttd-$VER-$1 ] || mkdir -p openttd-$VER-$1/bin/baseset

View File

@@ -0,0 +1 @@
supertux

View File

@@ -0,0 +1 @@
AndroidData

View File

@@ -7,10 +7,10 @@ AppName="Debian"
AppFullName=com.cuntubuntu
# Application version code (integer)
AppVersionCode=140503
AppVersionCode=140701
# Application user-visible version name (string)
AppVersionName="14.05.03"
AppVersionName="14.07.01"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -18,17 +18,17 @@ AppVersionName="14.05.03"
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-debug-wheezy-proot-<ARCH>.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh"
AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-debug-wheezy-proot-<ARCH>.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh^!!Update|:update1.tar.gz:update1.tgz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag libsdl-DownloadFinished-1.flag libsdl-DownloadFinished-2.flag libsdl-DownloadFinished-3.flag"
DeleteFilesOnUpgrade="%"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText='This app will download 220 Mb data,\\\\nand will use 600 Mb of internal storage.\\\\nYour old installation will be removed\\\\n^button:Install old version:http://sourceforge.net/projects/libsdl-android/files/ubuntu/'
ReadmeText='This app will download 220 Mb data,\\\\n and will use 600 Mb of internal storage.'
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2

View File

@@ -16,7 +16,7 @@ x11proto-xext-dev x11proto-xf86bigfont-dev \
x11proto-xf86dga-dev x11proto-xf86dri-dev \
x11proto-xf86vidmode-dev x11proto-xinerama-dev \
libxmuu-dev libxt-dev libsm-dev libice-dev \
libxrender-dev libxrandr-dev curl
libxrender-dev libxrandr-dev curl autoconf automake libtool
You will need both xcb-proto and python-xcbgen packages
to have version 1.10-1, you may download newer packages

View File

@@ -18,13 +18,13 @@ AppVersionName="2.8.2.15"
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!!Data files|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-gimp-wheezy-<ARCH>.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh"
AppDataDownloadUrl="!!Data files|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-gimp-wheezy-<ARCH>.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh^!!Update|:update1.tar.gz:update1.tgz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag libsdl-DownloadFinished-1.flag libsdl-DownloadFinished-2.flag libsdl-DownloadFinished-3.flag"
DeleteFilesOnUpgrade="%"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
@@ -187,13 +187,13 @@ StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout
HiddenMenuOptions=''
HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout
FirstStartMenuOptions='SettingsMenu.DummyMenu'
FirstStartMenuOptions=''
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)

View File

@@ -16,7 +16,7 @@ x11proto-xext-dev x11proto-xf86bigfont-dev \
x11proto-xf86dga-dev x11proto-xf86dri-dev \
x11proto-xf86vidmode-dev x11proto-xinerama-dev \
libxmuu-dev libxt-dev libsm-dev libice-dev \
libxrender-dev libxrandr-dev curl
libxrender-dev libxrandr-dev curl autoconf automake libtool
You will need both xcb-proto and python-xcbgen packages
to have version 1.10-1, you may download newer packages

View File

@@ -1 +1,3 @@
*.o
AndroidData/binaries-*
tmp-*

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=11115
AppVersionCode=11116
# Application user-visible version name (string)
AppVersionName="1.11.15"
AppVersionName="1.11.16"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -21,7 +21,7 @@ AppVersionName="1.11.15"
AppDataDownloadUrl="!!Data files|:data.tar.gz:data-1.tgz^!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf^Additional fonts (90Mb)|:xfonts.tar.gz:http://sourceforge.net/projects/libsdl-android/files/apk/XServer-XSDL/xfonts.tgz/download"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
ResetSdlConfigForThisVersion=n
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="%"
@@ -204,7 +204,7 @@ FirstStartMenuOptions='SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.Op
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)
MultiABI='armeabi-v7a x86 mips'
MultiABI=all
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0

View File

@@ -48,7 +48,6 @@ static int unpackFiles(const char *archive, const char *script, const char *dele
return 1;
unpackProgressMb = 0;
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/" );
@@ -197,7 +196,7 @@ static int unpackFiles(const char *archive, const char *script, const char *dele
strcat( fname2, script );
strcat( fname2, " > " );
strcat( fname2, fname );
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Copying postinstall scipt from SD card: %s", fname2);
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Copying postinstall script from SD card: %s", fname2);
system( fname2 );
}
}
@@ -220,6 +219,8 @@ static int unpackFiles(const char *archive, const char *script, const char *dele
{
if( !fgets(buf, sizeof(buf), fo) )
break;
if( strchr(buf, '\n') != NULL )
strchr(buf, '\n')[0] = 0;
__android_log_print(ANDROID_LOG_INFO, "XSDL", "> %s", buf);
strncpy(unpackLog[3], unpackLog[2], sizeof(unpackLog[1]) - 4);
strncpy(unpackLog[2], unpackLog[1], sizeof(unpackLog[1]) - 4);
@@ -228,7 +229,7 @@ static int unpackFiles(const char *archive, const char *script, const char *dele
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Postinstall script exited with status %d", pclose(fo));
sprintf(unpackLog[0], "Running postinstall script finished");
return 1;
}
@@ -236,11 +237,11 @@ static void * unpackFilesThread(void * unused)
{
const char *unpack[][3] =
{
{"data.tar.gz", "postinstall.sh", "usr/lib/xorg/protocol.txt" },
{"xfonts.tar.gz", "", "" },
{"update1.tar.gz", "update1.sh", "" },
{"update2.tar.gz", "update2.sh", "" },
{"update3.tar.gz", "update3.sh", "" },
{ "data.tar.gz", "postinstall.sh", "usr/lib/xorg/protocol.txt" },
{ "xfonts.tar.gz", "", "" },
{ "update1.tar.gz", "update1.sh", "" },
{ "update2.tar.gz", "update2.sh", "" },
{ "update3.tar.gz", "update3.sh", "" },
{NULL, NULL, NULL}
};
int i;

View File

@@ -51,12 +51,10 @@ int main( int argc, char* argv[] )
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Actual video resolution %d/%dx%d/%d", resolutionW, displayW, resolutionH, displayH);
setupEnv();
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 0);
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, 0);
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
SDL_ANDROID_SetScreenKeyboardShown(0);
XSDL_initSDL();
XSDL_unpackFiles();
XSDL_showConfigMenu(&resolutionW, &displayW, &resolutionH, &displayH);
@@ -164,11 +162,13 @@ int main( int argc, char* argv[] )
argnum += 2;
}
if( screenButtons )
SDL_ANDROID_SetScreenKeyboardShown(1);
if( screenButtons && !SDL_ANDROID_GetScreenKeyboardRedefinedByUser() )
{
SDL_Rect pos;
pos.x = 0;
pos.h = SDL_ListModes(NULL, 0)[0]->h / 10;
pos.h = SDL_ListModes(NULL, 0)[0]->h / 20;
pos.y = SDL_ListModes(NULL, 0)[0]->h - pos.h;
pos.w = 40 * SDL_ListModes(NULL, 0)[0]->w / resolutionW;
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1);

View File

@@ -16,7 +16,7 @@ x11proto-xext-dev x11proto-xf86bigfont-dev \
x11proto-xf86dga-dev x11proto-xf86dri-dev \
x11proto-xf86vidmode-dev x11proto-xinerama-dev \
libxmuu-dev libxt-dev libsm-dev libice-dev \
libxrender-dev libxrandr-dev curl
libxrender-dev libxrandr-dev curl autoconf automake libtool
You will need both xcb-proto and python-xcbgen packages
to have version 1.10-1, you may download newer packages

View File

@@ -103,6 +103,10 @@ extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEven
/* Configure a button to stay pressed after touch, and un-press after second touch, to emulate Ctrl/Alt/Shift keys */
extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonStayPressedAfterTouch(int buttonId, int stayPressed);
/* Enable or disable floating joystick, the joystick is hidden after you disable floating joystick,
you should set it's coordinates with SDL_ANDROID_SetScreenKeyboardButtonPos(). */
extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardFloatingJoystick(int enabled);
/* Set screen keyboard transparency, 255 or SDL_ALPHA_OPAQUE is non-transparent, 0 or SDL_ALPHA_TRANSPARENT is transparent */
extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardTransparency(int alpha);

View File

@@ -830,6 +830,8 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMotionEvent) ( JNIEnv* env, jobject t
return;
#endif
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Motion event: %4d %4d action %d ptr %d, force %d radius %d", x, y, action, pointerId, force, radius);
pointerId = BumpPointerId( pointerId );
if( ProcessTouchscreenKeyboard( x, y, action, pointerId ) )
@@ -883,12 +885,9 @@ static void ProcessMoveMouseWithGyroscope(float gx, float gy, float gz)
if( hardwareMouseDetected == MOUSE_HW_INPUT_MOUSE ) // We don't need all that stuff with a proper precise input device
return;
gx += gz; // Ignore Z?
gx *= -moveMouseWithGyroscopeSpeed;
gy *= moveMouseWithGyroscopeSpeed; // Screen has Y coordinate inverted
//gx *= 10; // debug
//gy *= 10; // debug
//gx += gz; // Ignore Z
gx *= moveMouseWithGyroscopeSpeed;
gy *= -moveMouseWithGyroscopeSpeed; // Screen has Y coordinate inverted
static float subpixelX = 0.0f, subpixelY = 0.0f;

View File

@@ -1191,6 +1191,14 @@ int SDL_ANDROID_SetScreenKeyboardHintMesage(const char * hint)
return 1;
}
extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardFloatingJoystick(int enabled)
{
floatingScreenJoystick = enabled;
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, 0);
return 1;
}
/**
* @brief Dumps OpenGL state for debugging - typically every capability set with glEnable().
*/

View File

@@ -15,16 +15,9 @@ TODO, which will get actually done
- SuperTux: Update, enable OpenGL renderer, add touchscreen jump helper, add gamepad support, fix zoom in settings.
- SDL: make sub-frame touch events as an user-configurable option.
- SDL: control mouse with right analog gamepad stick.
- SDL: user-configurable option to set screen orientation and BPP.
- SDL: floating on-screen joystick - initially invisible, it appears when you touch the screen,
centered on your finger, then it slides with your finger if you bump the joystick edge.
- SDL: option to disable immersive mode.
- SDL: sometimes the screen stays black after restoring from background.
- OpenTTD: All menus in the scenario editor are out of the screen.
@@ -46,10 +39,8 @@ TODO, which will get actually done
- OpenTTD: "Open website" button in online resource menu is broken.
- OpenTTD: Frameskip when fast-forward button pressed.
- OpenTTD: Face selection dialog is too tall.
- Debian noroot: audio support.
- Debian noroot: add Java dirs to PATH, add support for update scripts.
- XSDL: add downloadable raster fonts, add path to fonts to Debian/Gimp.
- Gimp: update - add Java dirs to PATH and use new mouse name in Gimp config.