コード例 #1
0
ファイル: menu.cpp プロジェクト: johndoe123/scummvm
void MenuItem::moveHighlight(int8 inc) {
    if (inc != 0) {
        int8 highlightNum = _highlightNum + inc;
        if ((highlightNum < 0) || (highlightNum >= _optionNum))
            return;
        _highlightNum = highlightNum;
    }
    CursorMan.showMouse(false);
    displayOption(_oldY, false);
    displayOption(_highlightNum, true);
    _oldY = _highlightNum;
    CursorMan.showMouse(true);
}
コード例 #2
0
ファイル: portaudio-test.cpp プロジェクト: DMPinc/portaudio
int main(int argc, char *argv[])
{
//    system("./soxclient '80/C#5 40/C6'");

    if (argc < 3) {
        displayOption();
        exit(0);
    }

    loadMidiHzTxt();

    int InDeviceId = atoi(argv[1]);
    int OutDeviceId = atoi(argv[2]);

    const int SamplingRate = 44100;
    const int BufLength = SamplingRate / 50;

    // FFT用に2のべき乗を計算する
    for (double i = 1.0; i < 1000; i = i + 1.0) {
        fft_num = pow(2.0, i);
        if (fft_num > BufLength * 2) {
            break;
        }
    }

    Pa_Initialize();

    PaStreamParameters in_param;
    in_param.channelCount = 2;
    in_param.device = InDeviceId;
    in_param.hostApiSpecificStreamInfo = NULL;
    in_param.sampleFormat = paInt16;    
    in_param.suggestedLatency = Pa_GetDeviceInfo(in_param.device)->defaultLowInputLatency;

    PaStreamParameters out_param;
    out_param.channelCount = 1;
    out_param.device = OutDeviceId;
    out_param.hostApiSpecificStreamInfo = NULL;
    out_param.sampleFormat = paInt16;
    out_param.suggestedLatency = Pa_GetDeviceInfo(out_param.device)->defaultLowInputLatency;

    PaStream *Stream;
    Pa_OpenStream(&Stream, &in_param, &out_param, SamplingRate, BufLength, NULL, CallBack, NULL);
    const PaStreamInfo *info = Pa_GetStreamInfo(Stream);

    fprintf(stderr, "----------Start----------\n");
    Pa_StartStream(Stream);

    getchar();
    Pa_CloseStream(Stream);
    Pa_Terminate();

    fftw_destroy_plan(p);
    fftw_free(fft_in); 
    fftw_free(fft_out);

    (void) pclose(file_p);

}
コード例 #3
0
ファイル: menu.cpp プロジェクト: johndoe123/scummvm
void MenuItem::display() {
    CursorMan.showMouse(false);

    _firstlix = true;
    _flx1 = _left - 2;
    _flx2 = _left + _width;
    _fly = 15 + _optionNum * 10;
    _activeNow = true;
    _menu->_menuActive = true;

    _menu->_vm->_graphics->drawMenuItem((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly);

    displayOption(0, true);
    for (int y = 1; y < _optionNum; y++)
        displayOption(y, false);

    _menu->_vm->_currentMouse = 177;

    CursorMan.showMouse(true); // 4 = fletch
}
コード例 #4
0
ファイル: main.c プロジェクト: X123M3-256/LatinQuiz
int main ( int argc, char** argv )
{
      if(Load_Wordlist()==-1)
    {
     printf( "Unable to load wordlist\n");
    return 1;
    }
    // initialize SDL video
    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "Unable to init SDL: %s\n", SDL_GetError() );
        return 1;
    }
    if (TTF_Init()==-1)
    {
        printf( "Unable to init SDL: %s\n", SDL_GetError() );
        return 1;
    }


    // make sure SDL cleans up before exit
    atexit(SDL_Quit);

    // create a new window
   screen = SDL_SetVideoMode(480, 640, 16,SDL_HWSURFACE|SDL_DOUBLEBUF);
    if ( !screen )
    {
        printf("Unable to set 640x480 video: %s\n", SDL_GetError());
        return 1;
    }

    // *******************************************Load Resources********************************************/
    //******************************************************************************************************/
    //****************************************That's right, resources***************************************/
    //******************************************************************************************************/
    option=IMG_Load("option.png");
    if (!option)
    {
        printf("Unable to load bitmap: %s\n", SDL_GetError());
        return 1;
    }
      option2=IMG_Load("option2.png");
    if (!option)
    {
        printf("Unable to load bitmap: %s\n", SDL_GetError());
        return 1;
    }
    background=IMG_Load("background.png");
    if (!background)
    {
        printf("Unable to load bitmap: %s\n", SDL_GetError());
        return 1;
    }
   gamefont=TTF_OpenFont("Courier_New.ttf",25);
   gamefontsmall=TTF_OpenFont("Courier_New.ttf",16);
    if (gamefont==NULL||gamefontsmall==NULL)
    {
        printf("Unable to load font: %s\n", SDL_GetError());
        return 1;
    }
    // *************************************Initialising some vars********************************************/
    //********************************************************************************************************/
    cur_rect.w=200;
    cur_rect.h=80;
    cur_rect.x=(480-200)/2;
    cur_text_rect.h=20;
    screen_rect.w=480;
    screen_rect.h=640;
    screen_rect.x=0;
    screen_rect.y=0;
    int i;
    for(i=0;i<6;i++){options[i].text=NULL;}
    textColor.r=0;
    textColor.g=0;
    textColor.b=0;
    milliseconds=SDL_GetTicks();
    srand(time(NULL));
    //**************************************************Main loop LOL*******************************************/
    //**********************************************************************************************************/
    //****************************************************Here we go...*****************************************/
    //**********************************************************************************************************/
    displayMainMenu();

    //***********************************************************************************************************
    //********************************************Event processing***********************************************
    //***********************************************************************************************************

    while (!done)
    {
        // message processing loop
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            // check for messages
            switch (event.type)
            {
                // exit if the window is closed
            case SDL_QUIT:
                done = true;
                break;

                // check for keypresses
            case SDL_KEYDOWN:
                {
                    // exit if ESCAPE is pressed
                    if (event.key.keysym.sym == SDLK_ESCAPE)
                        done = true;
                    break;
                }
            case SDL_MOUSEBUTTONDOWN:
            {
            handleClick(GetClickedOption(event.button.x,event.button.y));
            }
            } // end switch
        } // end of message processing
        //***************************************************************************************
        //*****************************Rendering*************************************************
        //***************************************************************************************
  // clear screengetline
        SDL_BlitSurface(background, 0, screen, &screen_rect);
        if(gamestate>=1&&gamestate<=3)
        {
        SDL_BlitSurface(questiontext,0,screen,&screen_rect);
        }
        int i;
        for(i=0;i<optnum;i++)
        {
        displayOption(options[i]);
        }

        //Run the physics
        runPhysics();
        // finally, update the screen :)
        SDL_Flip(screen);
    } // end main loop

    // free loaded bitmap
    SDL_FreeSurface(questiontext);
    SDL_FreeSurface(option2);
    SDL_FreeSurface(option);
    SDL_FreeSurface(background);
    TTF_CloseFont(gamefont);
    TTF_Quit();
    for(i=0;i<numwords;i++)
    {
    Free_Word(Words[i]);
    }
    free(Words);
    // all is well ;)
    printf("Exited cleanly\n");
    return 0;
    }