Hello!
I finally can build PySFML
, so, I started playing with it, but Oh Lord!, I can't make appears a simple text in the game window, here is the code:
#!/usr/bin/python2
#-*- coding: utf-8 -*-
import sfml
window = sfml.RenderWindow(sfml.VideoMode(640, 480),
"Dibujando una imagen en SFML")
window.framerate_limit = 60
running = True
texture = sfml.Texture.load_from_file("mog.png")
sprite = sfml.Sprite(texture)
letra = sfml.Font()
print letra.DEFAULT_FONT
texto = sfml.Text("Hola mundo!", letra, 50)
texto.color = sfml.Color.BLACK
print texto.string
while running:
for event in window.iter_events():
if event.type == sfml.Event.CLOSED:
running = False
if event.type == sfml.Event.KEY_PRESSED:
if sfml.Keyboard.is_key_pressed(sfml.Keyboard.W):
sprite.y -= 10
if sfml.Keyboard.is_key_pressed(sfml.Keyboard.S):
sprite.y += 10
if sfml.Keyboard.is_key_pressed(sfml.Keyboard.A):
sprite.x -= 10
if sfml.Keyboard.is_key_pressed(sfml.Keyboard.D):
sprite.x += 10
window.clear(sfml.Color.WHITE)
window.draw(sprite)
window.draw(texto)
window.display()
window.close()
what I'm doing wrong?