Custom mouse cursor size

Hi, I needed to make a large customized mouse cursor. What is the maximum
dimension of a mouse cursor? I know that the width and height have to be a
multiple of 8, so can I make, for example, 160 x 160 pixel cursor? Thanks
in advance.

Fare thee well,
Bawenang R. P. P.----------------

“I live for my dream. And my dream is to live my life to the fullest.”

I don’t think there is any reliable and portable way of doing that,
using the “real” mouse cursor features. The mouse cursor is often an
actual hardware sprite, which means size, depth, blending features
etc are totally hardware dependent. Even when it’s not a hardware
sprite, you may run into platform API and/or driver limitations.

The “standard” solution is to disable the normal mouse cursor, and
implement your own cursor rendering. That is, make it
another “sprite”, implemented using SDL_BlitSurface(), an OpenGL
quad, a 3D model, or whatever fits your application.

Downsides of this approach:

* Cursor motion smoothness is limited by your
  application's rendering frame rate. (Not a
  problem if you can do partial smart updates,
  but that's not always an option.)

* Your custom mouse cursor is clipped within
  your application window in windowed mode.

//David Olofson - Programmer, Composer, Open Source Advocate

.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
’-- http://www.reologica.se - Rheology instrumentation --'On Tuesday 05 December 2006 10:47, benang at cs.its.ac.id wrote:

Hi, I needed to make a large customized mouse cursor. What is the
maximum dimension of a mouse cursor? I know that the width and
height have to be a multiple of 8, so can I make, for example, 160 x
160 pixel cursor? Thanks in advance.

Thanks. So, I must use my own mouse cursor surface and keep track of the
mouse movement than using the SDL’s own cursor?

David Olofson said:> On Tuesday 05 December 2006 10:47, @benang_at_cs.its.ac wrote:

Hi, I needed to make a large customized mouse cursor. What is the
maximum dimension of a mouse cursor? I know that the width and
height have to be a multiple of 8, so can I make, for example, 160 x
160 pixel cursor? Thanks in advance.

I don’t think there is any reliable and portable way of doing that,
using the “real” mouse cursor features. The mouse cursor is often an
actual hardware sprite, which means size, depth, blending features
etc are totally hardware dependent. Even when it’s not a hardware
sprite, you may run into platform API and/or driver limitations.

The “standard” solution is to disable the normal mouse cursor, and
implement your own cursor rendering. That is, make it
another “sprite”, implemented using SDL_BlitSurface(), an OpenGL
quad, a 3D model, or whatever fits your application.

Downsides of this approach:

  • Cursor motion smoothness is limited by your
    application’s rendering frame rate. (Not a
    problem if you can do partial smart updates,
    but that’s not always an option.)

  • Your custom mouse cursor is clipped within
    your application window in windowed mode.

Fare thee well,
Bawenang R. P. P.


“I live for my dream. And my dream is to live my life to the fullest.”

Thanks. So, I must use my own mouse cursor surface and keep track
of the
mouse movement than using the SDL’s own cursor?

In our OpenGL application, the cursor is a simple bitmap drawn with
glBitmap, it works very well.

The advantage of this technique is the ability to draw anything,
apply animation to it when you click or when something is loading,
or even a full 3d cursor, all of this 100% hardware independant.

If you are not using OpenGL, use whatever you use to draw on the SDL
surface to draw a cursor.

All this is according you can have 60fps all the time (to have smooth
cursor).

There are some techniques to give the cursor more fps. A very simple
one is to draw the cursor with SDL_UpdateRect.

RegardsOn 6 Dec 2006, at 04:02, benang at cs.its.ac.id wrote:


Kuon
CEO - Goyman.com SA
http://www.goyman.com/

“Computers should not stop working when the users’ brain does.”

-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2434 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061206/c86c25ca/attachment.bin

I thought SDL provided functions to deal with cursors defined as bit arrays (like SDL_CreateCursor())… Is this not platform-independent? If it isn’t, then why would SDL have it?_________________________________________________________________
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG

Hello Jonathan,

Wednesday, December 6, 2006, 8:34:25 PM, you wrote:

I thought SDL provided functions to deal with cursors defined as
bit arrays (like SDL_CreateCursor())… Is this not
platform-independent? If it isn’t, then why would SDL have it?

It is, but most systems only have 16x16 mouse pointers as they use a
hardware cursor that only has this size. Even if it is drawn in
software, it is still usually limited to 16x16.

So… it is “portable” but only to the extent of most window managers
pointer capabilities.–
Best regards,
Peter mailto:@Peter_Mulholland

You keep track of it using SDL’s mouse events.

ChrisOn 12/5/06, benang at cs.its.ac.id wrote:

Thanks. So, I must use my own mouse cursor surface and keep track of the
mouse movement than using the SDL’s own cursor?


E-Mail: Chris Nystrom <@Chris_Nystrom>
http://www.newio.org/
AIM: nystromchris

I thought SDL provided functions to deal with cursors defined as
bit arrays (like SDL_CreateCursor())… Is this not platform-
independent? If it isn’t, then why would SDL have it?

It does only support black and white cursor.

RegardsOn 6 Dec 2006, at 21:34, Jonathan Dearborn wrote:


Kuon
CEO - Goyman.com SA
http://www.goyman.com/

“Computers should not stop working when the users’ brain does.”

-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2434 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061207/8d27aece/attachment.bin