Get touch menu min/max alpha matching touch keyboard

This commit is contained in:
Aaron Culliney 2016-01-01 21:38:35 -08:00
parent 39c654ae9d
commit 904d89aff8
4 changed files with 9 additions and 11 deletions

View File

@ -142,14 +142,10 @@ void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchKeyboardLowercas
keydriver_setLowercaseEnabled(enabled);
}
void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchMenuVisibility(JNIEnv *env, jclass cls, jfloat alpha) {
LOG("visibility : %f", alpha);
interface_setTouchMenuVisibility(alpha);
}
void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchKeyboardVisibility(JNIEnv *env, jclass cls, jfloat inactiveAlpha, jfloat activeAlpha) {
LOG("inactive:%f active:%f", inactiveAlpha, activeAlpha);
keydriver_setVisibilityWhenOwnsScreen(inactiveAlpha, activeAlpha);
interface_setTouchMenuVisibility(inactiveAlpha, activeAlpha);
}
void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchJoystickButtonTypes(JNIEnv *env, jclass cls, jint touchDownButton, jint northButton, jint southButton) {

View File

@ -20,7 +20,7 @@
int64_t (*interface_onTouchEvent)(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) = NULL;
bool (*interface_isTouchMenuAvailable)(void) = NULL;
void (*interface_setTouchMenuEnabled)(bool enabled) = NULL;
void (*interface_setTouchMenuVisibility)(float alpha) = NULL;
void (*interface_setTouchMenuVisibility)(float inactiveAlpha, float activeAlpha) = NULL;
#endif
// 2015/04/12 : This was legacy code for rendering the menu interfaces on desktop Linux. Portions here are resurrected

View File

@ -85,8 +85,8 @@ extern bool (*interface_isTouchMenuAvailable)(void);
// enable/disable touch menu HUD element
extern void (*interface_setTouchMenuEnabled)(bool enabled);
// set minimum alpha visibility of touch menu HUD element
extern void (*interface_setTouchMenuVisibility)(float alpha);
// set min/max alpha visibility of touch menu HUD element
extern void (*interface_setTouchMenuVisibility)(float inactiveAlpha, float activeAlpha);
#endif
#define EXT_GZ ".gz"

View File

@ -36,6 +36,7 @@ HUD_CLASS(GLModelHUDMenu,
static bool isAvailable = false; // Were there any OpenGL/memory errors on initialization?
static bool isEnabled = true; // Does player want this enabled?
static float minAlpha = 1/4.f; // Minimum alpha value of components (at zero, will not render)
static float maxAlpha = 1.f;
// NOTE : intent is to match touch keyboard width
static uint8_t topMenuTemplate[MENU_TEMPLATE_ROWS][MENU_TEMPLATE_COLS+1] = {
@ -149,7 +150,7 @@ static float _get_menu_visibility(void) {
clock_gettime(CLOCK_MONOTONIC, &now);
deltat = timespec_diff(timingBegin, now, NULL);
if (deltat.tv_sec == 0) {
alpha = 1.0;
alpha = maxAlpha;
if (deltat.tv_nsec >= NANOSECONDS_PER_SECOND/2) {
alpha -= ((float)deltat.tv_nsec-(NANOSECONDS_PER_SECOND/2)) / (float)(NANOSECONDS_PER_SECOND/2);
if (alpha < minAlpha) {
@ -539,8 +540,9 @@ static void _animation_hideTouchMenu(void) {
timingBegin = (struct timespec){ 0 };
}
static void gltouchmenu_setTouchMenuVisibility(float alpha) {
minAlpha = alpha;
static void gltouchmenu_setTouchMenuVisibility(float inactiveAlpha, float activeAlpha) {
minAlpha = inactiveAlpha;
maxAlpha = activeAlpha;
}
// ----------------------------------------------------------------------------