Ejemplo n.º 1
0
int
main(int argc, char *argv[]) {
    XEvent event;
    uint32_t timestamp = 0;
    init_x();
    font_init();

    ejoy2d_win_init(argc, argv);

    for (;;) {
        
        while(XPending(g_X.display) > 0) {  
            XNextEvent(g_X.display, &event);
            if (XFilterEvent(&event,None))
                continue;
            switch (event.type) {
            case Expose:
                if (event.xexpose.count==0)
                    update_frame();
                break;
            case ButtonPress:
                ejoy2d_win_touch(event.xbutton.x, event.xbutton.y, TOUCH_BEGIN);
                break;
            case ButtonRelease:
                ejoy2d_win_touch(event.xbutton.x,event.xbutton.y,TOUCH_END);
                break;
            case MotionNotify:
                ejoy2d_win_touch(event.xbutton.x,event.xbutton.y,TOUCH_MOVE);
                break;
            }
        }

        uint32_t old = timestamp;
        timestamp= _gettime();
        if (timestamp - old >= UPDATE_INTERVAL) {
            ejoy2d_win_update();
            update_frame();
        }
        else
            usleep(1000);
    }
}
Ejemplo n.º 2
0
JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_touch(JNIEnv * env, jobject obj, jint id, jfloat x, jfloat y, jint touch)
{
    ejoy2d_win_touch(x, y, touch);
}