Jump to content
  • Advertisement
Sign in to follow this  
K1NNY

Title Screen Help

This topic is 2638 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So i wanted to make a kind of title screen thing for a program im about to write so i went ahead and tried testing things out with the title screen. I used this code below and i thought it should work to show my image for 1 second and then clear the screen. Unfortunately it doesnt. Help would be appreciated.

import pygame
import time

pygame.init()

logo = pygame.image.load("Kinny.BMP")

screen = pygame.display.set_mode ((640, 480))
pygame.display.set_caption('Title Screen')

done=False


#main loop
while done is False:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done=True

screen.blit (logo, (320, 240))

time.sleep(1)

screen.fill ((255, 255, 255))

pygame.display.flip()

pygame.quit()



The problem i run into is that nothing at all pops up on the screen. it actualy just shows what ever is behind it. like looking thru an actual window. I know that its my inability to code correctly so i would like help.

Share this post


Link to post
Share on other sites
Advertisement

screen.blit (logo, (320, 240))

time.sleep(1)

screen.fill ((255, 255, 255))

pygame.display.flip()

pygame.quit()


Granted I've never used python or pygame, but what that code looks like to me is;

1: Tell the engine to draw your logo to the backbuffer (offscreen)

2: sleep for 1 second

3: clear the screen to white

4: Flip the frame buffers, ie now draw the backbuffer to the screen. and since you just cleared the backbuffer to white, that's what's going to show.

Also I'm not familar why python so maybe I'm getting this wrong, but I assume all the code above is within the scope of that 'while' loop? If so you're going to be constantly drawing the logo and a white screen over and over again?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!