开发者

GLib - main event loop in C++

开发者 https://www.devze.com 2023-01-17 01:37 出处:网络
I need to implement my own main event loop in C++ which will be based on GLib library. I don\'t know where to begin. I studied s开发者_如何学Come materials about GLib, but it doesn\'t help me to know,

I need to implement my own main event loop in C++ which will be based on GLib library. I don't know where to begin. I studied s开发者_如何学Come materials about GLib, but it doesn't help me to know, how implement event loop. Could somebody give me some advise about it or give me some source code? I basically need to implement GSource and GSourceFuncs from GLib. Event loop should be platform independent, but my application will be run on Android. I can't find how event loop is implemented in Android, could somebody explain it to me too? Thanks a lot.

Lukas


This sounds like a difficult project. You should probably start by studying the glib source code. Most main loops are similar: your program turns over control to them, and they call functions ("callbacks" or "event handlers" in your program when certain events occur.

Do you need to write a glib-based main loop that will integrate with the Android main loop? Why C++? Are you planning to compile it with the Android NDK? It would be easier to answer your question if you were able to give more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号