Jump to content

Screen Save Program


Recommended Posts

I have been trying to make a screen save that moves an image around the screen.

I got a basic one from code that has been posted on the forums and come up with 2 problems/questions.

#1 how can I get the GUIGetMsg() to read all inputs as this on;y works with the mouse move and the <Esc> key right now.

#2 Is there any way to get this program to work on multi monitors as it only works on the primary display right now.

#include <guiconstants.au3>

Global $IMAGE_HSPEED = 1
Global $IMAGE_VSPEED = 1
Global $IMAGE_X     = 25
Global $IMAGE_Y     = 25
Global Const $IMAGE_WIDTH = 200
Global Const $IMAGE_HEIGHT = 100
Global Const $MAX_X       = @DesktopWidth
Global Const $MAX_Y       = @DesktopHeight
GLobal Const $MIN_X       = 0
Global Const $MIN_Y       = 0
GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
Global $IMAGE = GUICtrlCreatePic("logo.jpg", $IMAGE_X, $IMAGE_Y, $IMAGE_WIDTH, $IMAGE_HEIGHT)
GUISetBkColor(0x010080)
GUISetState()
while (GUIGetMsg() = 0)
    UpdateSprites()
    ControlMove("", "", $IMAGE, $IMAGE_X, $IMAGE_Y)
WEnd

Func UpdateSprites()
    $IMAGE_X += $IMAGE_HSPEED
    $IMAGE_Y += $IMAGE_VSPEED
    if ($IMAGE_X >= ($MAX_X-$IMAGE_WIDTH)) Then $IMAGE_HSPEED *= -1
    if ($IMAGE_X <= ($MIN_X)) Then $IMAGE_HSPEED *= -1
    if ($IMAGE_Y >= ($MAX_Y-$IMAGE_HEIGHT)) Then $IMAGE_VSPEED *= -1
    if ($IMAGE_Y <= ($MIN_Y)) Then $IMAGE_VSPEED *= -1
EndFunc

post-30800-1199740703_thumb.jpg

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...