Permalink
Browse files

front: Speedup touchscreen editor refresh rate

  • Loading branch information...
Gillou68310
Gillou68310 committed Jul 6, 2015
1 parent 142570c commit a701a39ea7169052ac1365c8f61e3a16f4557881
@@ -438,6 +438,38 @@ public void load( String skinDir, Profile profile, boolean animated )
loadAllAssets( profile, animated );
}
/**
* Update the position of a button.
*
* @param profile The name of the layout profile.
* @param name The name of the button.
*/
public void updateButton( Profile profile, String name )
{
int x = profile.getInt( name + "-x", -1 );
int y = profile.getInt( name + "-y", -1 );
if( x >= 0 && y >= 0 )
{
if( name.equals( "analog" ) )
{
analogBackX = x;
analogBackY = y;
}
else
{
for( int i = 0; i < buttonNames.size(); i++ )
{
if ( buttonNames.get( i ).equals( name ) )
{
buttonX.set( i, x );
buttonY.set( i, y );
}
}
}
}
}
/**
* Loads the mask colors from a configuration file.
*
@@ -456,6 +456,18 @@ public void load( String skinDir, Profile profile, boolean animated, boolean fps
resize( cacheWidth, cacheHeight, cacheMetrics );
}
/**
* Refreshes the position of a touchscreen button image.
*
* @param profile The name of the touchscreen profile.
* @param name The name of the button.
*/
public void refreshButtonPosition( Profile profile, String name )
{
super.updateButton( profile, name );
resize( cacheWidth, cacheHeight, cacheMetrics );
}
/*
* (non-Javadoc)
*
@@ -481,7 +481,8 @@ else if( ( event.getAction() & MotionEvent.ACTION_MASK ) == MotionEvent.ACTION_M
dragY = newDragY;
mProfile.put( dragAsset + TAG_X, String.valueOf( newDragX ) );
mProfile.put( dragAsset + TAG_Y, String.valueOf( newDragY ) );
refresh();
mTouchscreenMap.refreshButtonPosition( mProfile, dragAsset );
mOverlay.postInvalidate();
}
}
}

0 comments on commit a701a39

Please sign in to comment.