cpython/Demo/sgi/video/watchcursor.py

46 lines
781 B
Python
Executable File

# Define a 16x16 cursor looking like a watch
# X11 bitmap file:
##define x_width 16
##define x_height 16
#static char x_bits[] = {
# 0xf0, 0x0f, 0xf8, 0x1f, 0x1c, 0x38, 0x8e, 0x71, 0x87, 0xe1, 0x83, 0xc1,
# 0x83, 0xc1, 0xf3, 0xc1, 0xf3, 0xc1, 0x03, 0xc0, 0x03, 0xc0, 0x07, 0xe0,
# 0x0e, 0x70, 0x1c, 0x38, 0xf8, 0x1f, 0xf0, 0x0f};
watch = [ \
0x0ff0,\
0x1ff8,\
0x381c,\
0x718e,\
0xe187,\
0xc183,\
0xc183,\
0xc1f3,\
0xc1f3,\
0xc003,\
0xc003,\
0xe007,\
0x700e,\
0x381c,\
0x1ff8,\
0x0ff0,\
]
watch.reverse() # Turn it upside-down
def defwatch(index):
import gl
gl.defcursor(index, watch*8)
gl.curorigin(index, 8, 8)
def test():
import gl
gl.foreground()
gl.winopen('test watchcursor')
defwatch(1)
gl.setcursor(1, 0, 0)
import time
time.sleep(10)