Browse Source

added bugs

master
Graham Northup 6 years ago
parent
commit
397b053b7c
Signed by: grissess GPG Key ID: 5D000E6F539376FB
  1. BIN
      aaa.flac
  2. 41
      senpai_simulator.py

BIN
aaa.flac

41
senpai_simulator.py

@ -1,7 +1,14 @@
import pygame
import pygame, time, os, random
pygame.init()
disp = pygame.display.set_mode((1480, 1080), pygame.FULLSCREEN)
#disp = pygame.display.set_mode((1480, 1080), pygame.FULLSCREEN)
disp = pygame.display.set_mode((1480, 1080))
snd = pygame.mixer.Sound('aaa.flac')
TRIGGERED = False
TRIGGERED_TIME = None
TRIGGERED_MOVE = 100
BKD_COL = (255, 255, 255)
joys = [pygame.joystick.Joystick(i) for i in range(pygame.joystick.get_count())]
print(joys)
@ -27,12 +34,36 @@ bkd_tmp = INV_MASK.copy().convert_alpha()
bkd_tmp.blit(INV_MASK, (0, 0))
bkd_tmp.blit(BKGD, (0, 0), None, pygame.BLEND_RGBA_MULT)
wmi = pygame.display.get_wm_info()
while True:
if TRIGGERED:
os.system('xdotool windowmove --relative {} {} {}'.format(wmi['wmwindow'], random.randint(-TRIGGERED_MOVE, TRIGGERED_MOVE), random.randint(-TRIGGERED_MOVE, TRIGGERED_MOVE)))
if time.time() > TRIGGERED_TIME + snd.get_length():
exit()
for ev in pygame.event.get():
##print(ev)
print(ev)
if ev.type == pygame.KEYDOWN and ev.key == pygame.K_ESCAPE:
exit()
disp.fill((255, 255, 255))
if ev.type == pygame.JOYBUTTONDOWN:
if ev.button == 0:
wmi = pygame.display.get_wm_info()
for k, v in wmi.items():
print(k, type(v), v)
if ev.button == 5:
for but in (0, 1, 3, 4):
if not joys[0].get_button(but):
break
else:
if not TRIGGERED:
TRIGGERED = True
TRIGGERED_TIME = time.time()
snd.play()
BKD_COL = (255, 0, 0)
red_tmp = pygame.Surface(bkd_tmp.get_size())
red_tmp.fill(BKD_COL)
bkd_tmp.blit(red_tmp, (0, 0), None, pygame.BLEND_RGBA_MULT)
disp.fill(BKD_COL)
##w, h = disp.get_size()
##w2, h2, w4, h4 = w / 2, h / 2, w / 4, h / 4
joy = joys[0]
@ -40,7 +71,7 @@ while True:
##pygame.draw.circle(disp, (255, 255, 255), (int(w4 * x1 + w4), int(h2 * y1 + h2)), 15)
##pygame.draw.circle(disp, (255, 255, 255), (int(w4 * x2 + w4 + w2), int(h2 * y2 + h2)), 15)
#msk_tmp.blit(EYE_MASK, (0, 0))
msk_tmp.fill((255, 255, 255))
msk_tmp.fill(BKD_COL)
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)
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)
disp.blit(msk_tmp, (0, 0))

Loading…
Cancel
Save