Skip to content

Commit 37949c1

Browse files
author
Dodo
committed
Umzug in ein neues Repo auf dem richtigen Account
1 parent c330bb1 commit 37949c1

140 files changed

Lines changed: 5647 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
pythonfoo
22
=========
33

4-
The Main Info git to the pythonfoo Group in Duesseldorf Germany (chaosdorf.de)
4+
python development tests and HowTos from pythonfoo-group
5+
* https://wiki.chaosdorf.de/Pythonfoo
6+
* https://chaosdorf.github.com/pythonfoo/
7+
8+
this is the beginners corner and samples repo
9+
you can find our projects under:
10+
* https://github.com/pythonfoo
11+

beginnerscorner/PySFML/README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# you NEED first:
2+
apt-get install python-sfml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/var/bin/python
2+
3+
# Include the PySFML extension
4+
from PySFML import *
5+
6+
# Create the main window
7+
window = sf.RenderWindow(sf.VideoMode(800, 600), "PySFML test")
8+
9+
# Create a graphical string to display
10+
text = sf.String("Hello SFML")
11+
12+
# Start the game loop
13+
running = True
14+
while running:
15+
event = sf.Event()
16+
while window.GetEvent(event):
17+
if event.Type == sf.Event.Closed:
18+
running = False
19+
20+
# Draw the text, and update the window
21+
window.Clear()
22+
window.Draw(text)
23+
window.Display()
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/var/bin/python
2+
3+
# Include the PySFML extension
4+
from PySFML import *
5+
import time
6+
7+
# Create the main window
8+
window = sf.RenderWindow(sf.VideoMode(800, 600), "PySFML mover ;)")
9+
10+
# Create a graphical string to display
11+
textX = 0
12+
textY = 0
13+
text = sf.String("Hello SFML")
14+
frameRate = sf.String("0")
15+
frameRate.Move(650,5)
16+
# Start the game loop
17+
running = True
18+
19+
fpsTimer = time.time()
20+
fpsCounter = 0
21+
while running:
22+
event = sf.Event()
23+
while window.GetEvent(event):
24+
if event.Type == sf.Event.Closed:
25+
running = False
26+
elif event.Type == sf.Event.KeyPressed:
27+
print event.Key.Code
28+
if event.Key.Code == 291: #left
29+
text.Move(-5,0)
30+
elif event.Key.Code == 292: #right
31+
text.Move(5,0)
32+
elif event.Key.Code == 293: #up
33+
text.Move(0,-5)
34+
elif event.Key.Code == 294: #down
35+
text.Move(0,5)
36+
37+
if (time.time() - fpsTimer) >= 1:
38+
frameRate.SetText(str(fpsCounter) + ' fps')
39+
fpsTimer = time.time()
40+
fpsCounter = 0
41+
# Draw the text, and update the window
42+
window.Clear()
43+
window.Draw(text)
44+
window.Draw(frameRate)
45+
window.Display()
46+
fpsCounter += 1
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/var/bin/python
2+
3+
# Include the PySFML extension
4+
from PySFML import *
5+
import time
6+
7+
# Create the main window
8+
window = sf.RenderWindow(sf.VideoMode(800, 600), "PySFML test")
9+
#window.SetFramerateLimit(60)
10+
11+
# Create a graphical string to display
12+
text = sf.String("Hello SFML")
13+
14+
fps = sf.String("0")
15+
fps.Move(400,0)
16+
fpsCounter = 0
17+
counterTime = time.time()
18+
19+
20+
# Start the game loop
21+
running = True
22+
23+
while running:
24+
25+
fpsCounter +=1
26+
if time.time() - counterTime >=1:
27+
fps.SetText(str(fpsCounter))
28+
fpsCounter = 0
29+
counterTime = time.time()
30+
31+
event = sf.Event()
32+
while window.GetEvent(event):
33+
if event.Type == sf.Event.Closed:
34+
running = False
35+
elif event.Type == sf.Event.KeyPressed:
36+
#http://www.sfml-dev.org/documentation/1.6/namespacesf_1_1Key.php
37+
if event.Key.Code == 291: #left
38+
text.Move(-5,0)
39+
elif event.Key.Code == 292: #right
40+
text.Move(5,0)
41+
elif event.Key.Code == 293: #up
42+
text.Move(0,-5)
43+
elif event.Key.Code == 294: #down
44+
text.Move(0,5)
45+
elif event.Key.Code == sf.Key.Q: #lefrrot q
46+
text.Rotate(-5)
47+
elif event.Key.Code == sf.Key.E: #rightrot e
48+
text.Rotate(+5)
49+
print event.Key.Code
50+
51+
# Draw the text, and update the window
52+
window.Clear()
53+
window.Draw(fps)
54+
window.Draw(text)
55+
window.Display()
56+
39.1 KB
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/var/bin/python
2+
3+
# Include the PySFML extension
4+
from PySFML import *
5+
6+
# Create the main window
7+
window = sf.RenderWindow(sf.VideoMode(800, 600), "PySFML test")
8+
9+
# Create a graphical string to display
10+
text = sf.String("BMP SFML")
11+
12+
13+
window.SetFramerateLimit(60)
14+
15+
running = True
16+
17+
texture = sf.Image()
18+
texture.LoadFromFile("test.png")
19+
sprite = sf.Sprite(texture)
20+
# Start the game loop
21+
running = True
22+
while running:
23+
event = sf.Event()
24+
while window.GetEvent(event):
25+
if event.Type == sf.Event.Closed:
26+
running = False
27+
28+
29+
# Draw the text, and update the window
30+
window.Clear(sf.Color.Blue)
31+
window.Draw(sprite)
32+
window.Draw(text)
33+
window.Display()
39.1 KB
Binary file not shown.
1.61 KB
Loading
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/var/bin/python
2+
3+
# Include the PySFML extension
4+
from PySFML import *
5+
6+
# Create the main window
7+
window = sf.RenderWindow(sf.VideoMode(800, 600), "PySFML test")
8+
9+
# Create a graphical string to display
10+
text = sf.String("PNG SFML")
11+
12+
13+
window.SetFramerateLimit(60)
14+
15+
running = True
16+
17+
texture = sf.Image()
18+
texture.LoadFromFile("test.png")
19+
text = sf.Sprite(texture)
20+
# Start the game loop
21+
running = True
22+
23+
24+
while running:
25+
event = sf.Event()
26+
while window.GetEvent(event):
27+
if event.Type == sf.Event.Closed:
28+
running = False
29+
30+
elif event.Type == sf.Event.KeyPressed:
31+
#http://www.sfml-dev.org/documentation/1.6/namespacesf_1_1Key.php
32+
if event.Key.Code == 291: #left
33+
text.Move(-5,0)
34+
elif event.Key.Code == 292: #right
35+
text.Move(5,0)
36+
elif event.Key.Code == 293: #up
37+
text.Move(0,-5)
38+
elif event.Key.Code == 294: #down
39+
text.Move(0,5)
40+
elif event.Key.Code == sf.Key.Q: #lefrrot q
41+
text.Rotate(-5)
42+
elif event.Key.Code == sf.Key.E: #rightrot e
43+
text.Rotate(+5)
44+
print event.Key.Code
45+
elif event.Type == 10:
46+
print event.MouseMove.X
47+
x = event.MouseMove.X
48+
print event.MouseMove.Y
49+
y = event.MouseMove.Y
50+
print "----------------"
51+
text.SetPosition(x,y)
52+
else:
53+
print event.Type
54+
55+
56+
57+
# Draw the text, and update the window
58+
window.Clear(sf.Color.Blue)
59+
window.Draw(text)
60+
window.Draw(text)
61+
window.Display()
62+
63+

0 commit comments

Comments
 (0)