2012-08-11 21 views
2

我正在阅读OpenGL ES 2.0 Programming Guide,并在他们的示例中使用了他们创建的称为esUtil.h (which has a version for BlackBerry)的帮助程序库,它包含在book examples repository中,问题是现在我想要handle touch events ,但我不知道如何使我的代码与bbutil.h初始化兼容,因此我可以利用触摸并同时拥有esUtil.h,因此我可以利用esRegisterDrawFuncesRegisterUpdateFuncesMainLoop等功能,不知道如何处理bbutil。这里是我的代码:使用BlackBerry Native SDK处理触摸事件

#include <stdlib.h> 
#include <stdio.h> 
#include "esUtil/esUtil.h" 

// BlackBerry stuff. 
#include "bbutil.h" 
#include <bps/bps.h> 
#include <bps/screen.h> 

// Helpers. 
#include "helpers/global.h" 
#include "helpers/shaders.h" 

// Scene. 
#include "scene/scene.h" 

int main(int argc, char *argv[]) { 
    ESContext esContext; 
    UserData userData; 

    esInitContext(&esContext); 
    esContext.userData = &userData; 

    if (!esCreateWindow(&esContext, TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, ES_WINDOW_RGB)) 
     return 0; 

    if (!init(&esContext)) 
     return 0; 

    esRegisterDrawFunc(&esContext, drawScene); 
    esRegisterUpdateFunc(&esContext, update); 

    esMainLoop(&esContext); 

    return 0; 
} 

有什么建议吗?

回答

1

我没有任何具体的经验OpenGL的混合与BPS,但因为还没有其他任何回应...

我有混合BPS与下BB10瀑布。我所做的是在单独的线程上运行BPS事件获取和响应代码。线程将阻塞,直到BPS发生事件。这使主线程可用于Cascades(在我的情况下)或esMainLoop(在你的情况下)。