• Show log

    Commit

  • Hash : 72ab2588
    Author : Sam Lantinga
    Date : 2017-08-13T21:48:40

    Fixed bug 2764 - Timer is not rescheduled with the returned interval
    
    afwlehmann
    
    Sorry for re-opening, but it turns out that the current interval is indeed not updated. I've just checked the source code of the 2.0.3 release again:
    
       163	    if (current->canceled) {
       164	        interval = 0;
       165	    } else {
       166	        interval = current->callback(current->interval, current->param);
       167	    }
       168
       169	    if (interval > 0) {
       170	        /* Reschedule this timer */
       171	        current->interval = interval; // <-- this line is missing
       172	        current->scheduled = tick + interval;
       173	        SDL_AddTimerInternal(data, current);
       174	    } else {
    
    According to the documentation: "The callback function is passed the current timer interval and the user supplied parameter from the SDL_AddTimer() call and returns the next timer interval. If the returned value from the callback is 0, the timer is canceled."
    
    If I understand the text correctly, then the current interval should in fact be updated according to the returned value. Otherwise there would be a discrepancy between the next time for which the timer is actually re-scheduled and the value that's passed to the callback once the timer fires again.
    
    This could be fixed by adding line #171.
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/SDL.git
    Git SSH git@git.kmx.io:kc3-lang/SDL.git
    Public access ? public
    Description

    Fork of https://github.com/libsdl-org/SDL

    Users
    thodg_w kc3_lang_org thodg_l thodg_m www_kmx_io thodg
    Tags

  • README.txt

  •                          Simple DirectMedia Layer
    
                                      (SDL)
    
                                    Version 2.0
    
    ---
    https://www.libsdl.org/
    
    Simple DirectMedia Layer is a cross-platform development library designed
    to provide low level access to audio, keyboard, mouse, joystick, and graphics
    hardware via OpenGL and Direct3D. It is used by video playback software,
    emulators, and popular games including Valve's award winning catalog
    and many Humble Bundle games.
    
    More extensive documentation is available in the docs directory, starting
    with README.md
    
    Enjoy!
    	Sam Lantinga				(slouken@libsdl.org)