2
« on: April 04, 2010, 07:56:22 am »
Version of SFML is 1.4
Platform is Ubuntu 9.04
Binding is Python
The problem is if I create two windows and call the GetEvent function for each the program corrupts something internally.
The error is this:
*** glibc detected *** python: corrupted double-linked list: 0x09eb17f0 ***
This occurs after I have resized each window independently to test the resizing of the views.
Here is the code:
# Include the PySFML extension
from PySFML import sf
# background color
bgroundclr = sf.Color(127, 64, 64)
# Create the main window
window = sf.RenderWindow(sf.VideoMode(800, 600), "Kid's Game")
stats = sf.RenderWindow(sf.VideoMode(400, 400), "Kid's Game Stats")
# Create a graphical string to display
text = sf.String("Hi Kids!")
#windowsize = sf.String("%d %d" %(window.GetWidth(),window.GetHeight()))
# Start the game loop
running = True
while running:
event = sf.Event()
while window.GetEvent(event):
if event.Type == sf.Event.Closed:
running = False
if event.Type == sf.Event.Resized:
wview = window.GetView()
wview.SetCenter(event.Size.Width/2, event.Size.Height/2)
wview.SetHalfSize(event.Size.Width/2, event.Size.Height/2)
window.SetView(wview)
while stats.GetEvent(event):
if event.Type == sf.Event.Resized:
wview = stats.GetView()
wview.SetCenter(event.Size.Width/2, event.Size.Height/2)
wview.SetHalfSize(event.Size.Width/2, event.Size.Height/2)
stats.SetView(wview)
# Clear screen, draw the text, and update the window
window.Clear(bgroundclr)
stats.Clear(bgroundclr)
tcenter = text.GetCenter()
xpos = window.GetWidth()/2 - text.GetRect().GetWidth()/2
ypos = window.GetHeight()/2 - text.GetRect().GetHeight()/2
text.SetPosition(xpos, ypos)
window.Draw(text)
windowsize = sf.String("%d %d" % (window.GetWidth(),window.GetHeight()))
#postxt = sf.String("%d %d" % (text.GetRect().GetWidth(),text.GetRect().GetHeight()))
scale = text.GetSize()
postxt = sf.String("%d %d %d" % (xpos,ypos,scale))
postxt.SetPosition(0,100)
stats.Draw(windowsize)
stats.Draw(postxt)
window.Display()
stats.Display()