First implementation of picture button theme, still no transparency
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
fixed with a hammer and rasp to work with libSDL port */
|
||||
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
class Globals {
|
||||
public static String ApplicationName = "Ur-QuanMasters";
|
||||
public static String ApplicationName = "OpenTyrian";
|
||||
|
||||
// Should be zip file
|
||||
public static String DataDownloadUrl = "Game data is 14 Mb|https://sites.google.com/site/xpelyax/Home/sc2-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/sc2-data.zip^3DO remixed music (19 Mb)|:addons/3domusic/3domusic.zip:https://sites.google.com/site/xpelyax/Home/3domusic.zip?attredirects=0%26d=1|:addons/3domusic/3domusic.zip:http://sitesproxy.goapk.com/site/xpelyax/Home/3domusic.zip^UQM music remix pack 1 (50 Mb)|:addons/remix/uqm-remix-pack1.zip:http://sourceforge.net/projects/sc2/files/UQM%20Remix%20Packs/UQM%20Remix%20Pack%201/uqm-remix-pack1.zip/download^UQM music remix pack 2 (60 Mb)|:addons/remix/uqm-remix-pack2.zip:http://sourceforge.net/projects/sc2/files/UQM%20Remix%20Packs/UQM%20Remix%20Pack%202/uqm-remix-pack2.zip/download^UQM music remix pack 3 (40 Mb)|:addons/remix/uqm-remix-pack3.zip:http://sourceforge.net/projects/sc2/files/UQM%20Remix%20Packs/UQM%20Remix%20Pack%203/uqm-remix-pack3.zip/download";
|
||||
public static String DataDownloadUrl = "Data files size is 11 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip";
|
||||
|
||||
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
|
||||
public static boolean NeedDepthBuffer = false;
|
||||
@@ -27,9 +27,9 @@ class Globals {
|
||||
|
||||
public static boolean AppUsesMultitouch = false;
|
||||
|
||||
public static int AppTouchscreenKeyboardKeysAmount = 2;
|
||||
public static int AppTouchscreenKeyboardKeysAmount = 4;
|
||||
|
||||
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 2;
|
||||
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1;
|
||||
|
||||
// Phone-specific config
|
||||
// It will download app data to /sdcard/alienblaster if set to true,
|
||||
@@ -40,6 +40,7 @@ class Globals {
|
||||
public static boolean UseAccelerometerAsArrowKeys = false;
|
||||
public static boolean UseTouchscreenKeyboard = false;
|
||||
public static int TouchscreenKeyboardSize = 0;
|
||||
public static int TouchscreenKeyboardTheme = 0;
|
||||
public static int AccelerometerSensitivity = 0;
|
||||
public static int TrackballDampening = 0;
|
||||
public static int AudioBufferConfig = 0;
|
||||
@@ -47,5 +48,5 @@ class Globals {
|
||||
}
|
||||
|
||||
class LoadLibrary {
|
||||
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_image"); };
|
||||
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_net"); };
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -17,6 +17,7 @@ import android.content.res.Configuration;
|
||||
import android.os.Environment;
|
||||
import android.os.StatFs;
|
||||
import java.util.Locale;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Settings
|
||||
{
|
||||
@@ -41,6 +42,7 @@ class Settings
|
||||
out.writeInt(Globals.OptionalDataDownload.length);
|
||||
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
|
||||
out.writeBoolean(Globals.OptionalDataDownload[i]);
|
||||
out.writeInt(Globals.TouchscreenKeyboardTheme);
|
||||
out.close();
|
||||
} catch( FileNotFoundException e ) {
|
||||
} catch( SecurityException e ) {
|
||||
@@ -63,6 +65,7 @@ class Settings
|
||||
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
|
||||
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
|
||||
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
|
||||
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle("Phone configuration");
|
||||
@@ -174,6 +177,9 @@ class Settings
|
||||
static void showOptionalDownloadConfig(final MainActivity p) {
|
||||
|
||||
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
|
||||
System.out.println("downloadFiles.length " + String.valueOf(downloadFiles.length));
|
||||
for(int i = 0; i < downloadFiles.length; i++)
|
||||
System.out.println("downloadFiles[" + String.valueOf(i) + "] = '" + downloadFiles[i] + "'");
|
||||
if(downloadFiles.length <= 1)
|
||||
{
|
||||
Globals.OptionalDataDownload = new boolean[1];
|
||||
@@ -335,11 +341,11 @@ class Settings
|
||||
Globals.TouchscreenKeyboardSize = 0;
|
||||
if( ! Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
showAudioConfig(p);
|
||||
showScreenKeyboardThemeConfig(p);
|
||||
return;
|
||||
}
|
||||
|
||||
final CharSequence[] items = {"Big", "Medium", "Small"};
|
||||
final CharSequence[] items = {"Big", "Medium", "Small", "Tiny"};
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle("On-screen keyboard size (toggle auto-fire by sliding across Fire button)");
|
||||
@@ -349,6 +355,37 @@ class Settings
|
||||
{
|
||||
Globals.TouchscreenKeyboardSize = item;
|
||||
|
||||
dialog.dismiss();
|
||||
showScreenKeyboardThemeConfig(p);
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.setOwnerActivity(p);
|
||||
alert.show();
|
||||
}
|
||||
|
||||
static void showScreenKeyboardThemeConfig(final MainActivity p)
|
||||
{
|
||||
Globals.TouchscreenKeyboardTheme = 0;
|
||||
if( ! Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
showAudioConfig(p);
|
||||
return;
|
||||
}
|
||||
|
||||
final CharSequence[] items = {"Ultimate Droid by Sean Stieber", "Ugly Arrows by pelya"};
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle("On-screen keyboard theme");
|
||||
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
if( item == 0 )
|
||||
Globals.TouchscreenKeyboardTheme = 1;
|
||||
if( item == 1 )
|
||||
Globals.TouchscreenKeyboardTheme = 0;
|
||||
|
||||
dialog.dismiss();
|
||||
showAudioConfig(p);
|
||||
}
|
||||
@@ -378,8 +415,28 @@ class Settings
|
||||
alert.setOwnerActivity(p);
|
||||
alert.show();
|
||||
}
|
||||
|
||||
static byte [] loadRaw(Activity p,int res)
|
||||
{
|
||||
byte [] buf = new byte[128];
|
||||
byte [] a = new byte[0];
|
||||
try{
|
||||
InputStream is = p.getResources().openRawResource(res);
|
||||
int readed = 0;
|
||||
while( (readed = is.read(buf)) >= 0 )
|
||||
{
|
||||
byte [] b = new byte[a.length + readed];
|
||||
for(int i = 0; i < a.length; i++)
|
||||
b[i] = a[i];
|
||||
for(int i = 0; i < readed; i++)
|
||||
b[i+a.length] = buf[i];
|
||||
a = b;
|
||||
}
|
||||
} catch(Exception e) {};
|
||||
return a;
|
||||
}
|
||||
|
||||
static void Apply()
|
||||
static void Apply(Activity p)
|
||||
{
|
||||
nativeIsSdcardUsed( Globals.DownloadToSdcard ? 1 : 0 );
|
||||
|
||||
@@ -394,7 +451,37 @@ class Settings
|
||||
if( Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
nativeSetTouchscreenKeyboardUsed();
|
||||
nativeSetupScreenKeyboard(Globals.TouchscreenKeyboardSize, Globals.AppTouchscreenKeyboardKeysAmount, Globals.AppTouchscreenKeyboardKeysAmountAutoFire);
|
||||
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
|
||||
Globals.TouchscreenKeyboardTheme,
|
||||
Globals.AppTouchscreenKeyboardKeysAmount,
|
||||
Globals.AppTouchscreenKeyboardKeysAmountAutoFire);
|
||||
if( Globals.TouchscreenKeyboardTheme == 1 )
|
||||
{
|
||||
// DPAD
|
||||
nativeSetupScreenKeyboardButton(0, loadRaw(p, R.raw.ultimatedroiddpadbutton));
|
||||
nativeSetupScreenKeyboardButton(1, loadRaw(p, R.raw.ultimatedroidleftbuttonpressed));
|
||||
nativeSetupScreenKeyboardButton(2, loadRaw(p, R.raw.ultimatedroidrightbuttonpressed));
|
||||
nativeSetupScreenKeyboardButton(3, loadRaw(p, R.raw.ultimatedroidupbuttonpressed));
|
||||
nativeSetupScreenKeyboardButton(4, loadRaw(p, R.raw.ultimatedroiddownbuttonpressed));
|
||||
// Auto-fire
|
||||
nativeSetupScreenKeyboardButton(5, loadRaw(p, R.raw.ultimatedroidbutton1pressed));
|
||||
nativeSetupScreenKeyboardButton(6, loadRaw(p, R.raw.ultimatedroidbutton2pressed));
|
||||
// Other buttons
|
||||
nativeSetupScreenKeyboardButton(7, loadRaw(p, R.raw.ultimatedroidbutton1));
|
||||
nativeSetupScreenKeyboardButton(8, loadRaw(p, R.raw.ultimatedroidbutton1pressed));
|
||||
nativeSetupScreenKeyboardButton(9, loadRaw(p, R.raw.ultimatedroidbutton2));
|
||||
nativeSetupScreenKeyboardButton(10, loadRaw(p, R.raw.ultimatedroidbutton2pressed));
|
||||
nativeSetupScreenKeyboardButton(11, loadRaw(p, R.raw.ultimatedroidbutton3));
|
||||
nativeSetupScreenKeyboardButton(12, loadRaw(p, R.raw.ultimatedroidbutton3pressed));
|
||||
nativeSetupScreenKeyboardButton(13, loadRaw(p, R.raw.ultimatedroidbutton4));
|
||||
nativeSetupScreenKeyboardButton(14, loadRaw(p, R.raw.ultimatedroidbutton4pressed));
|
||||
nativeSetupScreenKeyboardButton(15, loadRaw(p, R.raw.ultimatedroidbutton5));
|
||||
nativeSetupScreenKeyboardButton(16, loadRaw(p, R.raw.ultimatedroidbutton5pressed));
|
||||
nativeSetupScreenKeyboardButton(17, loadRaw(p, R.raw.ultimatedroidbutton6));
|
||||
nativeSetupScreenKeyboardButton(18, loadRaw(p, R.raw.ultimatedroidbutton6pressed));
|
||||
nativeSetupScreenKeyboardButton(19, loadRaw(p, R.raw.ultimatedroidbutton7));
|
||||
nativeSetupScreenKeyboardButton(20, loadRaw(p, R.raw.ultimatedroidbutton7));
|
||||
}
|
||||
}
|
||||
nativeSetAccelerometerSensitivity(Globals.AccelerometerSensitivity);
|
||||
nativeSetTrackballDampening(Globals.TrackballDampening);
|
||||
@@ -430,7 +517,8 @@ class Settings
|
||||
private static native void nativeSetJoystickUsed();
|
||||
private static native void nativeSetMultitouchUsed();
|
||||
private static native void nativeSetTouchscreenKeyboardUsed();
|
||||
private static native void nativeSetupScreenKeyboard(int size, int nbuttons, int nbuttonsAutoFire);
|
||||
private static native void nativeSetupScreenKeyboard(int size, int theme, int nbuttons, int nbuttonsAutoFire);
|
||||
private static native void nativeSetupScreenKeyboardButton(int buttonId, byte[] img);
|
||||
public static native void nativeSetEnv(final String name, final String value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package com.sourceforge.sc2;
|
||||
package com.googlecode.opentyrian;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
@@ -109,7 +109,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
|
||||
|
||||
System.loadLibrary("application");
|
||||
System.loadLibrary("sdl_main");
|
||||
Settings.Apply();
|
||||
Settings.Apply(context);
|
||||
// Tweak video thread priority, if user selected big audio buffer
|
||||
if(Globals.AudioBufferConfig >= 2)
|
||||
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
|
||||
|
||||
Reference in New Issue
Block a user