Commits

rmtew committed 9405652

20 (Brogue 1.7.3):
- Updated to Brogue v1.7.3 code.
- Volume up & down keys show & hide the keyboard.
- Pinch zoom & drag zoomed view now work in move tapping mode.
- Added notes section to the "help" menu item.

Comments (0)

Files changed (6)

 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
 	<classpathentry kind="output" path="bin/classes"/>
 </classpath>

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="org.disinterest.broguex"
-      android:versionCode="19"
-      android:versionName="1.7.2.19">
+      android:versionCode="20"
+      android:versionName="1.7.2.20">
     <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <application android:label="@string/app_name" android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:debuggable="true">

jni/Application.mk

 APP_ABI := armeabi armeabi-v7a x86
+APP_PLATFORM := android-8
 3. Move tapping & inventory.
 4. Move tapping & cursor mode.
 5. Quitting.
+6. BrogueX notes.
 
 1. INTRODUCTION
 
 
 For those without a real keyboard, the "move tapping layer" allows play of the game through touch and gestures.
 
-Standard Android buttons and their use:
+Standard Android buttons, gestures and their uses:
 * Back key: Mapped to the escape key.  This will allow you to exit menus, requests to input file names and more.
 * Menu key: Displays the BrogueX Android menu options.
+* Pinch zoom: Zooms in and out on display.
+* Dragged finger: Alters currently displayed area of zoomed in display.
 
 2. MOVE TAPPING
 
 5. QUITTING BROGUEX
 
 The Android operating system does not allow an application to quit.  It should simply minimise, pause and when it's resources are needed, it will be killed automatically.  This means that when you Quit from the main menu, it does not kill the application, but minimises it instead.
+
+6. BROGUEX NOTES
+
+This is a list of notes on things that have come up in email based discussions with users.
+
+Why haven't I addressed a play store comment?  Play store comments are a nuisance.  Some low rated comments are from people who emailed me, had their problems addressed and never modified the comments.  Others are vague on what I should do, and should I manage to work it out and do it, there's little likelihood the comment would be modified.  I reply to all emails, and there I can clarify what a user needs fixed.
+
+Why did you tell me something worked differently in email?  I don't have a good memory.  This document is the definitive place for correct information.
+
+Why is this a paid application?  Because I have seen the irrelevant and angry comments on free applications in the play store, and I do not wish to waste my time on them.  If it were possible to make a free application with no comments, I would make this one immediately.  Remember you can compile this yourself for free.
+
+Why move tapping mode? It was a quick fix for a user complaint before the chance to make a transparent directional arrow overlay came up.
+
+Why no transparent directional arrow overlay? Because anyone who has asked for one has either been happy with the move tapping mode given further discussion, or with minor additional changes that I have made.  No-one has insisted the game needs one.  Yes, it should have one, and it will get one, but there's been no demand for it in my email correspondence.
+
+Why does double tapping not do anything? Because it prevents a number of quick single taps.  It just makes single taps, whether on zoomed in tiles, or on the move tapping layer, annoyingly unusable.
+
+Why doesn't the map area zoom in, while the status bar stay zoomed out? The original Brogue code treats the whole screen as one space for the purpose of building the data to render.  There is no clean way, last I looked, to always copy the status bar from the left hand side, and then to zoom in the map separately.  This will be revisited as the BrogueX code base evolves over time.

res/raw/releasenotes.txt

-BrogueX 19 (Brogue 1.7.2)
+BrogueX 20 (Brogue 1.7.3)
 * Bad reviews do not contain enough information about complaints and problems.  So email (as well) please!
 
 TIPS
 - If you have a smaller screen and the display appears corrupt, see the Play store page bug list for an explanation/workaround.
 
 RECENT CHANGES
-- New "move tapping options" submenu.  This allows the user to selectively enable different move tapping layer controls.
-- Added "move tapping" ability to flick in a compass direction as a way to do the corresponding key press.
-- Added "move tapping" ability to have extra enter key button in Android UI menus.
+- Updated to Brogue v1.7.3 code.
+- Volume up & down keys show & hide the keyboard.
+- Pinch zoom & drag zoomed view now work in move tapping mode.
+- Added notes section to the "help" menu item.
 
 CONTACT INFORMATION
 richard.m.tew@gmail.com

src/org/disinterest/broguex/SDLActivity.java

 import javax.microedition.khronos.egl.*;
 
 import android.app.*;
+import android.app.admin.DeviceAdminReceiver;
+import android.app.admin.DevicePolicyManager;
 import android.content.*;
 import android.view.*;
+import android.view.GestureDetector.OnDoubleTapListener;
 import android.view.GestureDetector.OnGestureListener;
+import android.view.ScaleGestureDetector.OnScaleGestureListener;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup.LayoutParams;
 import android.view.inputmethod.InputMethodManager;
     	prefsEd.commit();
 	}
 
