【整理】python學習筆記(自學階段4)-- pygame的方法
阿新 • • 發佈:2018-12-17
PYGAME的方法和官方文件查詢
官方文件
模組 | 簡介 |
An array protocol view of surface pixels | |
How to access and control the CD audio devices. | |
Color representation. | |
Loading and compiling cursor images. | |
Configure the display surface. | |
Drawing simple shapes like lines and ellipses to surfaces. |
|
Manage the incoming events from various input devices and the windowing platform. | |
Various programs demonstrating the use of individual pyame modules. | |
Loading and rendering Truetype fonts. | |
Enhanced Pygame module for loading and rendering font faces. | |
Anti-aliasing draw functions. |
|
Loading, saving, and transferring of surfaces. | |
Manage the joystick devices. | |
Manage the keyboard device. | |
Manage the mouse device and display. | |
Video playback from MPEG movies. | |
Access advanced video overlays. | |
Top level functions to manage Pygame. | |
Flexible container for a rectangle. |
|
Native clipboard access. | |
Manipulate sound sample data. | |
Higher level objects to represent game images. | |
Objects for images and the screen. | |
Manipulate image pixel data. | |
Manage timing and framerate. |
pygame.
Rect
pygame object for storing rectangular coordinates
Rect(left, top, width, height) -> Rect
Rect((left, top), (width, height)) -> Rect
Rect(object) -> Rect
— | grow or shrink the rectangle size |
— | grow or shrink the rectangle size, in place |
— | moves the rectangle inside another |
— | moves the rectangle inside another, in place |
— | crops a rectangle inside another |
— | joins two rectangles into one |
— | joins two rectangles into one, in place |
— | resize and move a rectangle with aspect ratio |
— | test if one rectangle is inside another |
— | test if one rectangle in a list intersects |
— | test if one rectangle in a dictionary intersects |
— | test if all rectangles in a dictionary intersect |
(轉)RECT詳細影象說明
來源原文:https://blog.csdn.net/qq_39546430/article/details/80407817
Rect物件的屬性: 1.返回一個座標數字 x,y top, left, bottom, right centerx, centerysize width, height w,h; 2.返回一個(X,Y)座標陣列 topleft (左上) bottomleft (左下) bottomright (右下)
midtop(中上) midleft(左中) midbottom(底中) midright(右中)
center(中心點座標) 直接上圖,灰色矩形大小(900,450),中央藍色矩形(400,510),大家自己體會一下