Prof. Monster's Cursor script

Hello Blenderheads :smiley:

Prof. Monster is back with a brandnew module.
http://blenderartists.org/forum/picture.php?albumid=9&pictureid=67

This time it was really complicated :yes:.
It took me a whole day to write the documentation and the picture for this Module. But now it is done.

Prof. Monster presents:[INDENT]Cursor.py
compatible with 2.49 and 2.5x
[/INDENT]What does it do?

This module provides functions to show and hide the system mouse cursor.
It simply provides two BGE callable functions

  • Cursor.show
  • Cursor.hide

Nothing fancy for Python coders, but quite nice for the once that do not script.

How does it work?
cut&paste following script into the

  • internal text editor or
  • a file called Cursor.py which should be located at the blend’s folder

''' 
Cursor
======

This module provides functions to show and hide the system mouse cursor.
'''
import Rasterizer #@UnresolvedImport
__version__ = "1.0"
__author__ = "Monster"
__date__ = "2010-Sep-04"

#---- BGE callables
#===============================================================================
# show
#===============================================================================
def show():
    '''
    Enables the drawing of the system mouse cursor.
    '''
    Rasterizer.showMouse(1)
    
#===============================================================================
# hide
#===============================================================================
def hide():
    '''
    Disables the drawing of the system mouse cursor.
    '''
    Rasterizer.showMouse(0)


now you can setup logic bricks like these:

Usually you will connect an Always sensor with the Cursor.show module, to make the cursor visible all the time.

Please keep in mind that the Python controller should be in Module mode.

I hope you find this useful
Monster

Thanks! That helped a lot! A little while ago I was trying to do the same thing, but I wasn’t in module mode, and I was trying to run the show/hide functions as two different scripts.

I tried it in 2.57a…got nothing…

Is that possible to make it an AddOn? And if I understood right, it show and hide the cursor?

Cheers!

~Here’s 2.5

''' 
Cursor
======

This module provides functions to show and hide the system mouse cursor.
'''
from bge import render #@UnresolvedImport
__version__ = "1.0"
__author__ = "Monster"
__date__ = "2010-Sep-04"

#---- BGE callables
#===============================================================================
# show
#===============================================================================
def show():
    '''
    Enables the drawing of the system mouse cursor.
    '''
    render.showMouse(1)
    
#===============================================================================
# hide
#===============================================================================
def hide():
    '''
    Disables the drawing of the system mouse cursor.
    '''
    render.showMouse(0)

The code is full compatible with 2.49 and 2.5x.

I just tested in 2.57 and it is fine

BTW: This is a module not a script. Please use the module mode.