Опубликован: 06.08.2013 | Доступ: свободный | Студентов: 973 / 64 | Длительность: 27:51:00
Лекция 11:

Glossary

< Лекция 10 || Лекция 11
Аннотация: Glossary.

Alpha Value - The amount of transparency for a color. In Pygame, alpha values range from 0 (completely transparent) to 255 (completely opaque).

Anti-Aliasing - A technique for making shapes look smoother and less blocky by adding fuzzy colors to their edges. Anti-aliased drawings look smooth. Aliased drawings look blocky.

Attributes - A variable that is part of an object. For example, Rect objects have members such as top and left which hold integer values for the Rect object.

Backwards Compatibility - Writing code that is compatible with older versions of software. Python version 3 has some backwards-incompatible features with Python version 2, but it is possible to write Python 3 programs that are backwards-compatible with Python 2.

Base Case - In recursion, the base case is the condition that stops further recursive function calls. A base case is necessary to prevent stack overflow errors.

Blitting - A word that means copying the image on one Surface object to another. In programming in general, it means to copy one image to another image.

Bounding Rectangle - The smallest rectangle that can be drawn around another shape.

Camera - A view of a particular part of the game world. Cameras are used when the game world is too large to fit on the player's screen.

Caption - In programming, the caption is the text on the title bar of the window. In Pygame, the caption can be set with the pygame.display.set_caption() function.

CLI - See, Command Line Interface.

Command Line Interface - A program that the user can use by seeing text on the screen and typing text through the keyboard. Old computers used to be able to only run CLI programs, but new computers have Graphical User Interfaces.

Constructor Function - The function that creates a new object. In Python, these functions have the same name as the kind of objects they produce. For example, pygame.Rect() creates Rect objects.

Display Surface - The Surface object returned by the call to pygame.display.set_mode(). This Surface object is special because anything drawn on it with the Pygame drawing or blitting functions will appear on the screen when pygame.display.update() is called.

Drawing Primitives - The name for the basic shape-drawing functions in Pygame. Drawing primitives include rectangles, lines, and ellipses. Drawing primitives do not include images like the ones in .png or .jpg files.

Event Handling - The code that performs actions in response to Event objects that have been generated by the user, such as key presses or mouse clicks.

Event Handling Loop - The event handling code is usually inside a loop to handle each of the events that have been generated since the last time the event handling loop was executed.

Event Queue - When events such as mouse clicks or key presses happen, Pygame stores them in an internal queue data structure. Events can be removed and retrieved from the event queue by calling pygame.event.get().

FPS - See, Frames Per Second.

Frame - A single image that is displayed on the screen as part of an animation. Animated graphics will be composed of many frames, each shown for a split second.

Frame Rate - See, Refresh Rate.

Frames Per Second - The measure of how many frames of an animation are displayed per second. It is common for games to be run at 30 frames per second or more.

Game Loop - The game loop contains code that performs event handling, updates the game world's state, and draws the game world's state to the screen. This is done many times a second.

Game State - The entire collection of values that make up the game world. This can include information about the player's character, which pieces are on a board, or the score and level number.

Graphical User Interface - A program that displays graphics to the user for output and can accept keyboard presses and mouse clicks for input.

GUI - See, Graphical User Interface.

Immutable - Not changeable or modifiable. In Python, list values are mutable and tuple values are immutable.

Interactive Shell - A program (part of IDLE) that executes Python instructions one at a time. The interactive shell is a good way to experiment with what a line of code does.

Interpreter - The software that executes instructions written in the Python programming language. On Windows, this is python.exe. When someone says, "Python runs this program", they mean "the Python interpreter software runs this program."

Magic Numbers - Integers or floating-point values used in a program without explanation. Magic numbers should be replaced by constant variables with descriptive names to increase readability.

Main Loop - See, Game Loop.

Member Variable - See, Attributes.

Modulus Operator - In Python, the modulus operator is the % sign. It performs "remainder" arithmetic. For example, since 22 / 7 is "3 remainder 1", then 22 % 7 is 1.

Multidimensional - Having more than one dimension. In Python, this usually refers to when a list contains another list, or a dictionary contains a tuple (which in turn could contain other lists, tuples, or dictionaries).

Mutable - Changeable or modifiable. In Python, list values are mutable and tuple values are immutable.

Pi - The number of diameter lengths of a circle that can fit along the outside circumference. Pi is the same number no matter what the size of the circle is. This value is available in the math module as math.pi, which is the float value 3.1415926535897931.

Pixels - Stands for "picture element". A pixel is a single square of color on the computer screen. The screen is made up of hundreds of thousands of pixels which can be set to different colors to form an image.

Points - A point in Python is usually represented as a tuple of two integers (or float values) to represent the X and Y coordinates of a position on a 2D surface.

Properties - See, Attributes.

Real-time - A program that runs continuously and does not wait for the player to do something is said to run in real-time.

Recursive Call - The function call in a recursive function that calls that same function.

Recursive Function - A function that calls itself.

Refresh Rate - The frequency that the computer screen updates its image. A high or fast refresh rate will make animations appear smoothly, while a low or slow refresh rate will make animation look choppy. Refresh rate is measured in FPS or hertz (which mean the same thing).

RGB Values - An RGB value is an exact value of a particular color. RGB stands for red, green blue. In Pygame, an RGB value is a tuple of three integers (all between 0 and 255) which represent the amount of red, green, and blue are in the color.

Shell - See, Interactive Shell.

Sine - A mathematical function that produces a wavey line when drawn on a graph. Python has a sine function in the math module: math.sin().

Sprites - A name given for a picture of something. Games commonly have a sprite for each kind of object in the game.

Stack Overflow - An error caused when a recursive function does not have a base case.

Syntactic Sugar - A bit of code that is written to make the program more readable, even though it isn't necessary for the program to work.

Tile Sprites - Tiles are a kind of sprite designed to be drawn on a 2D grid. They are usually images of the background, such as floors or walls.

Title Bar - The bar along the top of programs that usually contain the program's caption and close button. The style of the title bar varies between operating systems.

X-axis - The horizontal arrangement of numbers used in cartesian coordinate systems. The X coordinates get smaller going to the left and larger going to the right.

Y-axis - The vertical arrangement of numbers used in cartesian coordinate systems. The Y coordinates get smaller going up and larger going down (This is the opposite of how the Y-axis works in mathematics).

< Лекция 10 || Лекция 11