krish – 起死回生 [Wake up from death & return to life.]

July 13, 2008

KDragons screensaver

Filed under: Gaming,Programming — krish @ 1:12 am
Tags: , ,

Just wrote a simple scrolling marquee screensaver with pygame. Bad thing, it runs in 640 x 480 display mode.

Image:
KDragons Screensaver
Konqi taken from Wormux.

Source:

#!/usr/bin/env python

bkg_image_filename = ‘images/wormuxkonqi.png’

# Running in windowed mode
SCREEN_SIZE = (640, 480)
message = ” KDragons coming soon… ”

# Get functions needed
from random import randrange
import pygame
from pygame.locals import *
from sys import exit

pygame.init()
screen = pygame.display.set_mode(SCREEN_SIZE)

font = pygame.font.SysFont(“freemono”, 30);
text_surface = font.render(message, True, (0,255,0))

x = 0
y = ( SCREEN_SIZE[1] – text_surface.get_height() ) / 2

bkg = pygame.image.load(bkg_image_filename).convert()

while True:
for event in pygame.event.get():
if event.type == QUIT:
exit()

# set speed for scroll and change of y axis position
x-=5
if x < -text_surface.get_width(): x = SCREEN_SIZE[0] y = randrange(100,450,20) # konqi scrolls opposite direction to text screen.blit(bkg, (-x,y/2)) screen.blit(text_surface, (x,y)) pygame.display.update() screen.fill((0,0,0)) [/sourcecode]

Advertisements

1 Comment »

  1. […] – bookmarked by 3 members originally found by MandyCeliner1 on 2008-12-22 KDragons screensaver https://srikrishnadas.wordpress.com/2008/07/13/kdragons-screensaver/ – bookmarked by 5 members […]

    Pingback by Bookmarks about Screensaver — January 20, 2009 @ 1:00 pm


RSS feed for comments on this post. TrackBack URI

Please leave a Reply / Discuss this topic here :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

The Male Factor

On behalf of the ignored gender

Rough Draft

by Atteris Amarth and Darrek Ringo

The Kochi Post.

Read by all + Influenced by none

JumboMake

A signature of Kiran

SAAYAM CHEDDAM FOUNDATION

This blog is just for additional and extension share of it's main frames. No activity is planned from here

krish - 起死回生 [Wake up from death & return to life.]

Get a sneak peek into krish's life, work and passion.

WordPress.com

WordPress.com is the best place for your personal blog or business site.

A Tale of Two and a Half

Monika Amita Bakshi

%d bloggers like this: