Jump to content

Starfield screensaver


Lazycat
 Share

Recommended Posts

Great work Lazycat and Blindwig

Here is my improvment:

As true screensaver it should end itself at any mouse/keyboard activity (also mouse click).

So this kode in main loop do this:

$keys = _Keys()
    While not $gDone
        ...
        Sleep(50 - $gSpeed)
        If _Keys() <> $keys Then $gDone = 1
    WEnd

Func _Keys()
    $struct = DllStructCreate ("byte[256]")
    DllCall("user32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr ($struct))
    $ret = ''
    For $i = 0 to 256
        $ret &= DLLStructGetData($struct,1,$i)
    Next
    Return $ret
EndFunc

Only problem is with starting: it's so quick that keybord state of mouse click/Enter after start is not released yet and app is ended immediatelly.

So there should be some time delay after start before testing KeyboardState.

Edited by Zedna
Link to comment
Share on other sites

Only problem is with starting: it's so quick that keybord state of mouse click/Enter after start is not released yet and app is ended immediatelly.

So there should be some time delay after start before testing KeyboardState.

I've written program that had that issue before. Instead of a static delay, wait until there is no input:

Pseudo-code:

;Wait for no movement
While MouseMovement() or KeysPressed()
  Sleep(50)
Wend

;Main Loop, until movement
While Not MouseMovement() or KeysPressed()
  ...
Wend
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...