一组类/函数,用于在PyGame应用程序中加载数据,默认情况下对数据和处理结果进行记录,允许对这些数据进行记录

pygame_loaders的Python项目详细描述


这个模块最初是一个PyGod项目的简单合成糖,

for performances sake it quickly gained memoization, allowing you to call for images, not carring if you already loaded them or not. As you may need to do that for result of process on those images, the image loader gained a lot of keywords, that allow to call images with a zooms, blending, reversing, scaling, rotating, and all sort of combinations, everytime doing only the required parts of those processings, and using previous results of processings. Okay, it can takes up big memory amounts, but well, i found it’s most of the time less of the problem than CPU, so if you agree, you will probably agree that for games, it’s an acceptable tradeoff.

Oh, for convenience sakes, it can load bunch of text and musics, too, the processing part is less developped on these ones, but contributions are welcomed, and memoization is done for them too.

Anyway, using it is quite simple, simply import the needed loaders from loaders.py, and for an image filepath, image() will return a tupple containing the image and it’s size, no need to store it away, calling the loader a second time or more is basically free, thanks to memoization.

必须加载PyGame并设置显示模式才能执行大多数 图像操作。

>>> from pygame_loaders import image
>>> image('myimage.png') # actual loading
(<Surface(491x546x32 SW)>, <rect(0, 0, 491, 546)>)
>>> image('myimage.png') # returning same result, without any loading
>>> image("myimage.png", zoom=1.5) # only performing zoom
(<Surface(736x819x32 SW)>, <rect(0, 0, 736, 819)>)
>>> image("myimage.png", zoom=1.5, alpha=0.4) # only changing alpha
(<Surface(736x819x32 SW)>, <rect(0, 0, 736, 819)>)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java检查整数是0还是检查变量是null更好?   java Android Kotlin(初学者)使用File(),并从ACTION\u GET\u内容返回Uri   java JavaFx在“内部场景”和根场景之间切换   spring将XMLBean配置转换为java配置   java JPA HIBERNATE映射列两次(embeddedID和POJO)   c#单态模式模型在什么情况下适用?   java请求。getRemoteUser在特定时间后返回null?   spring boot中PUT api控制器的java my单元测试用例失败   java在字符串中互换地解析和替换值   java Android JNI在应用程序中检测到错误:调用JNI GetMethodID时出现挂起异常   JavaSpringDataMongo:使用非简单键持久化映射   爪哇玻璃鱼连接被拒绝   java如何在用户注册时发送特定电子邮件id的自动回复?   Java列表:实例化时和之后的赋值之间的差异