- General Information
- Installers and Installation Instructions
- Example Programs
- Example Sprite
- License Information
- Reference to PScreen Functions
PScreen is a Python module that provides simple 2D drawing functions as well as mouse and keyboard I/O. So why use PScreen when there are many other APIs out there?
Simplicity. PScreen lets you do more with less. PScreen is small and concise. With PScreen you can draw on the screen, handle keyboard and mouse input, play sounds and music with less lines of code.
Great for learners. With PScreen you can learn by example! Our simple code samples show you how to use PScreen by example.
Small amount of code. It does not have hundreds of thousands of lines of code for things you won't use anyway. The core is kept simple, and extra things like GUI libraries, and effects are developed separately outside of pygame.
Portable. PScreen runs on Windows, Linux and Mac OS X!
Pygame. PScreen is built on pygame. After mastering PScreen, you will be ready to dig in and create even more advanced games.
Download the full PScreen installer and run it. Alternatively, if the pyglet and pygame libraries are already installed on your computer, you can download just the individual installer for PScreen. Pygame and pyglet can also be obtained from www.pygame.org and www.pyglet.org, respectively.
|Includes the PScreen module and also the pygame/pyglet libraries.|
|Includes just the PScreen module.|
|Demonstrates simple key input and movement.|
|Demonstrates various shapes and alpha blending/transparency.|
|Demonstrates mouse movement and collision (requires the sprite below in order to run).|
Click to download this sprite that can be used in your own games. Put it in the same directory as your Python script to use this with the sprite manipulation functions.
© 2004 - 2009 Yost Engineering Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|LoadScreen||LoadScreen(resolution=(800, 600), fullscreen=False, selectedBackend="pygame"): Initialize the window. The possible choices for selectedBackend are "pygame-basic", "pygame", and "pyglet".|
|ClearScreen||ClearScreen(color=(255, 255, 255, 255)): Fill the entire screen with the specified color. Should be placed at the top of the game loop.|
|UpdateScreen||UpdateScreen(): Update the contents of the window. Should be placed at the end of the game loop.|
|UnloadScreen||UnloadScreen(): Unload the screen and all associated resources.|
|PixelSet||PixelSet(x, y, color=(255, 255, 255, 255)): Color in the pixel at the specified position.|
|PixelGet||PixelGet(x, y): Return a tuple describing the color at the specified position.|
|Line||Line(x1, y1, x2, y2, color=(255, 255, 255, 255), linewidth=1): Draw a line from (x1, y1) to (x2, y2).|
|Rectangle||Rectangle(x1, y1, x2, y2, color=(255, 255, 255, 255), linewidth=1): Draw a rectangle using (x1, y1) and (x2, y2) as two corners. If linewidth is zero, the rectangle will be filled.|
|Triangle||Triangle(x1, y1, x2, y2, x3, y3, color=(255, 255, 255, 255), linewidth=1): Draw a triangle using (x1, y1), (x2, y2) and (x3, y3) as the corners. If linewidth is zero, the triangle will be filled.|
|Circle||Circle(x, y, r, color=(255, 255, 255, 255), linewidth=1): Draw a circle at position (x, y) with radius r. If linewidth is zero, the circle will be filled.|
|Ellipse||Ellipse(x, y, w, h, color=(255, 255, 255, 255), linewidth=1): Draw an ellipse at position (x, y) with width w and height h. If linewidth is zero, the ellipse will be filled.|
|KeyIsPressed||KeyIsPressed(key): Returns true if this key is currently pressed. key can be a string; for example, "a", "return", and "escape" are all valid.|
|KeyIsNotPressed||KeyIsNotPressed(key): Returns true if this key is NOT currently pressed.|
|KeyGetPressedList||KeyGetPressedList(): Return a list of currently pressed keys.|
|MouseGetButtonL||MouseGetButtonL(): Returns True if the left mouse button is held down.|
|MouseGetButtonR||MouseGetButtonR(): Returns True if the right mouse button is held down.|
|MouseGetButtonM||MouseGetButtonM(): Returns True if the middle mouse button is held down.|
|MouseGetX||MouseGetX(): Returns the x position of the mouse.|
|MouseGetY||MouseGetY(): Returns the y position of the mouse.|
|MouseGetPosition||MouseGetPosition(): Returns a tuple containing the x and y positions of the mouse.|
|MouseGetButtons||MouseGetButtons(): Returns a 3-element tuple describing the state of each mouse button, such as (left, middle, right). Each element will be True or False.|
|FontSelect||FontSelect(fontName="Arial", fontSize="24"): Set the current font. Must be done prior to rendering text.|
|FontWrite||FontWrite(x, y, text, color=(255, 255, 255, 255)): Draw text at the specified position. Currently, the alpha value (the last color parameter) is not supported in pygame.|
|MusicLoad||MusicLoad(filename): Load filename as the current background music. Multiple formats are supported, including .mp3, .wav, and .ogg.|
|MusicPlay||MusicPlay(): Play the currently loaded background music.|
|MusicPause||MusicPause(): Pause the currently playing background music.|
|MusicUnPause||MusicUnPause(): Unpause the currently loaded background music.|
|MusicFade||MusicFade(seconds): Fade out the currently playing background music over the given time.|
|MusicSetVolume||MusicSetVolume(volumePercent=40): Set the volume of the currently loaded background music.|
|MusicGetVolume||MusicGetVolume(): Return the volume of the currently loaded background music.|
|MusicStop||MusicStop(): Stop the currently playing background music.|
|SoundLoad||SoundLoad(filename, slot): Load the specified sound into one of 256 slots (slot should be 0 - 255).|
|SoundPlay||SoundPlay(slot): Play the sound stored in the given slot.|
|SoundStop||SoundStop(slot): Stop the sound stored in the given slot.|
|SoundSetVolume||SoundSetVolume(slot, volumePercent): Set the volume of the sound in the given slot.|
|SpriteLoad||SpriteLoad(filename, slot): Load the specified sprite into one of 256 slots (slot should be 0 - 255).|
|SpriteRender||SpriteRender(x, y, slot, rotation=0, scale=1, flipH=False, flipV=False, alpha=255): Render the sprite in the specified slot at the specified position. Rotation specifies a counterclockwise rotation in angles; scale specifies a scaling factor in both dimensions; flipH and flipV flip the sprite horizontally and vertically, respectively. The alpha parameter is not currently supported in pygame.|
|SpriteSimpleRender||SpriteSimpleRender(x, y, slot): A simpler, quicker method of rendering a sprite.|
|SpriteWidth||SpriteWidth(slot): Return the width of the sprite in the specified slot.|
|SpriteHeight||SpriteHeight(slot): Return the height of the sprite in the specified slot.|
Frame Rate Functions
|FrameGetLimit||FrameGetLimit(): Returns the current frames per second.|
|FrameSetLimit||FrameSetLimit(fps): Cap the framerate at the specified frames per second.|
FrameDelay(): Ticks the internal clock object; this should be called during every iteration of the game loop. The function returns a value that indicates the amount of time elapsed since the last update.