| View previous topic :: View next topic |
| Author |
Message |
stef Expert
Joined: 09 Jun 2006 Posts: 117
|
Posted: Fri Jun 30, 2006 6:39 pm Post subject: screen saver apps with HGE |
|
|
How do I create a screen saver app with the HGE software?
Is there a way for me to set it up so that the HGE software will be selected as a screen saver from the display property sheets ?
Or what is the best recommendation for an HGE screen saver?
I have heard that sometimes game makers make screen savers - i'm guessing they might be pretty elaborate. Can someone send me a link to some if you know of any? |
|
| Back to top |
|
 |
MyraMains Site Admin
Joined: 16 Feb 2004 Posts: 242
|
Posted: Fri Jun 30, 2006 9:05 pm Post subject: Re: screen saver apps with HGE |
|
|
making a screensaver with HGE shouldn't be any different than making a screen saver without HGE. Just Google for something like "building screen savers in DirectX". It may take you a few searches but I know there is screensaver code out there _________________
 |
|
| Back to top |
|
 |
stef Expert
Joined: 09 Jun 2006 Posts: 117
|
Posted: Sun Jul 02, 2006 8:44 pm Post subject: is a screen saver just an executable that is executed someho |
|
|
is a screen saver just an executable that is executed somehow ?
Wouldn't I just have to drop it into a specific folder to launch the HGE presentation ? |
|
| Back to top |
|
 |
romamik
Joined: 27 Feb 2006 Posts: 10
|
Posted: Mon Jul 03, 2006 2:31 pm Post subject: |
|
|
Yes, screensaver is just an executable. When Windows runs your screensaver, it launches it with one of three command line options:
/s Start the screensaver in full-screen mode.
/c Show the configuration settings dialog box.
/p #### Display the screensaver preview using #### as the HWND to the parent window.
Also you should quit your application on any user input or when your window looses focus.
Another way is to use scrnsave.lib and the ability to run HGE in a child window. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/scrnsave.asp |
|
| Back to top |
|
 |
stef Expert
Joined: 09 Jun 2006 Posts: 117
|
Posted: Sun Jun 17, 2007 1:48 pm Post subject: |
|
|
I looked up screen savers and found that these are the 3 functions a programmer would have to code to
| Code: |
#include <windows>
#include <scrnsave>
#pragma comment(lib, "scrnsave.lib")
/*
If using Dev-C++ in the pragma comment change 'scrnsave.lib'
to 'libscrnsave.a' without the quotes.
*/
LRESULT WINAPI ScreenSaverProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_PAINT:
break;
default:
return DefScreenSaverProc(hwnd, message, wParam, lParam);
}
return 0;
}
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
return FALSE;
}
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
{
return TRUE;
}
|
I found this info at http://www.osix.net/modules/article/?id=538
A quote on the website says
"There is a true beauty about the scrnsave library, it already has the WinMain function there so you don't need to code that into your screen saver, it registers basically a black background and that's it. That is what our skeleton code does, it's a fully functioning screen saver, but it doesn't have any the razzle dazzle you would usually see. "
So if it has it's own hidden WinMain function and HGE seems to have it's own WinMain function , then what is the technique to connect them together ??
Thanks in advance
Stev |
|
| Back to top |
|
 |
ProfEclipse Expert
Joined: 10 Mar 2005 Posts: 1516 Location: Orlando, FL USA
|
Posted: Mon Jul 02, 2007 6:32 pm Post subject: |
|
|
| stef wrote: | So if it has it's own hidden WinMain function and HGE seems to have it's own WinMain function , then what is the technique to connect them together ??
Thanks in advance
Stev |
I wouldn't use HGE with the screen saver library to do a screensaver. HGE can't do fullscreen mode when running in a child window (although the screensaver library will create a window that fills the screen). Since you don't own the message loop, you won't have control over when you call System_Start (which has to be called every frame when using HGE in a child window). You could try putting a call to System_Start in the WM_PAINT handler followed by a call to InvalidateWindow. That woud continually force a WM_PAINT message. You would also need to do a BeginPaint/EndPaint to convince Windows that the window was updated.
If you don't use the screensaver library, you will need to create an application that parses the command line to detect the different start-up parameters (start screensaver, show config dialog, and start preview mode). For the start screensaver option, initialize HGE in fullscreen mode. For the start preview mode, initialize HGE in a child window using the passed in window handle as the parent window. For the show configuration option, don't initialize HGE, just display your configuration dialog (or a message box if you don't have or want one). |
|
| Back to top |
|
 |
|