블로그 이미지
안녕1999

카테고리

전체 (3067)
자바스크립트 (20)
안드로이드 (14)
WebGL (4)
변비 (17)
정치,경제 (35)
C언어,ARM (162)
컴퓨터(PC, Note Book, 윈.. (41)
전자회로, PCB (27)
유머,안웃긴,GIF,동영상 (118)
국부론60 (71)
모듈(PCB) (3)
건강 (2)
FreeCAD (25)
PADS (43)
퇴직,퇴사,구직,취업 활동 (3)
C# (86)
엑셀 (8)
워드 (0)
LabView (6)
레고 (30)
FPGA (0)
Total
Today
Yesterday

달력

« » 2024.12
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

공지사항

최근에 올라온 글

Looper

키보드, 모션(터치) 등을 처리하는 기능.

..\Android\android-ndk-r13b\platforms\android-12\arch-x86\usr\include\android\looper.h

/**

 * For callback-based event loops, this is the prototype of the function

 * that is called when a file descriptor event occurs.

 * It is given the file descriptor it is associated with,

 * a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT),

 * and the data pointer that was originally supplied.

 *

 * Implementations should return 1 to continue receiving callbacks, or 0

 * to have this file descriptor and callback unregistered from the looper.

 */

typedef int (*ALooper_callbackFunc)(int fd, int events, void* data);


/**

 * Waits for events to be available, with optional timeout in milliseconds.

 * Invokes callbacks for all file descriptors on which an event occurred.

 *

 * If the timeout is zero, returns immediately without blocking.

 * If the timeout is negative, waits indefinitely until an event appears.

 *

 * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before

 * the timeout expired and no callbacks were invoked and no other file

 * descriptors were ready.

 *

 * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked.

 *

 * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given

 * timeout expired.

 *

 * Returns ALOOPER_POLL_ERROR if an error occurred.

 *

 * Returns a value >= 0 containing an identifier if its file descriptor has data

 * and it has no callback function (requiring the caller here to handle it).

 * In this (and only this) case outFd, outEvents and outData will contain the poll

 * events and data associated with the fd, otherwise they will be set to NULL.

 *

 * This method does not return until it has finished invoking the appropriate callbacks

 * for all file descriptors that were signalled.

 */

int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);


/**

 * Like ALooper_pollOnce(), but performs all pending callbacks until all

 * data has been consumed or a file descriptor is available with no callback.

 * This function will never return ALOOPER_POLL_CALLBACK.

 */

int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);






   // loop waiting for stuff to do.

//on_program_start();

while (1) {

// Read all pending events.

int ident;

int events;

struct android_poll_source* source;


// If not animating, we will block forever waiting for events.

// If animating, we loop until all events are read, then continue

// to draw the next frame of animation.

while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,

(void**)&source)) >= 0) {


// Process this event.

if (source != NULL) {

source->process(state, source);

}


// Check if we are exiting.

if (state->destroyRequested != 0) {

DEBUG_socket_printf("Engine thread destroy requested!\r\n");

//engine_term_display(&engine);

goto end;//return;

}

}


if (engine.animating)

{

engine_draw_frame(&engine);

}

}

Posted by 안녕1999
, |

최근에 달린 댓글

글 보관함