Jump to content
Sign in to follow this  

Would This Make A Cool Screen Saver?

Recommended Posts

It's a buggy, ugly, and nasty proof of concept at this stage. Tell me what ya'll think.

newest version

Worked out the double buffer by looking at these examples by UEZ: (http://www.autoitscript.com/forum/index.php?showtopic=87200&st=0&p=625623&#entry625623)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ #include <HandyFunctions.au3>
#include <array.au3>

HotKeySet("{ESC}", "_terminate")


Global $DW = @DesktopWidth, $DH = @DesktopHeight, $penWidth = 5, $penColor, $brushColor
Global $X, $Y, $color, $circleWidth = 1000, $radius = $circleWidth / 2, $XYBound = $penWidth + 5

Global $GUI = GUICreate("ScreenSaver", $DW, $DH, 0, 0, $WS_POPUP)



Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($GUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($DW, $DH, $hGraphics)
Global $backBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Global $hPen = _GDIPlus_PenCreate(0x77000000, $penWidth)
Global $hBrush = _GDIPlus_BrushCreateSolid()

;~ _GDIPlus_GraphicsClear($backBuffer)

    $color = _Color()
    $brushColor = _Color()

    $X = Random($XYBound, $DW - $XYBound, 1)
    $Y = Random($XYBound, $DH - $XYBound, 1)

    If $X < $Y Then
        $circleWidth = $DH - $Y
        $circleWidth = $DW - $X

    For $i = $penWidth To $circleWidth Step $penWidth
;~      Sleep(1)

    For $i = $circleWidth To $penWidth Step -$penWidth
;~      Sleep(1)


Func _drawCircle()
    _GDIPlus_GraphicsClear($backBuffer, $color)
    _GDIPlus_BrushSetSolidColor($hBrush, $brushColor)
    _GDIPlus_PenSetColor($hPen, $brushColor)
    _GDIPlus_GraphicsFillEllipse($backBuffer, $X, $Y, $i, $i, $hBrush)
    _GDIPlus_GraphicsDrawEllipse($backBuffer, $X, $Y, $i, $i, $hPen)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $DW, $DH)
EndFunc ;==>_drawCircle

Func _Color()
    Local $hexColor = "0xFF" & Hex(Random(0, 255, 1) & Random(0, 255, 1) & Random(0, 255, 1), 6)

    If $hexColor = 0xFF000000 Then
        Return $hexColor
EndFunc ;==>_backGroundColor

Func _endGDI()
EndFunc ;==>_endGDI

Func _terminate()
    Exit (0)
EndFunc ;==>_terminate
Edited by jaberwocky6669

Share this post

Link to post
Share on other sites
  • The circle flickers to much, it hurts my eyes. Take a look at the GDI+ scripts that float around and see what they do to avoid that.
  • What MvGulik said. It's pretty annoying with the quick color jumps, some fading would be nice.
Edited by AdmiralAlkex

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...