Hello! Pygame
来源:互联网 发布:wifi热点软件 编辑:程序博客网 时间:2024/05/22 16:51
Pygame:
pygame是一个设计用来开发游戏的python模块,在SDL库的基础上提供了各种接口,从而使用用户能够使用python语言创建各种各样的游戏或多媒体程序。
我的理解:能够使用python开发出2D游戏的工具!Pygame,fly me to the moon!
资源:http://eyehere.net/
http://pygame.org/docs/ref/draw.html
Hello,Pygame:
# !.usr/bin/python# -*- coding:utf-8 -*-# author: by qiu# time: 2015-1-30import sysimport pygamefrom pygame.locals import *pygame.init() #重要常量SCREEN_SIZE = (640, 480)background_file = "background.jpg"hello_file = "hello.gif"Runing = Truepygame.display.set_caption("Hello, World!")screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32) # 分辨率, 窗口标识, 色度background = pygame.image.load(background_file).convert()mouse_cursor = pygame.image.load(hello_file).convert_alpha()while Runing: for event in pygame.event.get(): if event.type == pygame.QUIT: #关闭窗体 pygame.quit() sys.exit() screen.blit(background, (0, 0)) x, y = pygame.mouse.get_pos() #获取鼠标位置 x -= mouse_cursor.get_width() /2 y -= mouse_cursor.get_height() /2 #计算光标左上角位置 screen.blit(mouse_cursor, (x, y)) # 画上光标 pygame.display.update() #刷新屏幕 显示
总结:
窗体+事件循环
0 0
- Hello, PyGame
- Hello! Pygame
- Hello Pygame程序
- pygame
- pygame
- pygame
- 【pygame】
- Python:pygame游戏编程之旅一(Hello World)
- Python:pygame游戏编程之旅一(Hello World)
- 《Hello World》python学习之pygame画图模块
- pygame学习:pygame简介
- PYGAME 入门
- pygame.Font
- pygame.font
- pygame实例
- python_pyopengl,pygame
- pygame安装
- Pygame介绍
- statemachine详解
- cocos2d-x屏幕适配原理分析
- javaVM 判断对象实例何时回收 用的可达性分析算法,而非引用计数算法
- java组件
- 【Qt5开发及实例】24、数据柱形图显示
- Hello! Pygame
- js页面跳转整理
- 找新朋友
- mysql 强制索引,忽略索引
- 菜鸟要做架构师(三)——单元测试的七种境界
- U盘安装CentOS-6.5
- Javascript刷新页面的几种方法
- PHP通过iconv将字符串从GBK转换为UTF8字符集
- ASP.NET如何输出刷新父窗口脚本语句