forked from akademikbilisim/ab2015-python-oyun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathliveinput.py
More file actions
31 lines (21 loc) · 793 Bytes
/
liveinput.py
File metadata and controls
31 lines (21 loc) · 793 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
29
30
31
# -*- coding: utf-8 -*-
import sfml as sf
WIDTH = 640
HEIGHT = 480
TITLE = "Python SFML Live Input"
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()
pos = sf.Mouse.get_position(window)
# print("Farenin anlık pozisyonu {0}".format(pos))
if sf.Keyboard.is_key_pressed(sf.Keyboard.SPACE):
print("SPACE tuşuna basılıyor!")
if sf.Keyboard.is_key_pressed(sf.Keyboard.M):
pos = sf.Mouse.get_position()
print("Farenin ekrandaki pozisyonu {0}".format(pos))
if sf.Keyboard.is_key_pressed(sf.Keyboard.W):
print("M ve W birlikte basılıyor!")
window.clear(sf.Color.BLACK)
window.display()