1
0
forked from ndyer/pygame-dvd

Compare commits

..

No commits in common. "399092238ecffecea934a495288d3585b57b4a6d" and "afe503bee43d58e99ed206bd9d82a8c785fb4238" have entirely different histories.

8 changed files with 20 additions and 21 deletions

View File

@ -1,4 +1,4 @@
import steam_saver
import dvd_bounce
import sys
import os
@ -11,4 +11,4 @@ if __name__ == '__main__':
if arg == '--window':
windowed_mode = True
steam_saver.main.main(windowed_mode)
dvd_bounce.main.main(windowed_mode)

View File

@ -1,11 +1,11 @@
import pygame
import steam_saver.surfaces as surfaces
import dvd_bounce.surfaces as surfaces
# Global variables
SCREEN_SIZE = (1920, 1080)
FPS = 60
VALID_SURFACES = [
'steam_screen'
'dvd_screen'
]
@ -21,8 +21,8 @@ def main(windowed_mode=False):
else:
window = pygame.display.set_mode(SCREEN_SIZE, pygame.FULLSCREEN)
# Starts the program with the surface 'steam_screen' as the default
surface = getattr(globals()['surfaces'], 'steam_screen').Surface(SCREEN_SIZE)
# Starts the program with the surface 'dial' as the default
surface = getattr(globals()['surfaces'], 'dvd_screen').Surface(SCREEN_SIZE)
running = True
while running:
clock.tick(FPS)

View File

@ -0,0 +1 @@
from . import dvd_screen

View File

@ -3,15 +3,15 @@ import os
import random
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
LOGO_SCALING = .5
LOGO_SCALING = 0.1
class SteamLogo(pygame.sprite.Sprite):
class DVDLogo(pygame.sprite.Sprite):
"""
A Pygame sprite representing a Steam logo that moves around the screen.
A Pygame sprite representing a DVD logo that moves around the screen.
Attributes:
base_image (pygame.Surface): The original image of the Steam logo.
base_image (pygame.Surface): The original image of the DVD logo.
x_speed (int): Current speed in the X axis.
y_speed (int): Current speed in the Y axis.
max_x (int): Maximum X position on the screen.
@ -20,7 +20,7 @@ class SteamLogo(pygame.sprite.Sprite):
def __init__(self, window_size: tuple):
"""
Initialize SteamLogo sprite with given window size.
Initialize DVDLogo sprite with given window size.
Args:
window_size (tuple): Size of the game window (width, height).
@ -28,11 +28,10 @@ class SteamLogo(pygame.sprite.Sprite):
super().__init__()
# Load and scale original logo image
self.base_image = pygame.image.load(SCRIPT_DIR + '/resources/steam_logo.png')
self.base_image = pygame.image.load(SCRIPT_DIR + '/resources/dvd.png')
self.base_image.convert_alpha()
self.base_image = pygame.transform.smoothscale(self.base_image,
(self.base_image.get_width() * LOGO_SCALING,
self.base_image.get_height() * LOGO_SCALING))
self.base_image = pygame.transform.scale(self.base_image, (self.base_image.get_width() * LOGO_SCALING,
self.base_image.get_height() * LOGO_SCALING))
# Copy the base image and store it in a separate instance variable; this is the image that will be drawn.
self.image = self.base_image.copy()
@ -69,7 +68,7 @@ class SteamLogo(pygame.sprite.Sprite):
def update(self):
"""
Update SteamLogo sprite's position and speed based on its current state.
Update DVDLogo sprite's position and speed based on its current state.
This method is called each frame during game execution to move the logo around
the screen and to handle collision/color changes.
@ -122,9 +121,9 @@ class Surface(pygame.Surface):
pygame.mouse.set_visible(False)
# Create a SteamLogo sprite instance and add it to the sprite group.
steam_logo = SteamLogo(window_size)
self.all_sprites = pygame.sprite.Group(steam_logo)
# Create a DVDLogo sprite instance and add it to the sprite group.
dvd_logo = DVDLogo(window_size)
self.all_sprites = pygame.sprite.Group(dvd_logo)
def update(self):
"""
@ -147,4 +146,4 @@ class Surface(pygame.Surface):
self.all_sprites.update()
# Draw all sprites onto this surface.
self.all_sprites.draw(self)
self.all_sprites.draw(self)

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1 +0,0 @@
from . import steam_screen

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB