Browse Source

Initial commit

master
Graham Northup 6 years ago
commit
dc6adcde33
Signed by: grissess GPG Key ID: 5D000E6F539376FB
  1. 15
      README.md
  2. BIN
      senpai_bkgd.png
  3. BIN
      senpai_bkgd.xcf
  4. BIN
      senpai_eye.png
  5. BIN
      senpai_eye.xcf
  6. BIN
      senpai_eyemask.png
  7. BIN
      senpai_eyemask.xcf
  8. 47
      senpai_simulator.py

15
README.md

@ -0,0 +1,15 @@
# Senpai Simulator 2016
The gaming sensation that's sweeping the nation!
Note that this program uses only joystick inputs, and expects a two-stick
controller. If you have one of these, but the axes are wrong, change this line
as you see fit:
```python
x1, y1, x2, y2 = map(joy.get_axis, [0, 1, 3, 4])
```
The `[0, 1, 3, 4]` correspond to left X, left Y, right X, and right Y axes
respectively.
There's no support for other input devices yet, sorry ¯\\_(ツ)_/¯

BIN
senpai_bkgd.png

After

Width: 1480  |  Height: 1080  |  Size: 1.2 MiB

BIN
senpai_bkgd.xcf

BIN
senpai_eye.png

After

Width: 54  |  Height: 54  |  Size: 5.5 KiB

BIN
senpai_eye.xcf

BIN
senpai_eyemask.png

After

Width: 1480  |  Height: 1080  |  Size: 11 KiB

BIN
senpai_eyemask.xcf

47
senpai_simulator.py

@ -0,0 +1,47 @@
import pygame
pygame.init()
disp = pygame.display.set_mode((1480, 1080), pygame.FULLSCREEN)
joys = [pygame.joystick.Joystick(i) for i in range(pygame.joystick.get_count())]
print(joys)
for joy in joys:
joy.init()
BKGD = pygame.image.load('senpai_bkgd.png').convert_alpha()
EYE_FULL = pygame.image.load('senpai_eye.png')
EYE = EYE_FULL.convert_alpha()
EYE_MASK = pygame.image.load('senpai_eyemask.png').convert_alpha()
INV_MASK = pygame.Surface(EYE_MASK.get_size(), pygame.SRCALPHA)
INV_MASK.fill((255, 255, 255, 255))
INV_MASK.blit(EYE_MASK, (0, 0), None, pygame.BLEND_RGBA_SUB)
##EYE_SF = 0.15
##EYE = pygame.transform.smoothscale(EYE_FULL, list(map(int, (EYE_SF * EYE_FULL.get_width(), EYE_SF * EYE_FULL.get_height())))).convert_alpha()
EYE_OFF = (EYE.get_width() / 2, EYE.get_height() / 2)
LE_CEN = (878, 552)
RE_CEN = (631, 588)
LE_DEL = (50, 20)
RE_DEL = (40, 20)
msk_tmp = EYE_MASK.copy().convert_alpha()
bkd_tmp = INV_MASK.copy().convert_alpha()
while True:
for ev in pygame.event.get():
##print(ev)
if ev.type == pygame.KEYDOWN and ev.key == pygame.K_ESCAPE:
exit()
disp.fill((255, 255, 255))
##w, h = disp.get_size()
##w2, h2, w4, h4 = w / 2, h / 2, w / 4, h / 4
joy = joys[0]
x1, y1, x2, y2 = map(joy.get_axis, [0, 1, 3, 4])
##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.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)
bkd_tmp.blit(INV_MASK, (0, 0))
bkd_tmp.blit(BKGD, (0, 0), None, pygame.BLEND_RGBA_MULT)
disp.blit(msk_tmp, (0, 0))
disp.blit(bkd_tmp, (0, 0))
pygame.display.flip()
Loading…
Cancel
Save