Beispiel #1
0
void Aimer::onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *event)
{
    _pointer->stopAllActions();
    _pointer->runAction(ScaleTo::create(0.1, 1.0, _pointer->getScaleY()));
    _pointer->runAction(FadeTo::create(0.1, 200));
    log("aaaa %f", getWorldAngle());
}
Beispiel #2
0
int main( int argc, char* argv[] ) {
    bool fullscreen = false;
    char* world = "world";
    for (int i=0; i<argc; i++) {
        if (strcmp(argv[i], "-win") == 0) fullscreen = false;
        if (strcmp(argv[i], "-f") == 0) fullscreen = true;
        if (strcmp(argv[i], "-w") == 0)
            world = argv[i+1];
        if (strcmp(argv[i], "-d") == 0) debug = true;
    }
    SetupWorld(world);
    you_x = getWorldX();
    you_z = getWorldZ();
    you_angle = getWorldAngle();

    const SDL_VideoInfo* info = NULL;
    int width = 0;
    int height = 0;
    int bpp = 0;
    int flags = 0;
    
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
        fprintf( stderr, "Video initialization failed: %s\n",
             SDL_GetError( ) );
        quit_app( 1 );
    }

    info = SDL_GetVideoInfo( );
    if( !info ) {
        fprintf( stderr, "Video query failed: %s\n",
             SDL_GetError( ) );
        quit_app( 1 );
    }

    width = 640;
    height = 480;
    bpp = info->vfmt->BitsPerPixel;

    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    flags = SDL_OPENGL;
    if (fullscreen)
        flags |= SDL_FULLSCREEN;
    if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
        fprintf( stderr, "Video mode set failed: %s\n",
             SDL_GetError( ) );
        quit_app( 1 );
    }

    setup_opengl( width, height );
    bool init = true;
    while( 1 ) {
        process_events( );
        draw_screen( );
        if (init) { glEnable( GL_LIGHTING ); init=false; }
    }
    
    return 0;
}