Young87

SmartCat's Blog

So happy to code my life!

游戏开发交流QQ群号60398951

当前位置:首页 >跨站数据测试

使用python3和pygame包小练游戏玩耍 --屏幕显示

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan  3 21:02:38 2018

@author: lisir
"""
# 
import pygame

from sys import exit

background_image_filename = "./tmp/meixi1.jpg"

pygame.init()
SCREEN_SIZE = (1000, 563)
screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32)
background = pygame.image.load(background_image_filename).convert()
 
FullScreen = False
 
while True:
 
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit()
    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_f:
            FullScreen = not FullScreen
            if FullScreen:
                screen = pygame.display.set_mode(SCREEN_SIZE, FullScreen, 32)
            else:
                screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32)
    screen.blit(background, (0, 0))
    
    
    pygame.display.update()

除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog

上一篇: springboot vue 前后端分离 混编APP个人项目

下一篇: java知识体系介绍

精华推荐