Crystal Space
Welcome, Guest. Please login or register.
September 02, 2014, 01:39:54 pm

Login with username, password and session length
Search:     Advanced search
9009 Posts in 2043 Topics by 8378 Members
Latest Member: Gwenlode
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Question about csDefaultRunLoop
« previous next »
Pages: [1] Print
Author Topic: Question about csDefaultRunLoop  (Read 2272 times)
mark
Full Member
***
Posts: 101


View Profile
« on: October 04, 2005, 01:19:30 pm »

The API says
Quote
You only need to call this function if your application does not otherwise implement its own run-loop. For example, an existing Microsoft Windows-based application will already have a run-loop which processes the Windows event-queue, among other tasks. Such an application should not call this function, since doing so would interrupt the existing run-loop and prevent it from running.

This confueses me: Does this mean that I must not call csDefaultRunLoop() or csApplicationFramework::Run() in my cs-application on Windows? Or is this for MFC/.net code only?
Logged

Gentoo Linux ~x86, kernel 2.6.11-cko9 smp, gcc 3.4.4-r1, binutils 2.16.1, glibc 2.3.5 NPTL
CS+CEL Pseudo Stable 2005.09.03
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: October 04, 2005, 01:22:40 pm »

The API says
Quote
You only need to call this function if your application does not otherwise implement its own run-loop. For example, an existing Microsoft Windows-based application will already have a run-loop which processes the Windows event-queue, among other tasks. Such an application should not call this function, since doing so would interrupt the existing run-loop and prevent it from running.

This confueses me: Does this mean that I must not call csDefaultRunLoop() or csApplicationFramework::Run() in my cs-application on Windows? Or is this for MFC/.net code only?

You should only not call it if you are trying to integrate CS into an 'EXISTING' windows application. For a normal CS application on windows you should call it like usual.

Greetings,
Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #2 on: October 05, 2005, 11:29:58 am »

The general rule is:

(1) If you are embedding CS into an existing application, don't use the default run-loop. An existing application written with MFC, .NET, or wxWidgets is a good example of when this rule applies since you will be embedding CS into that application which already has its own run-loop.

(2) If your application is not an action game, don't use the default run-loop. The default run-loop tries to maximize your application's CPU time, which is important for action games. Unfortunately, this also starves out other running applications. If your application is, for instance, turned-based or just does some other sort of not-real-time rendering, then you should avoid consuming the CPU. Instead, use the run-loop built into a toolkit, such as MFC, .NET, or wxWidgets which is CPU-friendly.

(3) If you are writing a new action-based game using purely CS API, then feel free to use the default run-loop as a convenience. A benefit of the default run-loop is that it is specially coded to work correctly on all platforms supported by CS, which means that it saves you from having to do a lot of ugly, low-level, platform-specific run-loop coding. (You may embed other toolkits into this application, but the overall framework is CS-based.)
Logged
mark
Full Member
***
Posts: 101


View Profile
« Reply #3 on: October 06, 2005, 02:59:38 pm »

ok, thanks for the answers.
Out of curiosity: Why is it important to maximize CPU time in action games? Is this only a "trick" to get more ressources from the OS? "Starving out other apps" sounds like increasing the processing priority for the game would do the same thing.
Logged

Gentoo Linux ~x86, kernel 2.6.11-cko9 smp, gcc 3.4.4-r1, binutils 2.16.1, glibc 2.3.5 NPTL
CS+CEL Pseudo Stable 2005.09.03
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #4 on: October 06, 2005, 03:46:07 pm »

ok, thanks for the answers.
Out of curiosity: Why is it important to maximize CPU time in action games? Is this only a "trick" to get more ressources from the OS? "Starving out other apps" sounds like increasing the processing priority for the game would do the same thing.

Action games generally try to be as fast as they can (i.e. fast frames per second). To do that the only thing to do is to just keep on processing as fast as you can. That tends to maximize cpu usage.

Greetings,
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.248 seconds with 16 queries.