generated from eanorambuena/EanorambuenaMathematica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample1.py
48 lines (40 loc) · 1.56 KB
/
example1.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
37
38
39
40
41
42
43
44
45
46
47
48
from engine import *
import sys, os
SCREEN_WIDTH = 1080
SCREEN_HEIGHT = 720
BGCOLOR = black
def main():
pygame.init()
pygame_screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
engine_screen = Screen(SCREEN_HEIGHT, SCREEN_WIDTH, BGCOLOR)
pygame.display.set_caption("Eanorambuena Mathematica")
def setup(screen: Screen):
screen.draw_axes()
Hills = Sin * 0.7 + Sin[X * 0.5 - 1] + Cos[X * 0.2] * 3
screen.split_regions(Hills, colors = [green, dark_green, cian])
screen.paint_over(Sqrt[X ** 2 * -1 + I * 2500] + 300, color = yellow, x_bounds = [-49, 49], y_bounds = [250, 350])
def loop(screen: Screen):
screen.draw_axes()
screen.plot(Sin, 0, 0, red)
screen.plot(sin, 0, 0, green, 40)
setup(engine_screen)
path = os.path.join("examples", "example1.png")
engine_screen.save(path)
load2screen(pygame_screen, path)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
sys.exit()
elif event.key == pygame.K_r:
if engine_screen.bgcolor == black:
engine_screen.bgcolor = white
else:
engine_screen.bgcolor = black
engine_screen.fill_room()
loop(engine_screen)
engine_screen.save()
load2screen(pygame_screen)
main()