Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Piotr_Haratym

screensaver and timing

This topic is 5837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how to make my screensaver prog time independent - there is no main loop, eg i udualy have something like while(1){ if peekmessage{ translate & dispatch }else{ gettime update everything on time that has elapsed from last draw } } but in scr there is only winproc - which translates msg so where should i gettime and make drawing? thnx - and sorry for such a trival question

Share this post


Link to post
Share on other sites
Advertisement
there are 2 way:
1st use the WM_PAIN(T) Message and draw you stuff from there, return 0 instead of break !!! then the WM_PAINT message is send again and again and again ..., but this method is a bit slow i think, compared with method 2:
use a Thread for gfx output, starting it before the message loop and ending it after the loop leaves, the messageloop still checksf if keys are presset ..., but you have to know how threads work


for time do something like:
Init:
LARGE_INTEGER lasttime;
LARGE_INTEGER frequency;
QueryPerformanceCounter(&lasttime);
QueryPerformanceFrequency(&frequency);
frequency.QuadPart/= 1000;//ticks per millisecond

to get delta:
LARGE_INTEGER delta, tmp;
QueryPerformanceCounter(&tmp);

delta.QuadPart= tmp.QuadPart-lasttime.QuadPart;
delta.QuadPart/= frequency.QuadPart;
lasttime.QuadPart= tmp.QuadPart;


i hope i dont have mixed LONGLONG, _int64, LARGE_INTEGER etc..


T2k

[edited by - T2k on May 31, 2002 4:42:58 AM]

Share this post


Link to post
Share on other sites
Screen savers have a WinMain (afterall, they''re just regular windows apps, but with a .scr extension), are you using some sort of helper library to create it?


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
yeah - i'' ve changed the name to*.scr but i get one bug - no textures are beeing loaded - when i click on my typ.scr file everything goes right, but when windows starts it, it doesn'' t load textures - why??

Share this post


Link to post
Share on other sites
yeah - i'' ve changed the name to*.scr but i get one bug - no textures are beeing loaded - when i click on my typ.scr file everything goes right, but when windows starts it, it doesn'' t load textures - why??

Share this post


Link to post
Share on other sites
Probably because the "current directory" when run as a screen saver is different to what you''re expecting. Try using an absolute path to the texture files.


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
I''m currently working on a screensaver with a spinning Logo. I experienced the same problem with textures/objects etc. didn''t load when window started the screensaver.

What I''ve done with the textures is that I use them as resources in the App & load them with LoadBitmap();

Other ''unsupported'' formats are a little bit more tricky, but works good when they''re open.
FindResource()
SizeofResource()
LoadResource()
LockResource() this will return a void* pointer to the actual file data.

Don''t use scrnsave.lib if you plan to change the resoulution.
A WM_CLOSE message will be sent to the app & if you handle it
it''ll just come another one.

Btw. If no command line argument is sent to the screensaver it''s supposed to open a config window.
It''s only supposed to ''save the screen'' when ''/s'' is sent as an argument

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!