forked from akademikbilisim/ab2015-python-oyun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.py
More file actions
28 lines (20 loc) · 727 Bytes
/
events.py
File metadata and controls
28 lines (20 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
import sfml as sf
WIDTH = 640
HEIGHT = 480
TITLE = "Python SFML Events"
window = sf.RenderWindow(sf.VideoMode(WIDTH, HEIGHT), TITLE)
while window.is_open:
for event in window.events:
if type(event) is sf.CloseEvent:
window.close()
if type(event) is sf.MouseMoveEvent:
print("Fare hareket etti! %s" % event.position)
if type(event) is sf.KeyEvent:
if event.released and event.code is sf.Keyboard.ESCAPE:
print("ESC'ye basıldı!")
window.close()
if not event.released and event.code is sf.Keyboard.W:
print("W tuşuna basılıyor!")
window.clear()
window.display()