<trisiak>
here is the code that is supposed to read mouse position 10 times in a second
<trisiak>
but the problem is that it reads the position once and then is coping result for the next 9 cycles
<trisiak>
maybe its not sdl specific problem but some kind of misunderstanding ocaml from our side
<tsuyoshi>
I don't see anything wrong with it
<tsuyoshi>
but I've never used sdl
<tsuyoshi>
it looks like if there's something wrong it would be either in get_state or delay
<trisiak>
thx for help
<trisiak>
has anyone made a succesfull attempt with ocamlsdl and can give any working snippets?
<flux->
I have
<flux->
maybe, but it's really simple
<trisiak>
great!
<trisiak>
u can send them to trisiak at gmail.com
<flux->
do you have ocaml experience?
<flux->
I think I prefer irc
<trisiak>
ok
<trisiak>
i am average ocaml programmer :)
<paciek>
newbie i think would be the better word:)
<flux->
let main () = Sdl.init [`EVERYTHING] in let display = Sdlvideo.set_video_mode ~w:640 ~h:480 [] in let rec wait_events () = match Sdlevent.wait_event () with Sdlevent.QUIT -> () | _ -> wait_events () in loop ()
<flux->
it might not work but should give an idea, right?-)
<flux->
and compiling with ocamlfind ocamlc -linkpkg -package sdl -o foo foo.ml
<flux->
oh, now I'm reading the buffer back
<flux->
so you want some more specific knowledge :)
<flux->
I think you want to run an event loop
<flux->
and replace the delay with a thread that makes Sdlevent.User -events
<flux->
so you can wait for the next sdl event
<trisiak>
that is good idea, thx
<flux->
(however the approach has its problems, namely if you fail to perform in the timer interval there will be multiple timer messages in the queue; this can be avoided by counting how many outstanding events you have and by slowing down/stopping the thread when there is more than eg. 1)
<trisiak>
i understand, that won't make big problem
<trisiak>
we just need simple framework that will dispatch events triggered by user
<flux->
trisiak, the solution I'm referring is simply: let rec thread () = try Unix.sleep 100 (* accommodate profiling *) with _ -> () in Sdlevent.add [Sdlevent.USER 0]; thread ()
<flux->
and then the match Sdlevent.wait_event () .. can refer to the same event
<trisiak>
thank you very much, this helps a lot :)
<flux->
too bad ocamlsdl development appears quite dead
<flux->
it is, of course, quite complete
<flux->
but there are some things missing
<flux->
and I haven't been able to check the cvs version due to sourceforges lousy service..
paciek has quit ["using sirc version 2.211+KSIRC/1.3.12"]
love-pingoo has quit [Read error: 104 (Connection reset by peer)]
david_koontz has quit ["Leaving"]
jlouis has quit [Remote closed the connection]
jlouis has joined #ocaml
m3ga has joined #ocaml
<oscarh>
I keep on getting /usr/lib/ocaml/unix.cmxa is not a compilation unit description... What i find on the web is that I should use findlib, which I do...