1
0
forked from ndyer/pygame-dvd

Compare commits

...

3 Commits

Author SHA1 Message Date
399092238e removed old dvd logo png 2025-01-06 16:59:27 -05:00
dbd78bb5c5 changed the dvd logo to the steam logo
changed the scaling function to a smoother one
2025-01-06 16:59:02 -05:00
31f6593ae0 renamed dvd references to steam references 2025-01-06 16:41:10 -05:00
8 changed files with 21 additions and 20 deletions

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

View File

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

View File

@ -1,11 +1,11 @@
import pygame
import dvd_bounce.surfaces as surfaces
import steam_saver.surfaces as surfaces
# Global variables
SCREEN_SIZE = (1920, 1080)
FPS = 60
VALID_SURFACES = [
'dvd_screen'
'steam_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 'dial' as the default
surface = getattr(globals()['surfaces'], 'dvd_screen').Surface(SCREEN_SIZE)
# Starts the program with the surface 'steam_screen' as the default
surface = getattr(globals()['surfaces'], 'steam_screen').Surface(SCREEN_SIZE)
running = True
while running:
clock.tick(FPS)

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -3,15 +3,15 @@ import os
import random
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
LOGO_SCALING = 0.1
LOGO_SCALING = .5
class DVDLogo(pygame.sprite.Sprite):
class SteamLogo(pygame.sprite.Sprite):
"""
A Pygame sprite representing a DVD logo that moves around the screen.
A Pygame sprite representing a Steam logo that moves around the screen.
Attributes:
base_image (pygame.Surface): The original image of the DVD logo.
base_image (pygame.Surface): The original image of the Steam 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 DVDLogo(pygame.sprite.Sprite):
def __init__(self, window_size: tuple):
"""
Initialize DVDLogo sprite with given window size.
Initialize SteamLogo sprite with given window size.
Args:
window_size (tuple): Size of the game window (width, height).
@ -28,10 +28,11 @@ class DVDLogo(pygame.sprite.Sprite):
super().__init__()
# Load and scale original logo image
self.base_image = pygame.image.load(SCRIPT_DIR + '/resources/dvd.png')
self.base_image = pygame.image.load(SCRIPT_DIR + '/resources/steam_logo.png')
self.base_image.convert_alpha()
self.base_image = pygame.transform.scale(self.base_image, (self.base_image.get_width() * LOGO_SCALING,
self.base_image.get_height() * LOGO_SCALING))
self.base_image = pygame.transform.smoothscale(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()
@ -68,7 +69,7 @@ class DVDLogo(pygame.sprite.Sprite):
def update(self):
"""
Update DVDLogo sprite's position and speed based on its current state.
Update SteamLogo 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.
@ -121,9 +122,9 @@ class Surface(pygame.Surface):
pygame.mouse.set_visible(False)
# 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)
# 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)
def update(self):
"""