-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcursor.py
More file actions
50 lines (45 loc) · 1.07 KB
/
cursor.py
File metadata and controls
50 lines (45 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import pygame
_HAND = (
" XX ",
" X..X ",
" X..X ",
" X..X ",
" X..XXXXX ",
" X..X..X.XX ",
" XX X..X..X.X.X ",
"X..XX.........X ",
"X...X.........X ",
" X.....X.X....X ",
" X....X.X....X ",
" X....X.X...X ",
" X...X.X...X ",
" X.......X ",
" X....X.X ",
" XXXXX XX ")
_ARROW = (
"XX ",
"X.X ",
"X..X ",
"X...X ",
"X....X ",
"X.....X ",
"X......X ",
"X.......X ",
"X........X ",
"X.........X ",
"X......XXXXX ",
"X...X..X ",
"X..XX..X ",
"X.X XX..X ",
"XX X..X ",
"X XX ")
_HCURS, _HMASK = pygame.cursors.compile(_HAND, "X", ".")
HAND_CURSOR = ((16, 16), (5, 1), _HCURS, _HMASK)
_ACURS, _AMASK = pygame.cursors.compile(_ARROW, "X", ".")
ARROW_CURSOR = ((16, 16), (5, 1), _ACURS, _AMASK)
def collide(x,y,image,pos) :
rect = image.get_rect()
if pos[0] >= x and pos[0] <=x + rect.width and pos[1] >= y and pos[1] <= y + rect.height :
return 1
else :
return 0