From kde-games-devel Sun Aug 26 11:46:31 2001 From: Josef Spillner Date: Sun, 26 Aug 2001 11:46:31 +0000 To: kde-games-devel Subject: Re: [Kde-games-devel] Creating fast action games for KDE X-MARC-Message: https://marc.info/?l=kde-games-devel&m=99882774227682 On Saturday 25 August 2001 22:08, Jarkko Parviainen wrote: > else{ > UpdateHighPrecisionTimer( DeltaTime ) > DoGameLogic( DeltaTime ) > RenderFrame() When I ported a 3D scene graph from Windows to platform-independent code with OpenGL some months ago, I also had to deal with delta time. Remove it, it's ugly :-) > I need a way of doing a similar thing for KDE-applications. What i've found > so far seem to be message-based, which really isn't a good solution for a > fast paced action game, as it would kill the frame rate. You could use a QTimer, setting it to the FPS you want to, or you call updateGL() within a main loop, although this is a bit trickier because it blocks everything else, so to catch key events another call is needed - _X11processEvents or what it was called. I always used the first method. It also depends whether it's going to be a fullscreen game or a windowed one, or if there's the ability to switch between both modes. Also you must go sure to not invoke any update event while another one is still active, this leads to silent and undefined crashes in the Qt code. > I'm currently using kDevelop 1.4, QT and opengl for development, if someone > wants to know. I'm going to create the engine (well most of the code i can > port from my previous 3D-Engine) as a widget, which seems to be a decent > solution, but if any of you have a better idea or any suggestions on actual > implementation, let me know. You shouldn't bind the OpenGL code to the widget. It can be executed anywhere as long as there's at least one GL context present. This gives you the ability to have multiple views, like QCanvas does for 2D scenes. I have once seen a game where every component (C++ objects) had a virtual drawing method, so it was easy to create both a 2D and a 3D view of the same code. Josef -- The MindX Open Source Project: Fighting proprietary games GGZ now! - The GGZ Gaming Zone: http://ggz.sourceforge.net ggz.morat.net | ggz.snafu.de | jzaun.com | mindx.sourceforge.net/europeone _______________________________________________ Kde-games-devel mailing list Kde-games-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/kde-games-devel