Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  wxErlang: timeout when drawing

Skully
Posted: Mon May 02, 2011 3:50 pm Reply with quote
Joined: 21 May 2007 Posts: 8
Hi!

I am trying to create a little game with wxErlang.
I have a Panel and some sprites.
Currently the drawing is working like that:

Code:

wx:batch(fun() ->
    Functions = wx:map(fun({_,S}) -> sprite:draw(S) end, Sprites),
    wx:foreach(fun(F) -> F(DC) end, Functions)
  end)

So the panels draw method gets from each Sprite his draw function.
After that it executes each funtion with the current wxDC.

My problem is, that i sometimes get timeouts on the draw method of the sprite when many actions are happening on that sprite.

For example:
rotate sprite with each mouse movement.
After few seconds the application hangs and i get a gen_server timeout for that draw method.

My guess it that the mailbox gets flooded with messages or something.
Each change on a sprite currently calls "refresh" on the panel again, which will execute above code again.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum