dcoste commited on
Commit
67316fb
1 Parent(s): c2317bd

First attempt at creating a spaces app

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Default ignored files
2
+ /workspace.xml
.idea/idle_screen_bouncing_dvd.iml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ <component name="TestRunnerService">
9
+ <option name="PROJECT_TEST_RUNNER" value="pytest" />
10
+ </component>
11
+ </module>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/idle_screen_bouncing_dvd.iml" filepath="$PROJECT_DIR$/.idea/idle_screen_bouncing_dvd.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
app.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from random import randint
2
+ import pygame
3
+ import numpy as np
4
+ import time
5
+
6
+ exit = False
7
+ # Settings
8
+ # SIZE = width, height = 800, 600 # Resolution. (4:3)!
9
+ BG_COLOR = (0, 0, 0)
10
+ fullscreen = True
11
+
12
+ logo = pygame.image.load('dvd_logo_0002.png')
13
+ logo = pygame.transform.scale(logo, (200, 100))
14
+ clock = pygame.time.Clock()
15
+ img_size = logo.get_rect().size
16
+ screen = pygame.display.set_mode()
17
+ pygame.display.set_caption('Idle screen DVD bounce')
18
+ screen_info = pygame.display.Info()
19
+
20
+ if fullscreen:
21
+ DISPLAYSURFACE = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
22
+ pygame.mouse.set_visible(False)
23
+
24
+ x = randint(50, screen_info.current_w - 200)
25
+ y = randint(50, screen_info.current_h - 200)
26
+ x_speed = 2
27
+ y_speed = 2
28
+
29
+ dvd_background_color = [255, 255, 255]
30
+
31
+
32
+ def random_color_change(surface):
33
+ global dvd_background_color
34
+
35
+ np_surface = pygame.surfarray.array3d(surface)
36
+ for channel in range(np_surface.shape[-1]):
37
+ # np_surface[:, :, channel] = randint(0, 255)
38
+ random_channel_color = randint(50, 255)
39
+ np_surface[:, :, channel] = np.where(
40
+ np.logical_and(np_surface[:, :, channel] >= dvd_background_color[channel] - 20,
41
+ np_surface[:, :, channel] <= dvd_background_color[channel] + 20),
42
+ random_channel_color, np_surface[:, :, channel])
43
+ dvd_background_color[channel] = random_channel_color
44
+ return pygame.surfarray.make_surface(np_surface)
45
+
46
+
47
+ while not exit:
48
+ screen.fill(BG_COLOR)
49
+
50
+ if ((x + img_size[0] >= screen_info.current_w) or (x <= 0)) and ((y + img_size[1] >= screen_info.current_h) or (y <= 0)):
51
+ time.sleep(9999999999)
52
+ if (x + img_size[0] >= screen_info.current_w) or (x <= 0):
53
+ logo = random_color_change(logo)
54
+ x_speed = -x_speed
55
+ if (y + img_size[1] >= screen_info.current_h) or (y <= 0):
56
+ logo = random_color_change(logo)
57
+ y_speed = -y_speed
58
+ x += x_speed
59
+ y += y_speed
60
+ screen.blit(logo, (x, y))
61
+ pygame.display.update()
62
+ clock.tick(60)
63
+ for event in pygame.event.get():
64
+ if event.type == pygame.QUIT:
65
+ exit = True
66
+
67
+ pygame.quit()
dvd_logo_0002.png ADDED
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ certifi==2021.10.8
2
+ numpy==1.21.5
3
+ pygame==2.1.2
4
+ PyOpenGL==3.1.5
5
+ wincertstore==0.2