mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
add new jni call board_containsPt()
for use debugging layouts/orientation changes later
This commit is contained in:
parent
0a41471410
commit
3b24aab8c3
6 changed files with 33 additions and 3 deletions
|
@ -1119,6 +1119,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1getActiveRect
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef POINTER_SUPPORT
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenDown
|
||||
(JNIEnv *env, jclass C, GamePtrType gamePtr, jint xx, jint yy, jbooleanArray barray )
|
||||
|
@ -1153,6 +1154,18 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenUp
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_board_1containsPt
|
||||
( JNIEnv* env, jclass C, GamePtrType gamePtr, jint xx, jint yy )
|
||||
{
|
||||
jboolean result;
|
||||
XWJNI_START();
|
||||
result = board_containsPt( state->game.board, xx, yy );
|
||||
XWJNI_END();
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_board_1juggleTray
|
||||
(JNIEnv* env, jclass C, GamePtrType gamePtr )
|
||||
|
|
|
@ -102,12 +102,17 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
switch ( action ) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
m_lastSpacing = MULTI_INACTIVE;
|
||||
if ( !ConnStatusHandler.handleDown( xx, yy ) ) {
|
||||
if ( ConnStatusHandler.handleDown( xx, yy ) ) {
|
||||
// do nothing
|
||||
} else if ( XwJNI.board_containsPt( m_jniGamePtr, xx, yy ) ) {
|
||||
handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy );
|
||||
} else {
|
||||
DbgUtils.logdf( "onTouchEvent(): in white space" );
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if ( ConnStatusHandler.handleMove( xx, yy ) ) {
|
||||
// do nothing
|
||||
} else if ( MULTI_INACTIVE == m_lastSpacing ) {
|
||||
handle( JNIThread.JNICmd.CMD_PEN_MOVE, xx, yy );
|
||||
} else {
|
||||
|
|
|
@ -289,6 +289,8 @@ public class XwJNI {
|
|||
int xx, int yy );
|
||||
public static native boolean board_handlePenUp( GamePtr gamePtr,
|
||||
int xx, int yy );
|
||||
public static native boolean board_containsPt( GamePtr gamePtr,
|
||||
int xx, int yy );
|
||||
|
||||
public static native boolean board_juggleTray( GamePtr gamePtr );
|
||||
public static native int board_getTrayVisState( GamePtr gamePtr );
|
||||
|
|
|
@ -2378,7 +2378,8 @@ invalCell( BoardCtxt* board, XP_U16 col, XP_U16 row )
|
|||
|
||||
#if defined POINTER_SUPPORT || defined KEYBOARD_NAV
|
||||
XP_Bool
|
||||
pointOnSomething( BoardCtxt* board, XP_U16 xx, XP_U16 yy, BoardObjectType* wp )
|
||||
pointOnSomething( const BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
||||
BoardObjectType* wp )
|
||||
{
|
||||
XP_Bool result = XP_TRUE;
|
||||
|
||||
|
@ -2950,6 +2951,14 @@ board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y )
|
|||
{
|
||||
return handlePenUpInternal( board, x, y, XP_TRUE );
|
||||
}
|
||||
|
||||
XP_Bool
|
||||
board_containsPt( const BoardCtxt* board, XP_U16 xx, XP_U16 yy )
|
||||
{
|
||||
BoardObjectType wp;
|
||||
return pointOnSomething( board, xx, yy, &wp );
|
||||
}
|
||||
|
||||
#endif /* #ifdef POINTER_SUPPORT */
|
||||
|
||||
#ifdef KEYBOARD_NAV
|
||||
|
|
|
@ -183,6 +183,7 @@ XP_Bool board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y,
|
|||
XP_Bool* handled );
|
||||
XP_Bool board_handlePenMove( BoardCtxt* board, XP_U16 x, XP_U16 y );
|
||||
XP_Bool board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y );
|
||||
XP_Bool board_containsPt( const BoardCtxt* board, XP_U16 xx, XP_U16 yy );
|
||||
#endif
|
||||
|
||||
#ifdef KEY_SUPPORT
|
||||
|
|
|
@ -257,7 +257,7 @@ XP_S16 pointToTileIndex( BoardCtxt* board, XP_U16 x, XP_U16 y,
|
|||
void board_selectPlayer( BoardCtxt* board, XP_U16 newPlayer, XP_Bool canPeek );
|
||||
void flipIf( const BoardCtxt* board, XP_U16 col, XP_U16 row,
|
||||
XP_U16* fCol, XP_U16* fRow );
|
||||
XP_Bool pointOnSomething( BoardCtxt* board, XP_U16 x, XP_U16 y,
|
||||
XP_Bool pointOnSomething( const BoardCtxt* board, XP_U16 xx, XP_U16 yy,
|
||||
BoardObjectType* wp );
|
||||
XP_Bool coordToCell( const BoardCtxt* board, XP_S16 xx, XP_S16 yy,
|
||||
XP_U16* colP, XP_U16* rowP );
|
||||
|
|
Loading…
Reference in a new issue