Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Para controlar eventos de entrada táctil, lee el array motionEvents en el bucle de juego. Estos contienen los eventos que ocurrieron desde la última vez que se borraron estos arrays.
La cantidad de eventos contenidos se almacena en motionEventsCount.
Itera y controla cada evento en tu bucle de juego. En este ejemplo, el siguiente código itera motionEvents y los administra mediante handle_event:
for(size_ti=0;i < mApp->motionEventsCount;++i){GameActivityMotionEvent*motionEvent=mApp->motionEvents[i];intaction=motionEvent->action;intactionMasked=action & AMOTION_EVENT_ACTION_MASK;intptrIndex=(action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)>>
AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;structCookedEventev;memset(&ev,0,sizeof(ev));if(actionMasked==AMOTION_EVENT_ACTION_DOWN||actionMasked==AMOTION_EVENT_ACTION_POINTER_DOWN){ev.type=COOKED_EVENT_TYPE_POINTER_DOWN;}elseif(actionMasked==AMOTION_EVENT_ACTION_UP||actionMasked==AMOTION_EVENT_ACTION_POINTER_UP){ev.type=COOKED_EVENT_TYPE_POINTER_UP;}else{ev.type=COOKED_EVENT_TYPE_POINTER_MOVE;}ev.motionPointerId=motionEvent->pointers[ptrIndex].id;ev.motionIsOnScreen=motionEvent->source==AINPUT_SOURCE_TOUCHSCREEN;ev.motionX=GameActivityPointerInfo_getX(&motionEvent->pointers[ptrIndex]);ev.motionY=GameActivityPointerInfo_getY(&motionEvent->pointers[ptrIndex]);if(ev.motionIsOnScreen){// Use screen size as the motion range.ev.motionMinX=0.0f;ev.motionMaxX=SceneManager::GetInstance()->GetScreenWidth();ev.motionMinY=0.0f;ev.motionMaxY=SceneManager::GetInstance()->GetScreenHeight();}handle_event(&ev);}
Cuando termines, recuerda borrar la cola de eventos que acabas de controlar:
android_app_clear_motion_events(mApp);
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2024-08-22 (UTC)
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Falta la información que necesito"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Muy complicado o demasiados pasos"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Desactualizado"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Problema de traducción"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Problema con las muestras o los códigos"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Otro"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Fácil de comprender"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Resolvió mi problema"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Otro"
}]
{"lastModified": "\u00daltima actualizaci\u00f3n:\u00a02024-08-22 (UTC)"}
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-08-22 (UTC)"]]