-	/**
-     * Wraps KeyCharacterMap.get
-    static void setLastKeyboardDevice(int deviceID) {
-    	if (mKeyboardDeviceID != deviceID) {
-	    	InputDevice device = InputDevice.getDevice(deviceID);
-	    	if (device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
-	    		mKeyboardDeviceID = deviceID;
-	    		mKeyMap = device.getKeyCharacterMap();
-	    	}
-	    	Log.i("BrogueX",String.format("setLastKeyboardDevice id=%d name='%s' keyboardType=%d", deviceID, device.getName(), device.getKeyboardType()));
-    	}
-    }
-    
-     * Wraps KeyCharacterMap.get
-    static int translateKeycode(int keyCode, int meta) {
-    	return mKeyMap.get(keyCode, meta);
-    }
-     */
-
     // Messages from the SDLMain thread
     static final int COMMAND_CHANGE_TITLE = 1;
     static final int COMMAND_KEYBOARD_SHOW = 2;
     public static native void nativeRunAudioThread();
 
     public static native void nativeTCODSetScaleFactor(float scale_factor);
+    public static native float nativeTCODGetScaleFactor();
+    public static native float nativeTCODGetScaleFactorMax();
+    public static native float nativeTCODGetScaleFactorMin();
+    public static native void nativeTCODSetScaleCenter(float x, float y);
     public static native void nativeTCODSetFPS(int value);
     public static native void nativeSDLToggleScreenKeyboard();
+    public static native void nativeSDLHideScreenKeyboard();
+    public static native void nativeSDLShowScreenKeyboard();
     public static native void nativeFakeMouseClick(int cx, int cy);
     public static native void nativeGestureFling(int touchDevId, float x0, float y0, float x1, float y1);
     public static native void nativeGestureLongTouch(int touchDevId, float x, float y);
+    public static native void nativeGestureScroll(int touchDevId, float x, float y);
 
     // Java functions called from C
 
 	    	    mSingleton.runOnUiThread(new java.lang.Runnable() {
 					public void run() {
 						if (window != null) {
-							window.dismiss();
+							/* Ignore exception if window view no longer attached. */
+							try {
+								window.dismiss();
+							} catch (Exception exc) {};
 							window = null;
 						}
 					}        		
     Because of this, that's where we set up the SDL thread
 */
 class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, 
-    View.OnKeyListener, View.OnTouchListener, SensorEventListener, OnGestureListener {
+    View.OnKeyListener, View.OnTouchListener, SensorEventListener,
+    OnGestureListener, OnScaleGestureListener /*, OnDoubleTapListener */ {
 
-	private static GestureDetector mGestureDetector;
+	private GestureDetector mGestureDetector;
+	private ScaleGestureDetector mScaleGestureDetector;
 	
     // Sensors
     private static SensorManager mSensorManager;
         setFocusableInTouchMode(true);
         requestFocus();
         setOnKeyListener(this); 
-        setOnTouchListener(this);   
-        
-        mGestureDetector = new GestureDetector(context, this);
+        setOnTouchListener(this);
+
+        /* This class implements the interface for both listeners. */
+        /* - The gesture detector ignores multitouch events, which should allow it to
+         *   work with the scale gesture detector.
+         */
+        mGestureDetector = new GestureDetector(context, this, this.getHandler(), false);
+        mScaleGestureDetector = new ScaleGestureDetector(context, this);
 
         // Set an ID for this view so that Android does not whine.
         setId(91190210);
 
     // Key events
     public boolean onKey(View  v, int keyCode, KeyEvent event) {
-    	/*
-    	SDLActivity.setLastKeyboardDevice(event.getDeviceId());
-    	*/
-
         if (event.getAction() == KeyEvent.ACTION_DOWN) {
             //Log.v("SDL", "key down: " + keyCode);
-        	if (keyCode == KeyEvent.KEYCODE_MENU) {
+        	if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
+    			SDLActivity.nativeSDLShowScreenKeyboard();
+	        } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
+    			SDLActivity.nativeSDLHideScreenKeyboard();
+	        } else if (keyCode == KeyEvent.KEYCODE_MENU) {
         		SDLActivity.openMenu();
-        		return true;
-        	} else if (keyCode == KeyEvent.KEYCODE_BACK) {
-        		/* Even if this is not in this Android version, SDL recognises it. */
-        		keyCode = CustomKeys.ESCAPE;
+        	} else {
+        		if (keyCode == KeyEvent.KEYCODE_BACK) {
+	        		/* Even if this is not in this Android version, SDL recognises it. */
+	        		keyCode = CustomKeys.ESCAPE;
+        		}
+                SDLActivity.onNativeKeyDown(keyCode);
         	}
-            SDLActivity.onNativeKeyDown(keyCode);
             return true;
         }
         else if (event.getAction() == KeyEvent.ACTION_UP) {
     // Touch events
     public boolean onTouch(View v, MotionEvent event) {
         if (SDLActivity.moveTappingLayerActive()) {
+        	/* http://stackoverflow.com/questions/6599329/can-one-ongesturelistener-object-deal-with-two-gesturedetector-objects */
         	/* SDL touch events reroute through onSingleTapUp() */
-        	SDLSurface.mGestureDetector.onTouchEvent(event);
+        	mScaleGestureDetector.onTouchEvent(event);
+        	mGestureDetector.onTouchEvent(event);
         	return true;
         }
         return SDL_onTouch(event);
 
              /* BrogueX control modification. */
              if (SDLActivity.moveTappingLayerActive()) {
+            	 /* If double tap events are listened to, then the single tap is a down action. 
+            	 if (action == MotionEvent.ACTION_DOWN) */
             	 if (action == MotionEvent.ACTION_UP)
             		 onMoveTapJiggeryPokery(x, y);
             	 return true;
         }
     }
 
-	/* Move tap forwarded event for OnGestureListener. */
-	public boolean onDown(MotionEvent e) {
-		return false;
+	/** OnGestureListener interface. */
+
+    public boolean onDown(MotionEvent e) {
+    	Log.i("broguex", "onDown");
+		return true;
 	}
 
-	/* Move tap forwarded event for OnGestureListener. */
 	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
 		if (SDLActivity.brogueGetMoveTapFlickAsMove()) {
 	        int keyCode = 0;
 		}
 		return false;
 	}
-
-	/* Move tap forwarded event for OnGestureListener. */
+	
 	public void onLongPress(MotionEvent e) {
 		if (SDLActivity.brogueGetMoveTapLongPressAsLMB()) {
-			float x, y;
-			x = e.getX() / mWidth;
-			y = e.getY() / mHeight;		
-			SDLActivity.nativeGestureLongTouch(e.getDeviceId(), x, y);
+			Log.i("broguex", String.format("onLongPress %f %f", mWidth, mHeight));
+			SDLActivity.nativeGestureLongTouch(e.getDeviceId(), e.getX(), e.getY());
 		}
 	}
 
-	/* Move tap forwarded event for OnGestureListener. */
 	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+		SDLActivity.nativeGestureScroll(e1.getDeviceId(), distanceX, distanceY);
+		return true;
+	}
+
+	public void onShowPress(MotionEvent e) {
+	}
+
+	public boolean onSingleTapUp(MotionEvent e) {
+		/* This is sent before a double tap can be detected. */
+    	Log.i("broguex", "onSingleTapUp");
+		return SDL_onTouch(e);
+        //return false;
+	}
+	
+	/** OnScaleGestureListener interface. */
+	
+	public boolean onScale(ScaleGestureDetector detector) {
+		/* Whether to consider this event as handled, or to accrue movement for next handled event. */
+		float scaleFactorFactor = detector.getCurrentSpan()/detector.getPreviousSpan();
+		float scaleFactor = SDLActivity.nativeTCODGetScaleFactor();
+		if (Math.abs(scaleFactorFactor) > 0.01f) {
+			Log.i("broguex", String.format("onScale factor=%f current=%f", scaleFactorFactor, scaleFactor));
+			SDLActivity.nativeTCODSetScaleFactor(scaleFactor * scaleFactorFactor);
+			return true;
+		}
+		/* Accumulate, because otherwise too insignificant to bother. */
 		return false;
 	}
 
-	/* Move tap forwarded event for OnGestureListener. */
-	public void onShowPress(MotionEvent e) {
+	public boolean onScaleBegin(ScaleGestureDetector detector) {
+		/* Whether to continue recognising this gesture. */
+		Log.i("broguex", "onScaleBegin");
+		return true;
+	}
+	
+	public void onScaleEnd(ScaleGestureDetector detector) {
+		
 	}
 
-	/* Move tap forwarded event for OnGestureListener. */
-	public boolean onSingleTapUp(MotionEvent e) {
-        return SDL_onTouch(e);
+	/** OnDoubleTapListener interface.
+
+	public boolean onDoubleTap(MotionEvent e) {
+		float x = e.getX(), y = e.getY(), scale_factor;
+		Log.i("broguex", String.format("onDoubleTap %f %f", x, y));
+		SDLActivity.nativeTCODSetScaleCenter(x, y);
+		scale_factor = SDLActivity.nativeTCODGetScaleFactor();
+		if (Math.abs(scale_factor - 1.0f) < 0.05f) {
+			// Not zoomed in, go to a zoomed in level.
+			SDLActivity.nativeTCODSetScaleFactor(SDLActivity.nativeTCODGetScaleFactorMax());
+		} else {
+			// Zoomed in (or out), go to a unzoomed level.
+			SDLActivity.nativeTCODSetScaleFactor(1.0f);
+		}
+		return true;
 	}
 
+	public boolean onDoubleTapEvent(MotionEvent e) {
+		return false;
+	}
+
+	public boolean onSingleTapConfirmed(MotionEvent e) {
+		Log.i("broguex", "onSingleTapConfirmed");
+		return SDL_onTouch(e);
+	}
+	*/
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.