Re: [Dev-C++] Offtopic: Advice on GUI to learn
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Michael C U. <mu...@cb...> - 2004-01-17 01:46:15
|
On Fri, 16 Jan 2004, Daniel K. O. wrote: > The idle funcs have low priority by default, your thread could call > gtk_idle_add a million times, and if the GUI is still busy with other > things, the idle funcs will wait. True. This works. But its pretty old fashioned and not nearly as responsive as doing the update in a seperate thread. Generally, this is how we used to do things before Windows had preemptive multitasking. But now that we have preemptive multitasking, we don't like to use idle methods anymore. As an example, in Petzold's book, Programming Microsoft Windows (the Bible on the Windows API), there is a program that draws random rectangles on the screen as fast as the computer can draw them. The example uses the PeekMessage function to only draw when the application is otherwise idle. However, if you move the mouse cursor through the random rectangle frame, it is noticably sluggish as the random rectangle loop runs between the firing of mouse events. Later in the book, the same program appears again, but this time using a seperate thread to draw the rectangles. If you try both examples, I think you find that the threaded version is more responsive than the version that uses PeekMessage(). Then they all will run; or you can > just change their priority, calling gtk_idle_add_full, giving them more > priority, for example, depeinding what you want. I don't think you can > freely define this behavior in a log of GUI toolkits. > > > >Animation and VR simulations that require rapid repainting of the display > >are another area where you often don't want to tie up the main thread by > >forcing it to handle the paint requests and such. The application can > >become extremely unresponsive if the main thread has to handle such paint > >intensive tasks. > > > > Yeah, this really seems a problem. > But GTK+ isn't intended for intensive repainting, like VR and > Animations. You can use something like GtkGLExt, or GtkSDL, or something > else, and plug this extra widget into your application. To manipulate > their content you won't need to use Gtk+ API calls, you'll use > SDL_BlitSurface, glVertex, etc. They should work fine when running from > another thread. > > > > Daniel K. O. > > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |