Pygame可以在wxPython无法做到的图形方面做些什么? [英] What can Pygame do in terms of graphics that wxPython can't?
问题描述
我想用Python开发一个非常简单的2D游戏。 Pygame是Python中最受欢迎的游戏开发库,但我已经非常熟悉wxPython,并且使用起来很舒服。我甚至写了一个俄罗斯方块克隆一>在里面,这是非常流畅的。
我不知道,什么是Pygame的报价在图形方面(离开声音一边,一会儿)是的wxPython可以你呢? Pygame中的图形比wxPython更简单/更快吗?它更跨平台吗?
看起来我在这里错过了一些东西,但我不知道是什么。
<解决方案
-
速度更快。 Pygame基于SDL,它是专门为游戏设计的C库,它的开发速度非常快。当你开发游戏时,你需要速度。
是游戏库,不是通用画布,它有用于精灵,转换,输入的类和函数处理,绘图,碰撞检测。它还实现了经常在游戏中使用的算法和技术,如脏矩形,页面翻转等。
对于一些非常简单的游戏,比如俄罗斯方块,差异不会太大,但如果你想开发一个相当复杂的游戏,相信我,你会想要像PyGame这样的东西。
I want to develop a very simple 2D game in Python. Pygame is the most popular library for game development in Python, but I'm already quite familiar with wxPython and feel comfortable using it. I've even written a Tetris clone in it, and it was pretty smooth.
I wonder, what does Pygame offer in terms of graphics (leaving sound aside, for a moment) that wxPython can't do ? Is it somehow simpler/faster to do graphics in Pygame than in wxPython ? Is it even more cross-platform ?
It looks like I'm missing something here, but I don't know what.
Well, in theory there is nothing you can do with Pygame that you can't with wxPython. The point is not what but how. In my opinion, it's easier to write a game with PyGame becasue:
It's faster. Pygame is based on SDL which is a C library specifically designed for games, it has been developed with speed in mind. When you develop games, you need speed.
Is a game library, not a general purpose canvas, It has classes and functions useful for sprites, transformations, input handling, drawing, collision detection. It also implements algorithms and techniques often used in games like dirty rectangles, page flipping, etc.
There are thousands of games and examples made with it. It will be easier for you to discover how to do any trick.
There are a lot of libraries with effects and utilities you could reuse. You want an isometric game, there is a library, you want a physics engine, there is a library, you what some cool visual effect, there is a library.
PyWeek. :) This is to make the development of your game even funnier!
For some very simple games like Tetris, the difference won't be too much, but if you want to develop a fairly complex game, believe me, you will want something like PyGame.
这篇关于Pygame可以在wxPython无法做到的图形方面做些什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!