Hi guys.I'd like to make a simple web interface to controlling a cocos app. I'm having a hard time figuring out how to handle events and threading. I'm using the director interface and it's working perfectly on its own!Let's say that at a basic level I'd like to be able to "emit a signal" that can be captured by my app (next scene, previous scene, etc.). Is there a good way to handle this without hacking the director interface? I've already tried sharing instances between threads (for the purpose of calling methods directly) but this doesn't work. Would I be able to register events and generate them from another thread that would be captured by the cocos app? Ideally I'd like to use Flask for the API but since it has its won blocking .run() call I'd need it to be in its own thread.What do you guys think? Thanks!Blaine--
Thanks. Getting close! I figured out how to actually talk with the main thread, but the framebuffer refuses to update. I made a new issue. Any ideas?Maybe I'm doing inter-process communication incorrectly, but at least I am succeeding in getting messages to get passed to the right instance. Now it's a matter of getting pyglet/cocos to update the framebuffer. At least I think that's the case.
Thank you. I actually figured out how to do non-threading with flask and gevent so I'm exploring that route. I do indeed have cocos in the main thread (learned that very quickly). I'll post the full solution here if I can get it working.The idea is to use HTTP to control cocos (no html needed). So if I browse to localhost:5000/next/, flask picks up on that, issues a transition to the next scene via the director interface, and all is good. Unfortunately the main problem with my original solution is that the openGL window didn't update.The main problem here (with the different threads) is that my Cocos window / Pyglet Window also does not update if I move a window in front of it.
That may be a problem with my window manager from what I've read? Im on Mint Linux, based on Ubuntu 12.04 (I think). Does anyone else have a problem with the window not redrawing when it gets covered by another window? I'm even manually calling window.on_expose() but it isn't working.
--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.To post to this group, send email to cocos-...@googlegroups.com.
To unsubscribe from this group, send email to cocos-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.