[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast mouse pointer



Francesco Orsenigo, Xarvh Project wrote:
What coul be a portable way to create a _fast_ full-colored mouse pointer?
I'm actually using a software cursor, but since SDL refresh under X is very slow, the cursor is slow too...

SDL provides a (ugly, i think) system to provide a hardware (or at least more hard-coded) pointer, but just black and white.

I thought about working under console framebuffer and gpm, as the framebuffer is very fast and should be capable of redrawing the pointer several times per seconds, but it seems i can't change gpm threshold, so that i have a 80x25 mouse space versus a 800x600 graphic space... even worste, gpm seems much like a dead project: no official site or support (or i just can't find it...)

Any idea?
Thanx, Francesco Orsenigo



Have you considered optimizing pointer redrawing? Usually you're much better off if you only redraw those screen regions that need to be updated. SDL on X11 is particularly sensitive to this. If you need to update a lot of different regions on the screen try to use a list of dirty rectangles, i.e. a list of screen regions you've changed in the last cycle and update just that. There's SDL_UpdateRects() which comes handy if you painted your updates directly into your screen surface because it takes an array of SDL_Rect's for all those regions that need to be updated.

I bet that you can double your framerate with this method right away. I've seen a vertical scroller that ran in 1024x768 with over 100fps on a 486 when it used this technique (and there were a lot of objects and a star field background on the screen).

Gregor