The code will stop in 10 minutes,and you?

#include “SDL2/SDL.h”
#include
using namespace std;
Uint32 timer_proc(Uint32 i,void* d)
{
SDL_Event e;
SDL_UserEvent ue;
ue.type = SDL_USEREVENT;
ue.code = i;
ue.data1 = d;
e.type = SDL_USEREVENT;
e.user = ue;
SDL_PushEvent(&e);
return i;
}
int main(int argc, char * argv[])
{
SDL_Event e;
SDL_AddTimer(100,timer_proc,NULL);
while(1)
{
while(SDL_WaitEvent(&e))
{
switch(e.type)
{
case SDL_USEREVENT:
cout<<“event:”<<clock()<<endl;
break;
}
}
SDL_Delay(1);
}
return 0;
}

i use sdl2.0.2 at winxp and mingw32

Can you please state your problem more specifically?
El ago 10, 2014 12:42 AM, “goxl” escribi?:> i use sdl2.0.2 at winxp and mingw32


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

0 minutes after the timer is no longer running

Uint32 timer_proc(Uint32 i,void* d)
{
cout<<clock()<<endl;
return i;
}
the function is no running

Jorge Rodriguez wrote:> Can you please state your problem more specifically? El ago 10, 2014 12:42 AM, “goxl” <@goxl (@goxl)> escribi??:

   	i use sdl2.0.2 at winxp and mingw32

SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

You need to add SDL_Init(SDL_INIT_TIMER) to your code. Read this (https://wiki.libsdl.org/SDL_AddTimer#Remarks).

Nader Golbaz wrote:

You need to add SDL_Init(SDL_INIT_TIMER) to your code. Read this (https://wiki.libsdl.org/SDL_AddTimer#Remarks).

thansk

i’m trying