mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-10 23:29:43 +00:00
Get touch menu min/max alpha matching touch keyboard
This commit is contained in:
parent
39c654ae9d
commit
904d89aff8
@ -142,14 +142,10 @@ void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchKeyboardLowercas
|
|||||||
keydriver_setLowercaseEnabled(enabled);
|
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) {
|
void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchKeyboardVisibility(JNIEnv *env, jclass cls, jfloat inactiveAlpha, jfloat activeAlpha) {
|
||||||
LOG("inactive:%f active:%f", inactiveAlpha, activeAlpha);
|
LOG("inactive:%f active:%f", inactiveAlpha, activeAlpha);
|
||||||
keydriver_setVisibilityWhenOwnsScreen(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) {
|
void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchJoystickButtonTypes(JNIEnv *env, jclass cls, jint touchDownButton, jint northButton, jint southButton) {
|
||||||
|
@ -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;
|
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;
|
bool (*interface_isTouchMenuAvailable)(void) = NULL;
|
||||||
void (*interface_setTouchMenuEnabled)(bool enabled) = NULL;
|
void (*interface_setTouchMenuEnabled)(bool enabled) = NULL;
|
||||||
void (*interface_setTouchMenuVisibility)(float alpha) = NULL;
|
void (*interface_setTouchMenuVisibility)(float inactiveAlpha, float activeAlpha) = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 2015/04/12 : This was legacy code for rendering the menu interfaces on desktop Linux. Portions here are resurrected
|
// 2015/04/12 : This was legacy code for rendering the menu interfaces on desktop Linux. Portions here are resurrected
|
||||||
|
@ -85,8 +85,8 @@ extern bool (*interface_isTouchMenuAvailable)(void);
|
|||||||
// enable/disable touch menu HUD element
|
// enable/disable touch menu HUD element
|
||||||
extern void (*interface_setTouchMenuEnabled)(bool enabled);
|
extern void (*interface_setTouchMenuEnabled)(bool enabled);
|
||||||
|
|
||||||
// set minimum alpha visibility of touch menu HUD element
|
// set min/max alpha visibility of touch menu HUD element
|
||||||
extern void (*interface_setTouchMenuVisibility)(float alpha);
|
extern void (*interface_setTouchMenuVisibility)(float inactiveAlpha, float activeAlpha);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EXT_GZ ".gz"
|
#define EXT_GZ ".gz"
|
||||||
|
@ -36,6 +36,7 @@ HUD_CLASS(GLModelHUDMenu,
|
|||||||
static bool isAvailable = false; // Were there any OpenGL/memory errors on initialization?
|
static bool isAvailable = false; // Were there any OpenGL/memory errors on initialization?
|
||||||
static bool isEnabled = true; // Does player want this enabled?
|
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 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
|
// NOTE : intent is to match touch keyboard width
|
||||||
static uint8_t topMenuTemplate[MENU_TEMPLATE_ROWS][MENU_TEMPLATE_COLS+1] = {
|
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);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
deltat = timespec_diff(timingBegin, now, NULL);
|
deltat = timespec_diff(timingBegin, now, NULL);
|
||||||
if (deltat.tv_sec == 0) {
|
if (deltat.tv_sec == 0) {
|
||||||
alpha = 1.0;
|
alpha = maxAlpha;
|
||||||
if (deltat.tv_nsec >= NANOSECONDS_PER_SECOND/2) {
|
if (deltat.tv_nsec >= NANOSECONDS_PER_SECOND/2) {
|
||||||
alpha -= ((float)deltat.tv_nsec-(NANOSECONDS_PER_SECOND/2)) / (float)(NANOSECONDS_PER_SECOND/2);
|
alpha -= ((float)deltat.tv_nsec-(NANOSECONDS_PER_SECOND/2)) / (float)(NANOSECONDS_PER_SECOND/2);
|
||||||
if (alpha < minAlpha) {
|
if (alpha < minAlpha) {
|
||||||
@ -539,8 +540,9 @@ static void _animation_hideTouchMenu(void) {
|
|||||||
timingBegin = (struct timespec){ 0 };
|
timingBegin = (struct timespec){ 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gltouchmenu_setTouchMenuVisibility(float alpha) {
|
static void gltouchmenu_setTouchMenuVisibility(float inactiveAlpha, float activeAlpha) {
|
||||||
minAlpha = alpha;
|
minAlpha = inactiveAlpha;
|
||||||
|
maxAlpha = activeAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user