Update README.md
This commit is contained in:
parent
87301f4d34
commit
d498edaa32
1 changed files with 46 additions and 1 deletions
47
README.md
47
README.md
|
@ -1 +1,46 @@
|
|||
# pygwin
|
||||
# PyGWin
|
||||
A library for creating Python applications.
|
||||
|
||||
[Documentation](https://github.com/themixray/pygwin/wiki)
|
||||
***
|
||||
## Quick Start
|
||||
A simple game.
|
||||
```python
|
||||
import pygwin
|
||||
|
||||
win = pygwin.create('A Simple Game', (500,500))
|
||||
|
||||
x = 250
|
||||
y = 250
|
||||
|
||||
run = True
|
||||
while run:
|
||||
for event in pygwin.getEvents():
|
||||
if event.type == pygwin.QUIT:
|
||||
run = False
|
||||
win.fill((255,255,255))
|
||||
|
||||
win.blit(win.fps,(0,0))
|
||||
win.draw.rect((0,0,0),pygwin.rect(x-10,y-10,20,20))
|
||||
|
||||
if pygwin.keyboard.isPressed('w'):
|
||||
y -= 5
|
||||
if pygwin.keyboard.isPressed('s'):
|
||||
y += 5
|
||||
if pygwin.keyboard.isPressed('d'):
|
||||
x += 5
|
||||
if pygwin.keyboard.isPressed('a'):
|
||||
x -= 5
|
||||
|
||||
if x <= -10:
|
||||
x = 510
|
||||
if y <= -10:
|
||||
y = 510
|
||||
if x > 510:
|
||||
x = -10
|
||||
if y > 510:
|
||||
y = -10
|
||||
|
||||
win.update(60)
|
||||
pygwin.close()
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue