Browse Source

added bugs

Graham Northup 3 years ago
parent
commit
397b053b7c
Signed by: Graham Northup <grissess@nexusg.org> GPG Key ID: 5D000E6F539376FB
2 changed files with 36 additions and 5 deletions
  1. BIN
      aaa.flac
  2. 36
    5
      senpai_simulator.py

BIN
aaa.flac View File


+ 36
- 5
senpai_simulator.py View File

@@ -1,7 +1,14 @@
1
-import pygame
1
+import pygame, time, os, random
2 2
 pygame.init()
3 3
 
4
-disp = pygame.display.set_mode((1480, 1080), pygame.FULLSCREEN)
4
+#disp = pygame.display.set_mode((1480, 1080), pygame.FULLSCREEN)
5
+disp = pygame.display.set_mode((1480, 1080))
6
+
7
+snd = pygame.mixer.Sound('aaa.flac')
8
+TRIGGERED = False
9
+TRIGGERED_TIME = None
10
+TRIGGERED_MOVE = 100
11
+BKD_COL = (255, 255, 255)
5 12
 
6 13
 joys = [pygame.joystick.Joystick(i) for i in range(pygame.joystick.get_count())]
7 14
 print(joys)
@@ -27,12 +34,36 @@ bkd_tmp = INV_MASK.copy().convert_alpha()
27 34
 bkd_tmp.blit(INV_MASK, (0, 0))
28 35
 bkd_tmp.blit(BKGD, (0, 0), None, pygame.BLEND_RGBA_MULT)
29 36
 
37
+wmi = pygame.display.get_wm_info()
38
+
30 39
 while True:
40
+    if TRIGGERED:
41
+        os.system('xdotool windowmove --relative {} {} {}'.format(wmi['wmwindow'], random.randint(-TRIGGERED_MOVE, TRIGGERED_MOVE), random.randint(-TRIGGERED_MOVE, TRIGGERED_MOVE)))
42
+        if time.time() > TRIGGERED_TIME + snd.get_length():
43
+            exit()
31 44
     for ev in pygame.event.get():
32
-        ##print(ev)
45
+        print(ev)
33 46
         if ev.type == pygame.KEYDOWN and ev.key == pygame.K_ESCAPE:
34 47
             exit()
35
-    disp.fill((255, 255, 255))
48
+        if ev.type == pygame.JOYBUTTONDOWN:
49
+            if ev.button == 0:
50
+                wmi = pygame.display.get_wm_info()
51
+                for k, v in wmi.items():
52
+                    print(k, type(v), v)
53
+            if ev.button == 5:
54
+                for but in (0, 1, 3, 4):
55
+                    if not joys[0].get_button(but):
56
+                        break
57
+                else:
58
+                    if not TRIGGERED:
59
+                        TRIGGERED = True
60
+                        TRIGGERED_TIME = time.time()
61
+                        snd.play()
62
+                        BKD_COL = (255, 0, 0)
63
+                        red_tmp = pygame.Surface(bkd_tmp.get_size())
64
+                        red_tmp.fill(BKD_COL)
65
+                        bkd_tmp.blit(red_tmp, (0, 0), None, pygame.BLEND_RGBA_MULT)
66
+    disp.fill(BKD_COL)
36 67
     ##w, h = disp.get_size()
37 68
     ##w2, h2, w4, h4 = w / 2, h / 2, w / 4, h / 4
38 69
     joy = joys[0]
@@ -40,7 +71,7 @@ while True:
40 71
     ##pygame.draw.circle(disp, (255, 255, 255), (int(w4 * x1 + w4), int(h2 * y1 + h2)), 15)
41 72
     ##pygame.draw.circle(disp, (255, 255, 255), (int(w4 * x2 + w4 + w2), int(h2 * y2 + h2)), 15)
42 73
     #msk_tmp.blit(EYE_MASK, (0, 0))
43
-    msk_tmp.fill((255, 255, 255))
74
+    msk_tmp.fill(BKD_COL)
44 75
     msk_tmp.blit(EYE, (RE_CEN[0] + int(RE_DEL[0] * x1) - EYE_OFF[0], RE_CEN[1] + int(RE_DEL[1] * y1) - EYE_OFF[1]), None, pygame.BLEND_RGBA_MULT)
45 76
     msk_tmp.blit(EYE, (LE_CEN[0] + int(LE_DEL[0] * x2) - EYE_OFF[0], LE_CEN[1] + int(LE_DEL[1] * y2) - EYE_OFF[1]), None, pygame.BLEND_RGBA_MULT)
46 77
     disp.blit(msk_tmp, (0, 0))

Loading…
Cancel
Save