Re: trying to do a blinking text cursor

Chris Bush <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <CALm1nqVELUZYcriPWweDWG=r7T-tcSpQTSJmAC8nU0wVoJdJhQ@mail.gmail.com>
On 6 August 2016 at 11:55, Jack Andrews <[email protected]> wrote:

>
> for the default, I'd like a browser-like blinking "I" cursor between pos-1
> and pos.
>

My initial thought: would it be enough to skip rendering the cursor
entirely on the blink-off phases?

If you just want to invert the render draw color for a rect, would
something like this work?

Uint8 r, g, b, a;
SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a);
SDL_SetRenderDrawColor(renderer, 255 - r, 255 - g, 255 - b, a);

Since the rect only defines the draw area, you'd want to update the render
draw color.

If your cursor is a fancy image or something, you may want to store an
inverted version and alternate between on and off.

Getting into fancier territory (altering pixels under the rect, etc.),
follow Jonathan's lead.

Hope this helps.

CB

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.