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

Re: [pygame] Loading XBM cursors?



> >> I tried to load into our game a few custom cursors. They are all in XBM
> >> files, so I tried to use:
> >> 
> >> pygame.cursors.load_xbm(file,mask)
> >> 
> >> but the function fails with:


hmm, the problem here is that load_xbm is expecting there to be
#define fields for the cursor hotspot position. you can just add
these in by hand yourself. the loader only grabs this information
from the data file, so you don't need to change the mask. the loader
is pretty simple and expects the first 4 lines to be something like
this...

#define cursors-map-point-001_width 32
#define cursors-map-point-001_height 32
#define hotspot_x 10
#define hotspot_y 10
<... continue with cursor data ...>

this will make it work. obviously the XBM loader is dumb, but
it does load all the files i tested it with. the better solution
here would be to actually validate each line, befure blindly 
assuming it will be the correct format.

jan, you can easily fix your XBM files to be up and running. but
if you have a chance to fix the XBM loader that would be even better!


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org