[SDL] (no subject)

Walter Linzenbold sdl at jokawalli.de
Mon Aug 6 11:25:42 PDT 2007


Hi!
First thanks for the promt answer.
The first optimization you offered is allready done ;-).
Now, with "jitter" I mean you can not read the text fluently, it shifts
not properly... the german would say  "ruckeln" :-)
I dont know, how to explain it otherwise.
Best regards.


James Buchwald schrieb:
> Okay, well, I'm bored this afternoon, so why don't I try to fire up 
> the demo and modify it? (goes to website) Well, um, I'm getting a "no 
> route to host" DNS error right now, so I can't actually test this 
> code... however, I'll point out a few things I noticed (not sure if 
> they'll matter, though):
>
> First, inside your for loop, you set letter[1] to '\0' each time. 
> However, the TTF_RenderText_Solid method doesn't modify it at all... 
> you could get a very minor optimization (larger on longer strings) by 
> setting letter[1] to '\0' before you enter the loop, instead of once 
> each frame. Not much of an optimization, but still...
>
> Now, what exactly do you mean by "jitters"? Do you mean that it skips 
> frames? Or does it not shift properly, or not line up, or something?
>
> On 8/6/07, * sdl at jokawalli.de <mailto:sdl at jokawalli.de>* 
> <sdl at jokawalli.de <mailto:sdl at jokawalli.de>> wrote:
>
>     Hi!
>
>     Can anybody help?
>     I took the demo "Sinus Font" and tried to modify it, such like the
>     string scrolls from rigth into the window and scrolls at the left of
>     the window out.
>
>     Some pieces of the source code:
>
>     for (i=0; i < stringlength; i++) {
>                     letter[0] = string[i];
>                     letter[1] = '\0';
>                     letter_surf[i] = TTF_RenderText_Solid(font,
>     letter, white);
>                     letter_rect[i].w = letter_surf[i]->w;
>                     letter_rect[i].h = letter_surf[i]->h;
>             }
>     .......
>     while(!keypressevent()){
>
>
>     for (i=0; i < 40+b; i++)
>                     SDL_FillRect(screen, &letter_rect[i], black);
>
>
>                     for (i=0; i < stringlength; i++) {
>
>                 if (i==0){
>                                     xpos = first_x;
>                                          }
>
>                             letter_rect[i].x = xpos;
>                             xpos +=width_of_letter;
>                             letter_rect[i].y = ypos;
>
>     SDL_BlitSurface(letter_surf[i], NULL, screen,&letter_rect[i]);
>
>                     }
>             SDL_Flip(screen);
>             first_x -= speed_of_text;
>
>             SDL_Flip(screen);
>
>
>     My problem:
>
>     The whole text jitters, if the speed is greater than e.g. 10
>
>     Is there a better way to do the same?
>
>     A second problem:
>     If the width of the letters>50, than the text may not be longer than
>     1300 words otherwise there is I think a bufferoverflow.. (or something
>     similar);
>
>     Hoping for some helpful hints.
>
>     Thanks Walter
>
>
>     _______________________________________________
>     SDL mailing list
>     SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
>     http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>     <http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>
>
>
>
>
> -- 
> "If you see somebody who you don't know getting into a crop duster 
> that doesn't belong to you, report them." -- President George W. Bush
> ------------------------------------------------------------------------
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>   




More information about the SDL mailing list