-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimu.py
36 lines (27 loc) · 804 Bytes
/
simu.py
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
import random
import pygame
from environment import Environment
################
# Main Program #
################
inputSig = random.randint(3, 30)
samplingFreqSelection = inputSig * 4
t = 0
env = Environment(1000, 300)
env.redrawEnv(inputSig, samplingFreqSelection, 0)
while (True):
## check if game was exited
# -------------------------
env.checkExited()
## Sampling Signal Input Selection
# ---------------------------------
if pygame.mouse.get_pressed()[0] != 0:
samplingFreqSelection = pygame.mouse.get_pos()[0] - 5
env.redrawEnv(inputSig, samplingFreqSelection, t)
# Sampling and Signal Reconstruction
# ----------------------------------
## Update Time
# -------------
t = t + 1
if (t > env.screenSizeX / 2):
t = 0