Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Screen Savers
#51
Too bad you aren't Pete, I'd 4 more points by now Big Grin

Glad you liked @madscijr, is this your first visit to my corner of the forum?
b = b + ...
Reply
#52
Probabably? You've done some really cool work @bplus!
Reply
#53
(04-30-2022, 11:55 PM)bplus Wrote: Eye Candy #9B

I've been playing with this one. I added some code so that moving the mouse ends the program, so it can be used as a screensaver, and tried to make it fullscreen.

However there are a couple of things I haven't been able to figure out -

  1. When it ends, it doesn't close, but instead says "press any key to continue". 
    How do you make it just end? 

  2. It isn't really fullscreen, the left and right edges of the screen are just black.
    I tried playing with some settings and the bottom left and right corners were still black. 
    How do you make the image fill the whole screen for a 1080p display? 

Code: (Select All)
' Eye Candy #9B by bplus, Mini-Mod
' 04-30-2022, 07:55 PM (This post was last modified: 04-30-2022, 08:19 PM by bplus.)
' https://qb64phoenix.com/forum/showthread.php?tid=219&pid=1291#pid1291

' INSTRUCTIONS:
' ENTER...............change function
' SPACE...............show/hide function name
' ESC OR MOVE MOUSE...quit
' (any other key).....change colors

' madscijr added Steve's mouse check,
' so when user touches the mouse it closes,
' to use as a screen saver,
' and also modified function Plasma~&
' to use not just SIN but also COS TAN _COT _CSC _SEC
' maybe later we'll experiment with other functions
' (they didn't work by just dropping them in, it will take some studying)
' and added hotkeys to cycle through functions, etc.

' TO DO / ISSUES:
' * Image doesn't fill the whole screen - the bottom
'   left & right corners are black, how do we get the
'   image to fill the whole screen?
' * When program ends, it says "press any key to continue"
'   How do you make that go away so program just ends??

_Title " Eye Candy #9B Closer" ' b+ 2022-03-09
DefDbl A-Z

Const fps = 80
Const cSecondsPerFunction = 30 ' # seconds before next function cycles
Const cMouseDelaySeconds = 5 ' # of seconds before begin checking for mouse
Const cMinFn = 0 ' min value select case checks for in Function Plasma~&
Const cMaxFn = 5 ' max value select case checks for in Function Plasma~&

' KEY CODES FOR _BUTTON
Const KeyCode_Escape = 2
Const KeyCode_Spacebar = 58
Const KeyCode_Enter = 29
Const KeyCode_Up = 329
Const KeyCode_Down = 337
Const KeyCode_Left = 332
Const KeyCode_Right = 334

Dim Shared cN, pR, pG, pB

Dim Shared iFuncNum% ' index of current function select case checks for
Dim Shared FuncName$ ' name of current function
Dim Shared iFunc2%
Dim message$

ReDim colr(-100 To 1000) As _Unsigned Long
Dim iLoop%, iValue%
Dim iFrameCount% ' counts frames
Dim iFramesPerFunction% ' # frames before next function cycles
Dim iFramesBeforeEnableMouse% ' # frames before start checking for mouse
Dim MaxCols%, MaxRows% ' for printing text on screen
Dim OldMouseX, OldMouseY As Integer
Dim bFinished As Integer: bFinished = _FALSE
Dim bTrackMouse As Integer: bTrackMouse = _FALSE
Dim bShowFuncName%: bShowFuncName% = _FALSE
Dim iLastKeyCode%: iLastKeyCode% = 0

' INITIALIZE
iFramesPerFunction% = cSecondsPerFunction * fps
iFramesBeforeEnableMouse% = cMouseDelaySeconds * fps

xmax = _DesktopWidth - 1
ymax = _DesktopHeight - 1
'xmax = 800
'ymax = 600


'Print "xmax=" + _Trim$(Str$(xmax)) + ", ymax=" + _Trim$(Str$(ymax)) : End


Screen _NewImage(xmax, ymax, 32)
_FullScreen
'_ScreenMove 0, 0

' for printing text
MaxCols% = (_Width / _FontWidth) - 1
MaxRows% = (_Height / _FontHeight) - 1

' Center:
xc = xmax / 2
yc = ymax / 2

diag = Sqr(xc * xc + yc * yc)

ReDim colr(-100 To diag + 1000) As _Unsigned Long
p2 = _Pi * 2

iFuncNum% = cMinFn
iFrameCount% = 0

Randomize Timer
While _MouseInput: Wend: OldMouseX = _MouseX: OldMouseY = _MouseY ' initial mouse placement
While 1
    resetPlasma
    For iLoop% = -100 To diag + 1000
        colr(iLoop%) = Plasma~&(iFuncNum%)
    Next iLoop%

    ro = 950
    s = 0
    While ro > -50
        ' PROCESS KEYBOARD INPUT
        While _DeviceInput(1): Wend ' clear and update the keyboard buffer
        If _Button(KeyCode_Escape) Then
            ' ESC = QUIT
            iLastKeyCode% = KeyCode_Escape
            bFinished = _TRUE: Exit While
        ElseIf _Button(KeyCode_Enter) Then
            ' ENTER = CYCLE TO NEXT FUNCTION
            If iLastKeyCode% <> KeyCode_Enter Then
                iFuncNum% = iFuncNum% + 1: If iFuncNum% > cMaxFn Then iFuncNum% = cMinFn
                resetPlasma
                For iLoop% = -100 To diag + 1000
                    colr(iLoop%) = Plasma~&(iFuncNum%)
                Next iLoop%
                iLastKeyCode% = KeyCode_Enter
            End If
        ElseIf _Button(KeyCode_Spacebar) Then
            ' ENTER = SHOW/HIDE FUNCTION NAME
            If iLastKeyCode% <> KeyCode_Spacebar Then
                bShowFuncName% = Not (bShowFuncName%)
                iLastKeyCode% = KeyCode_Spacebar
            End If
        Else
            ' ANY OTHER KEY = CHANGE COLORS
            iLastKeyCode% = 0
            k$ = InKey$: _KeyClear
            If Len(k$) Then Exit While
        End If
        _KeyClear ' CLEAR KEYBOARD BUFFER




        ' Tie dye!
        Cls

        ' SINGLE                  ! or none            -2.802597E-45                  +3.402823E+38                4
        ' DOUBLE                  #                    -4.490656458412465E-324        +1.797693134862310E+308      8
        ' _FLOAT                  ##                   -1.18E-4932                    +1.18E+4932                  32(10 used)
        iTo# = p2 / 64
        iStep# = p2 / (16 * 360)


        'For a = 0 To p2 / 64 Step p2 / (16 * 360)
        For a = 0 To iTo# Step iStep#

            iValue% = 50 * Sin(s) ' 2 * s or just s


            If _TRUE = _FALSE Then
                iValue% = (s / 50) * 25
                iValue% = (s / 500) * 25
                iValue% = (s / 500) * p2 ^ .25
                iValue% = (s / 500) * p2 ^ (a * .25)
                iValue% = (s / 500) * p2 ^ a
                iValue% = (a / 50000) * s ^ (p2 * .25)

                ' EXPERIMENT WITH DIFFERENT VALUES HERE:
                iFunc2% = RandomNumber%(1, 5)

                Select Case iFunc2%
                    Case 1:
                        iValue% = 50 * Sin(s) ' 2 * s or just s
                    Case 2:
                        iValue% = 50 * Cos(s * 1)
                    Case 3:
                        iValue% = 1 * Tan(s * 1)
                    Case 4:
                        iValue% = 1 * _Sec(s * 2)
                    Case 5:
                        iValue% = 1 * _Acos(s * 1)
                    Case Else
                        iValue% = 1 * _Acosh(s * 2)
                End Select


                ' TRY SOME OF THESE...
                iValue% = 50 * Sin(s) ' 2 * s or just s

                iValue% = 50 * Sin(s * 2) ' 2 * s or just s
                iValue% = 50 * Sin(s * 3)
                iValue% = 50 * Sin(s * 4)
                iValue% = 50 * Sin(s * 5)

                iValue% = 50 * Cos(s * 1)
                iValue% = 50 * Cos(s * 2)
                iValue% = 50 * Cos(s * 3)
                iValue% = 50 * Cos(s * 4)
                iValue% = 25 * Cos(s * 5)

                iValue% = 1 * Tan(s * 1)
                iValue% = 1 * Tan(s * 2)

                iValue% = 1 * _Sec(s * 2)

                iValue% = 1 * _Acos(s * 1)
                iValue% = 1 * _Acos(s * 2)
                iValue% = 1 * _Acos(s * 3)
                iValue% = 1 * _Acos(s * 4)
                iValue% = 1 * _Acos(s * 5)

                iValue% = 1 * _Acosh(s * 2)

                iValue% = 1 * _Asin(s * 2)

                iValue% = 1 * _Asinh(s * 2)

                iValue% = 1 * Atn(s * 2)

                iValue% = 1 * _Tanh(s * 2)

                iValue% = 1 * _Atanh(s * 1)
                iValue% = 1 * _Atanh(s * 4)

                iValue% = 1 * _Arccot(s * 1)

                ' STARTED GOING BACKWARDS! BUT CRASHED!
                'iValue% = 1 * _Coth(s * .009)
                'iValue% = 1 * _Coth(s * .008)
                'iValue% = 1 * _Coth(s * .007)
                'iValue% = 1 * _Coth(s * .006)
                'iValue% = 1 * _Coth(s * .005)
                'iValue% = 1 * _Coth(s * .002)
                iValue% = 1 * _Coth(s * .001)

                iValue% = 1 * _Sech(s * .001)
                iValue% = 1 * _Sech(s * .005)
                iValue% = 1 * _Sech(s * .05)
                iValue% = 1 * _Sech(s * .1)
            End If

            ' JUST RESULTS IN WHITE ON WHITE OR BLACK ON BLACK:
            ' _ACOS (function) arccosine function returns the angle in radians based on an input COSine value range from -1 to 1.
            ' _COSH (function) Returns the hyperbolic cosine of x radians.
            ' _ACOSH (function) Returns the nonnegative arc hyperbolic cosine of x, expressed in radians.
            ' _ARCSEC (function) is the inverse function of the secant.
            ' _ARCCSC (function) is the inverse function of the cosecant.
            ' _SINH (function) Returns the hyperbolic sine of x radians.
            ' _ASIN (function) Returns the principal value of the arc sine of x, expressed in radians.
            ' _ASINH (function) Returns the arc hyperbolic sine of x, expressed in radians.
            ' ATN (function) or arctangent returns the angle in radians of a numerical tangent value.
            ' _TANH (function) Returns the hyperbolic tangent of x radians.
            ' _ATANH (function) Returns the arc hyperbolic tangent of x, expressed in radians.
            ' _ARCCOT (function) is the inverse function of the cotangent.

            ' CAUSE ERRORS:
            ' _COTH (function) Returns the hyperbolic cotangent.
            ' _CSCH (function) Returns the hyperbolic cosecant.
            ' _SECH (function) Returns the hyperbolic secant.


            For r = 0 To diag
                PSet (xc + r * Cos(a), yc + r * Sin(a)), colr(r + iValue% + ro)
            Next r
            s = s + p2 / 180
        Next a

        sx1 = xc
        sy1 = yc

        sx2 = xc + diag * Cos(.002)
        sy2 = yc + diag * Sin(.002)

        sx3 = xc + diag * Cos(p2 / 64 - .002)
        sy3 = yc + diag * Sin(p2 / 64 - .002)

        For a = p2 / 64 To p2 - p2 / 64 Step p2 / 64
            dx1 = xc
            dy1 = yc
            dx2 = xc + diag * Cos(a)
            dy2 = yc + diag * Sin(a)
            dx3 = xc + diag * Cos(a + p2 / 64)
            dy3 = yc + diag * Sin(a + p2 / 64)
            _MapTriangle (sx1, sy1)-(sx2, sy2)-(sx3, sy3), source& To(dx1, dy1)-(dx2, dy2)-(dx3, dy3), 0
        Next a

        Line (0, 0)-(xc - 1.5 * yc, _Height), &HFF000000, BF
        Line (xc + 1.5 * yc, 0)-(_Width, _Height), &HFF000000, BF

        ' SHOW THE CURRENT GEOMETRY FUNCTION BEING USED BY Plasma~&
        If bShowFuncName% = _TRUE Then
            Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
            Locate MaxRows% / 2, (MaxCols% / 2) - (Len(FuncName$) / 2)
            Print FuncName$;
        End If

        '' SHOW SOME VALUES FOR DEBUGGING
        'message$ = "iValue% = " + _Trim$(Str$(iValue%))
        'Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
        'Locate MaxRows% / 2, (MaxCols% / 2) - (Len(message$) / 2)
        'Print message$;


        ' Count down to color change
        toggle = 1 - toggle
        If toggle Then _Display
        ro = ro - 1

        ' Cycle through different geometry functions (SIN, COS, TAN, etc.)
        ' after iFramesPerFunction% repetitions (# cycles for the given # seconds)
        iFrameCount% = iFrameCount% + 1
        If iFrameCount% > iFramesPerFunction% Then
            iFrameCount% = 0
            iFuncNum% = iFuncNum% + 1: If iFuncNum% > cMaxFn Then iFuncNum% = cMinFn
            resetPlasma
            For iLoop% = -100 To diag + 1000
                colr(iLoop%) = Plasma~&(iFuncNum%)
            Next iLoop%
        End If

        ' If user moves mouse, quit
        ' NOTE: for some reason we have to wait a couple seconds
        '       before checking for this, or the program just
        '       immediately quits?
        If bTrackMouse = _TRUE Then
            While _MouseInput: Wend
            If OldMouseX <> _MouseX Or OldMouseY <> _MouseY Then
                bFinished = _TRUE
                Exit While ' if the mouse moved, quit
            End If
        Else
            ' We had to delay the mouse move test
            ' because it was always resulting in _TRUE
            ' no idea why?
            If iFrameCount% > iFramesBeforeEnableMouse% Then
                While _MouseInput: Wend: OldMouseX = _MouseX: OldMouseY = _MouseY ' initial mouse placement
                bTrackMouse = _TRUE
            End If
        End If

        _Limit fps
    Wend
    If bFinished = _TRUE Then Exit While
Wend

End

' /////////////////////////////////////////////////////////////////////////////

Function Plasma~& (fn%)
    cN = cN + .2
    Select Case fn%: '
        Case 0:
            FuncName$ = "SIN"
            Plasma~& = _RGB32(127 + 127 * Sin(pR * cN), 127 + 127 * Sin(pG * cN), 127 + 127 * Sin(pB * cN))
        Case 1:
            FuncName$ = "COS"
            Plasma~& = _RGB32(127 + 127 * Cos(pR * cN), 127 + 127 * Cos(pG * cN), 127 + 127 * Cos(pB * cN))
        Case 2:
            FuncName$ = "TAN"
            Plasma~& = _RGB32(127 + 127 * Tan(pR * cN), 127 + 127 * Tan(pG * cN), 127 + 127 * Tan(pB * cN))
        Case 3:
            FuncName$ = "_COT"
            Plasma~& = _RGB32(127 + 127 * _Cot(pR * cN), 127 + 127 * _Cot(pG * cN), 127 + 127 * _Cot(pB * cN))
        Case 4:
            FuncName$ = "_CSC"
            Plasma~& = _RGB32(127 + 127 * _Csc(pR * cN), 127 + 127 * _Csc(pG * cN), 127 + 127 * _Csc(pB * cN))
        Case 5:
            FuncName$ = "_SEC"
            Plasma~& = _RGB32(127 + 127 * _Sec(pR * cN), 127 + 127 * _Sec(pG * cN), 127 + 127 * _Sec(pB * cN))
        Case Else:
            Plasma~& = _RGB32(127 + 127 * Sin(pR * cN), 127 + 127 * Sin(pG * cN), 127 + 127 * Sin(pB * cN))
    End Select
End Function ' Plasma~&

' /////////////////////////////////////////////////////////////////////////////

Sub resetPlasma ()
    pR = Rnd ^ 2: pG = Rnd ^ 2: pB = Rnd ^ 2
End Sub

' /////////////////////////////////////////////////////////////////////////////

Function RandomNumber% (Min%, Max%)
    Dim NumSpread%
    NumSpread% = (Max% - Min%) + 1
    RandomNumber% = Int(Rnd * NumSpread%) + Min% ' GET RANDOM # BETWEEN Max% AND Min%
End Function ' RandomNumber%

' /////////////////////////////////////////////////////////////////////////////
' Geometry functions we tried with Plasma~&:

' PRODUCE COLORS:
' SIN (function) returns the sine of a radian angle.
' COS (function) returns the cosine of a radian angle value.
' TAN (function) returns the ratio of SINe to COSine or tangent value of an angle measured in radians.
' _COT (function) the mathematical function cotangent defined by 1/TAN.
' _CSC (function) the mathematical function cosecant defined by 1/SIN.
' _SEC (function) the mathematical function secant defined by 1/COS.

' JUST RESULTS IN WHITE ON WHITE OR BLACK ON BLACK:
' _ACOS (function) arccosine function returns the angle in radians based on an input COSine value range from -1 to 1.
' _COSH (function) Returns the hyperbolic cosine of x radians.
' _ACOSH (function) Returns the nonnegative arc hyperbolic cosine of x, expressed in radians.
' _ARCSEC (function) is the inverse function of the secant.
' _ARCCSC (function) is the inverse function of the cosecant.
' _SINH (function) Returns the hyperbolic sine of x radians.
' _ASIN (function) Returns the principal value of the arc sine of x, expressed in radians.
' _ASINH (function) Returns the arc hyperbolic sine of x, expressed in radians.
' ATN (function) or arctangent returns the angle in radians of a numerical tangent value.
' _TANH (function) Returns the hyperbolic tangent of x radians.
' _ATANH (function) Returns the arc hyperbolic tangent of x, expressed in radians.
' _ARCCOT (function) is the inverse function of the cotangent.

' CAUSE ERRORS:
' _COTH (function) Returns the hyperbolic cotangent.
' _CSCH (function) Returns the hyperbolic cosecant.
' _SECH (function) Returns the hyperbolic secant.

' OTHER GEOMETRY FUNCTIONS:
' _ATAN2 (function) Returns the principal value of the arc tangent of y/x, expressed in radians.
' _HYPOT (function) Returns the hypotenuse of a right-angled triangle whose legs are x and y.

' OTHER MATH FUNCTIONS:
' _D2R (function) converts degrees to radian angle values.
' _G2R (function) converts gradient to radian angle values.
' _R2D (function) converts radians to degree angle values.
' _R2G (function) converts radians to gradient angle values.
' _D2G (function) converts degrees to gradient angle values.
' _G2D (function) converts gradient to degree angle values.

' EXP (function) returns the value of e to the exponential power specified.
' LOG (function) returns the natural logarithm of a specified numerical value
' SGN (function) returns -1 for negative, 0 for zero, and 1 for positive numerical values.
' SQR (function) returns the square root of a non-negative number.

The left and right edges of the screen are black, and when it ends it says "press any key to continue":

[Image: screensaver-bplus-psych-fullscreen-v12b.png]

I got it to fill more of the screen but the bottom left/right corners were still black:

[Image: screensaver-bplus-psych-fullscreen-v12.png]
Reply
#54
1) SYSTEM -- this command
2) Set image size to _NewImage(_DesktopWidth, _DesktopHeight, 32)
Reply
#55
deleted - Steve is too quick!
Reply
#56
You loose roundness by going Screen size, original code preserved roundness by centering in screen with square image.
b = b + ...
Reply
#57
(04-17-2025, 01:32 PM)SMcNeill Wrote: 1) SYSTEM -- this command

That worked, thanks. (I could swear I tried SYSTEM and it still said press any key, but I tried it again, and this time it worked, so go figure.)

(04-17-2025, 01:32 PM)SMcNeill Wrote: 2) Set image size to _NewImage(_DesktopWidth, _DesktopHeight, 32)
Not working. At line 314, I added code to print text to the corners of the screen, and the graphics are not drawing all the way there, the right & left sides of the screen are still blank (also, I'm not sure what @bplus meant by losing roundness, it looks the same to me...)

PS Also I am using the latest QB64PE 4.1

Code: (Select All)
' Eye Candy #9B by bplus, Mini-Mod
' 04-30-2022, 07:55 PM (This post was last modified: 04-30-2022, 08:19 PM by bplus.)
' https://qb64phoenix.com/forum/showthread.php?tid=219&pid=1291#pid1291

' INSTRUCTIONS:
' ENTER...............change function
' SPACE...............show/hide function name
' ESC OR MOVE MOUSE...quit
' (any other key).....change colors

' madscijr added Steve's mouse check,
' so when user touches the mouse it closes,
' to use as a screen saver,
' and also modified function Plasma~&
' to use not just SIN but also COS TAN _COT _CSC _SEC
' maybe later we'll experiment with other functions
' (they didn't work by just dropping them in, it will take some studying)
' and added hotkeys to cycle through functions, etc.

' TO DO / ISSUES:
' * Image doesn't fill the whole screen - the bottom
'   left & right corners are black, how do we get the
'   image to fill the whole screen?

_Title " Eye Candy #9B Closer" ' b+ 2022-03-09
DefDbl A-Z

Const fps = 80
Const cSecondsPerFunction = 30 ' # seconds before next function cycles
Const cMouseDelaySeconds = 5 ' # of seconds before begin checking for mouse
Const cMinFn = 0 ' min value select case checks for in Function Plasma~&
Const cMaxFn = 5 ' max value select case checks for in Function Plasma~&

' KEY CODES FOR _BUTTON
Const KeyCode_Escape = 2
Const KeyCode_Spacebar = 58
Const KeyCode_Enter = 29
Const KeyCode_Up = 329
Const KeyCode_Down = 337
Const KeyCode_Left = 332
Const KeyCode_Right = 334

Dim Shared cN, pR, pG, pB

Dim Shared iFuncNum% ' index of current function select case checks for
Dim Shared FuncName$ ' name of current function
Dim Shared iFunc2%
Dim message$

ReDim colr(-100 To 1000) As _Unsigned Long
Dim iLoop%, iValue%
Dim iFrameCount% ' counts frames
Dim iFramesPerFunction% ' # frames before next function cycles
Dim iFramesBeforeEnableMouse% ' # frames before start checking for mouse
Dim MaxCols%, MaxRows% ' for printing text on screen
Dim OldMouseX, OldMouseY As Integer
Dim bFinished As Integer: bFinished = _FALSE
Dim bTrackMouse As Integer: bTrackMouse = _FALSE
Dim bShowFuncName%: bShowFuncName% = _FALSE
Dim iLastKeyCode%: iLastKeyCode% = 0

' INITIALIZE
iFramesPerFunction% = cSecondsPerFunction * fps
iFramesBeforeEnableMouse% = cMouseDelaySeconds * fps

'xmax = _DesktopWidth - 1
'ymax = _DesktopHeight - 1

' NOT GOING FULL SCREEN
xmax = _DesktopWidth
ymax = _DesktopHeight
Screen _NewImage(xmax, ymax, 32)

'DOESN'T WORK HARDCODED EITHER:
'Screen _NewImage(_DesktopWidth, _DesktopHeight, 32)

' MAYBE IT'S THE _FULLSCREEN COMMAND?
' https://qb64phoenix.com/qb64wiki/index.php/FULLSCREEN
' NOPE, TRIED ALL THESE VARIANTS, AND NO DIFFERENCE...
_FullScreen
'_FullScreen _Off
'_FullScreen _Stretch
'_FullScreen _SquarePixels
'_FullScreen _Stretch , _Smooth
'_FullScreen _SquarePixels , _Smooth

'_ScreenMove 0, 0

' for printing text
MaxCols% = (_Width / _FontWidth) '- 1
MaxRows% = (_Height / _FontHeight) '- 1

' Center:
xc = xmax / 2
yc = ymax / 2

diag = Sqr(xc * xc + yc * yc)

ReDim colr(-100 To diag + 1000) As _Unsigned Long
p2 = _Pi * 2

iFuncNum% = cMinFn
iFrameCount% = 0

Randomize Timer
While _MouseInput: Wend: OldMouseX = _MouseX: OldMouseY = _MouseY ' initial mouse placement
While 1
    resetPlasma
    For iLoop% = -100 To diag + 1000
        colr(iLoop%) = Plasma~&(iFuncNum%)
    Next iLoop%

    ro = 950
    s = 0
    While ro > -50
        ' PROCESS KEYBOARD INPUT
        While _DeviceInput(1): Wend ' clear and update the keyboard buffer
        If _Button(KeyCode_Escape) Then
            ' ESC = QUIT
            iLastKeyCode% = KeyCode_Escape
            bFinished = _TRUE: Exit While
        ElseIf _Button(KeyCode_Enter) Then
            ' ENTER = CYCLE TO NEXT FUNCTION
            If iLastKeyCode% <> KeyCode_Enter Then
                iFuncNum% = iFuncNum% + 1: If iFuncNum% > cMaxFn Then iFuncNum% = cMinFn
                resetPlasma
                For iLoop% = -100 To diag + 1000
                    colr(iLoop%) = Plasma~&(iFuncNum%)
                Next iLoop%
                iLastKeyCode% = KeyCode_Enter
            End If
        ElseIf _Button(KeyCode_Spacebar) Then
            ' ENTER = SHOW/HIDE FUNCTION NAME
            If iLastKeyCode% <> KeyCode_Spacebar Then
                bShowFuncName% = Not (bShowFuncName%)
                iLastKeyCode% = KeyCode_Spacebar
            End If
        Else
            ' ANY OTHER KEY = CHANGE COLORS
            iLastKeyCode% = 0
            k$ = InKey$: _KeyClear
            If Len(k$) Then Exit While
        End If
        _KeyClear ' CLEAR KEYBOARD BUFFER




        ' Tie dye!
        Cls

        ' SINGLE                  ! or none            -2.802597E-45                  +3.402823E+38                4
        ' DOUBLE                  #                    -4.490656458412465E-324        +1.797693134862310E+308      8
        ' _FLOAT                  ##                   -1.18E-4932                    +1.18E+4932                  32(10 used)
        iTo# = p2 / 64
        iStep# = p2 / (16 * 360)


        'For a = 0 To p2 / 64 Step p2 / (16 * 360)
        For a = 0 To iTo# Step iStep#

            iValue% = 50 * Sin(s) ' 2 * s or just s


            If _TRUE = _FALSE Then
                iValue% = (s / 50) * 25
                iValue% = (s / 500) * 25
                iValue% = (s / 500) * p2 ^ .25
                iValue% = (s / 500) * p2 ^ (a * .25)
                iValue% = (s / 500) * p2 ^ a
                iValue% = (a / 50000) * s ^ (p2 * .25)

                ' EXPERIMENT WITH DIFFERENT VALUES HERE:
                iFunc2% = RandomNumber%(1, 5)

                Select Case iFunc2%
                    Case 1:
                        iValue% = 50 * Sin(s) ' 2 * s or just s
                    Case 2:
                        iValue% = 50 * Cos(s * 1)
                    Case 3:
                        iValue% = 1 * Tan(s * 1)
                    Case 4:
                        iValue% = 1 * _Sec(s * 2)
                    Case 5:
                        iValue% = 1 * _Acos(s * 1)
                    Case Else
                        iValue% = 1 * _Acosh(s * 2)
                End Select


                ' TRY SOME OF THESE...
                iValue% = 50 * Sin(s) ' 2 * s or just s

                iValue% = 50 * Sin(s * 2) ' 2 * s or just s
                iValue% = 50 * Sin(s * 3)
                iValue% = 50 * Sin(s * 4)
                iValue% = 50 * Sin(s * 5)

                iValue% = 50 * Cos(s * 1)
                iValue% = 50 * Cos(s * 2)
                iValue% = 50 * Cos(s * 3)
                iValue% = 50 * Cos(s * 4)
                iValue% = 25 * Cos(s * 5)

                iValue% = 1 * Tan(s * 1)
                iValue% = 1 * Tan(s * 2)

                iValue% = 1 * _Sec(s * 2)

                iValue% = 1 * _Acos(s * 1)
                iValue% = 1 * _Acos(s * 2)
                iValue% = 1 * _Acos(s * 3)
                iValue% = 1 * _Acos(s * 4)
                iValue% = 1 * _Acos(s * 5)

                iValue% = 1 * _Acosh(s * 2)

                iValue% = 1 * _Asin(s * 2)

                iValue% = 1 * _Asinh(s * 2)

                iValue% = 1 * Atn(s * 2)

                iValue% = 1 * _Tanh(s * 2)

                iValue% = 1 * _Atanh(s * 1)
                iValue% = 1 * _Atanh(s * 4)

                iValue% = 1 * _Arccot(s * 1)

                ' STARTED GOING BACKWARDS! BUT CRASHED!
                'iValue% = 1 * _Coth(s * .009)
                'iValue% = 1 * _Coth(s * .008)
                'iValue% = 1 * _Coth(s * .007)
                'iValue% = 1 * _Coth(s * .006)
                'iValue% = 1 * _Coth(s * .005)
                'iValue% = 1 * _Coth(s * .002)
                iValue% = 1 * _Coth(s * .001)

                iValue% = 1 * _Sech(s * .001)
                iValue% = 1 * _Sech(s * .005)
                iValue% = 1 * _Sech(s * .05)
                iValue% = 1 * _Sech(s * .1)
            End If

            ' JUST RESULTS IN WHITE ON WHITE OR BLACK ON BLACK:
            ' _ACOS (function) arccosine function returns the angle in radians based on an input COSine value range from -1 to 1.
            ' _COSH (function) Returns the hyperbolic cosine of x radians.
            ' _ACOSH (function) Returns the nonnegative arc hyperbolic cosine of x, expressed in radians.
            ' _ARCSEC (function) is the inverse function of the secant.
            ' _ARCCSC (function) is the inverse function of the cosecant.
            ' _SINH (function) Returns the hyperbolic sine of x radians.
            ' _ASIN (function) Returns the principal value of the arc sine of x, expressed in radians.
            ' _ASINH (function) Returns the arc hyperbolic sine of x, expressed in radians.
            ' ATN (function) or arctangent returns the angle in radians of a numerical tangent value.
            ' _TANH (function) Returns the hyperbolic tangent of x radians.
            ' _ATANH (function) Returns the arc hyperbolic tangent of x, expressed in radians.
            ' _ARCCOT (function) is the inverse function of the cotangent.

            ' CAUSE ERRORS:
            ' _COTH (function) Returns the hyperbolic cotangent.
            ' _CSCH (function) Returns the hyperbolic cosecant.
            ' _SECH (function) Returns the hyperbolic secant.


            For r = 0 To diag
                PSet (xc + r * Cos(a), yc + r * Sin(a)), colr(r + iValue% + ro)
            Next r
            s = s + p2 / 180
        Next a

        sx1 = xc
        sy1 = yc

        sx2 = xc + diag * Cos(.002)
        sy2 = yc + diag * Sin(.002)

        sx3 = xc + diag * Cos(p2 / 64 - .002)
        sy3 = yc + diag * Sin(p2 / 64 - .002)

        For a = p2 / 64 To p2 - p2 / 64 Step p2 / 64
            dx1 = xc
            dy1 = yc
            dx2 = xc + diag * Cos(a)
            dy2 = yc + diag * Sin(a)
            dx3 = xc + diag * Cos(a + p2 / 64)
            dy3 = yc + diag * Sin(a + p2 / 64)
            _MapTriangle (sx1, sy1)-(sx2, sy2)-(sx3, sy3), source& To(dx1, dy1)-(dx2, dy2)-(dx3, dy3), 0
        Next a

        Line (0, 0)-(xc - 1.5 * yc, _Height), &HFF000000, BF
        Line (xc + 1.5 * yc, 0)-(_Width, _Height), &HFF000000, BF

        ' SHOW THE CURRENT GEOMETRY FUNCTION BEING USED BY Plasma~&
        If bShowFuncName% = _TRUE Then
            Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
            Locate MaxRows% / 2, (MaxCols% / 2) - (Len(FuncName$) / 2)
            Print FuncName$;
        End If

        '' SHOW SOME VALUES FOR DEBUGGING
        'message$ = "iValue% = " + _Trim$(Str$(iValue%))
        'Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
        'Locate MaxRows% / 2, (MaxCols% / 2) - (Len(message$) / 2)
        'Print message$;

        'Hmmm printing to MaxRows%, MaxCols% gives an error:
        'message$ = "TOP LEFT": Locate 1, 1: Print message$;
        'message$ = "TOP RIGHT": Locate 1, MaxCols% - Len(message$): Print message$;
        'message$ = "BOTTOM LEFT": Locate MaxRows%, 1: Print message$;
        'message$ = "BOTTOM RIGHT": Locate MaxRows%, MaxCols% - Len(message$): Print message$;

        message$ = "TOP LEFT": _PrintString (0, 0), message$
        message$ = "TOP RIGHT": _PrintString (xmax - (Len(message$) * _FontWidth), 0), message$
        message$ = "BOTTOM LEFT": _PrintString (0, (ymax - _FontWidth)), message$
        message$ = "BOTTOM RIGHT": _PrintString (xmax - (Len(message$) * _FontWidth), (ymax - _FontWidth)), message$

        ' Count down to color change
        toggle = 1 - toggle
        If toggle Then _Display
        ro = ro - 1

        ' Cycle through different geometry functions (SIN, COS, TAN, etc.)
        ' after iFramesPerFunction% repetitions (# cycles for the given # seconds)
        iFrameCount% = iFrameCount% + 1
        If iFrameCount% > iFramesPerFunction% Then
            iFrameCount% = 0
            iFuncNum% = iFuncNum% + 1: If iFuncNum% > cMaxFn Then iFuncNum% = cMinFn
            resetPlasma
            For iLoop% = -100 To diag + 1000
                colr(iLoop%) = Plasma~&(iFuncNum%)
            Next iLoop%
        End If

        ' If user moves mouse, quit
        ' NOTE: for some reason we have to wait a couple seconds
        '       before checking for this, or the program just
        '       immediately quits?
        If bTrackMouse = _TRUE Then
            While _MouseInput: Wend
            If OldMouseX <> _MouseX Or OldMouseY <> _MouseY Then
                bFinished = _TRUE
                Exit While ' if the mouse moved, quit
            End If
        Else
            ' We had to delay the mouse move test
            ' because it was always resulting in _TRUE
            ' no idea why?
            If iFrameCount% > iFramesBeforeEnableMouse% Then
                While _MouseInput: Wend: OldMouseX = _MouseX: OldMouseY = _MouseY ' initial mouse placement
                bTrackMouse = _TRUE
            End If
        End If

        _Limit fps
    Wend
    If bFinished = _TRUE Then Exit While
Wend

System
'End

' /////////////////////////////////////////////////////////////////////////////

Function Plasma~& (fn%)
    cN = cN + .2
    Select Case fn%: '
        Case 0:
            FuncName$ = "SIN"
            Plasma~& = _RGB32(127 + 127 * Sin(pR * cN), 127 + 127 * Sin(pG * cN), 127 + 127 * Sin(pB * cN))
        Case 1:
            FuncName$ = "COS"
            Plasma~& = _RGB32(127 + 127 * Cos(pR * cN), 127 + 127 * Cos(pG * cN), 127 + 127 * Cos(pB * cN))
        Case 2:
            FuncName$ = "TAN"
            Plasma~& = _RGB32(127 + 127 * Tan(pR * cN), 127 + 127 * Tan(pG * cN), 127 + 127 * Tan(pB * cN))
        Case 3:
            FuncName$ = "_COT"
            Plasma~& = _RGB32(127 + 127 * _Cot(pR * cN), 127 + 127 * _Cot(pG * cN), 127 + 127 * _Cot(pB * cN))
        Case 4:
            FuncName$ = "_CSC"
            Plasma~& = _RGB32(127 + 127 * _Csc(pR * cN), 127 + 127 * _Csc(pG * cN), 127 + 127 * _Csc(pB * cN))
        Case 5:
            FuncName$ = "_SEC"
            Plasma~& = _RGB32(127 + 127 * _Sec(pR * cN), 127 + 127 * _Sec(pG * cN), 127 + 127 * _Sec(pB * cN))
        Case Else:
            Plasma~& = _RGB32(127 + 127 * Sin(pR * cN), 127 + 127 * Sin(pG * cN), 127 + 127 * Sin(pB * cN))
    End Select
End Function ' Plasma~&

' /////////////////////////////////////////////////////////////////////////////

Sub resetPlasma ()
    pR = Rnd ^ 2: pG = Rnd ^ 2: pB = Rnd ^ 2
End Sub

' /////////////////////////////////////////////////////////////////////////////

Function RandomNumber% (Min%, Max%)
    Dim NumSpread%
    NumSpread% = (Max% - Min%) + 1
    RandomNumber% = Int(Rnd * NumSpread%) + Min% ' GET RANDOM # BETWEEN Max% AND Min%
End Function ' RandomNumber%

' /////////////////////////////////////////////////////////////////////////////
' Geometry functions we tried with Plasma~&:

' PRODUCE COLORS:
' SIN (function) returns the sine of a radian angle.
' COS (function) returns the cosine of a radian angle value.
' TAN (function) returns the ratio of SINe to COSine or tangent value of an angle measured in radians.
' _COT (function) the mathematical function cotangent defined by 1/TAN.
' _CSC (function) the mathematical function cosecant defined by 1/SIN.
' _SEC (function) the mathematical function secant defined by 1/COS.

' JUST RESULTS IN WHITE ON WHITE OR BLACK ON BLACK:
' _ACOS (function) arccosine function returns the angle in radians based on an input COSine value range from -1 to 1.
' _COSH (function) Returns the hyperbolic cosine of x radians.
' _ACOSH (function) Returns the nonnegative arc hyperbolic cosine of x, expressed in radians.
' _ARCSEC (function) is the inverse function of the secant.
' _ARCCSC (function) is the inverse function of the cosecant.
' _SINH (function) Returns the hyperbolic sine of x radians.
' _ASIN (function) Returns the principal value of the arc sine of x, expressed in radians.
' _ASINH (function) Returns the arc hyperbolic sine of x, expressed in radians.
' ATN (function) or arctangent returns the angle in radians of a numerical tangent value.
' _TANH (function) Returns the hyperbolic tangent of x radians.
' _ATANH (function) Returns the arc hyperbolic tangent of x, expressed in radians.
' _ARCCOT (function) is the inverse function of the cotangent.

' CAUSE ERRORS:
' _COTH (function) Returns the hyperbolic cotangent.
' _CSCH (function) Returns the hyperbolic cosecant.
' _SECH (function) Returns the hyperbolic secant.

' OTHER GEOMETRY FUNCTIONS:
' _ATAN2 (function) Returns the principal value of the arc tangent of y/x, expressed in radians.
' _HYPOT (function) Returns the hypotenuse of a right-angled triangle whose legs are x and y.

' OTHER MATH FUNCTIONS:
' _D2R (function) converts degrees to radian angle values.
' _G2R (function) converts gradient to radian angle values.
' _R2D (function) converts radians to degree angle values.
' _R2G (function) converts radians to gradient angle values.
' _D2G (function) converts degrees to gradient angle values.
' _G2D (function) converts gradient to degree angle values.

' EXP (function) returns the value of e to the exponential power specified.
' LOG (function) returns the natural logarithm of a specified numerical value
' SGN (function) returns -1 for negative, 0 for zero, and 1 for positive numerical values.
' SQR (function) returns the square root of a non-negative number.

[Image: screensaver-bplus-5-psych-fullscreen-v13-SCREENSHOT.png]
Reply
#58
(04-17-2025, 04:42 PM)madscijr Wrote:
(04-17-2025, 01:32 PM)SMcNeill Wrote: 1) SYSTEM -- this command

That worked, thanks. (I could swear I tried SYSTEM and it still said press any key, but I tried it again, and this time it worked, so go figure.)

(04-17-2025, 01:32 PM)SMcNeill Wrote: 2) Set image size to _NewImage(_DesktopWidth, _DesktopHeight, 32)
Not working. At line 314, I added code to print text to the corners of the screen, and the graphics are not drawing all the way there, the right & left sides of the screen are still blank (also, I'm not sure what @bplus meant by losing roundness, it looks the same to me...)

Sorry. I was on my ipad and didn't type that fully. What you need to do is make an image the size of your desktop and then _PUTIMAGE the screen to that one to display.

Draw on the 800x800 screen.
Have a _DesktopWidth, _DesktopHeight image.
Put the 800x800 image on the properly sized one.
_DISPLAY

Note: the scaled image is the SCREEN. The 800x800 is the _DEST. You want to _PUTIMAGE from the 800x800 to the SCREEN image.

If I get time later, I'll work it up for you, if you can't sort it out on your own before then. Wink
Reply
#59
I'll give that a try... Thanks!
Reply
#60
Try this out: 

Code: (Select All)
_Title " Eye Candy #9B Closer (fullscreen)" ' b+ 2022-03-09
'fullscreen mod by Steve. 2025-04-17
DefDbl A-Z
xmax = _DesktopWidth: ymax = _DesktopHeight
Screen _NewImage(xmax, ymax, 32)
_ScreenMove 0, 0
xc = xmax / 2
yc = ymax / 2
diag = Sqr(xc * xc + yc * yc)
p2 = _Pi * 2
Dim colr(-100 To diag + 1000) As _Unsigned Long
Dim Shared cN, pR, pG, pB
While 1
resetPlasma
For i = -100 To diag + 1000
colr(i) = Plasma~&
Next

ro = 950: s = 0
While ro > -50 And _KeyDown(27) = 0
k$ = InKey$
If Len(k$) Then Exit While
Cls
For a = 0 To p2 / 64 Step p2 / (16 * 360)
i = 50 * Sin(s) ' 2 * s or just s
For r = 0 To diag
PSet (xc + r * Cos(a), yc + r * Sin(a)), colr(r + i + ro)
Next
s = s + p2 / 180
Next
sx1 = xc: sy1 = yc: sx2 = xc + diag * Cos(.002): sy2 = yc + diag * Sin(.002): sx3 = xc + diag * Cos(p2 / 64 - .002): sy3 = yc + diag * Sin(p2 / 64 - .002)
For a = p2 / 64 To p2 - p2 / 64 Step p2 / 64
dx1 = xc: dy1 = yc: dx2 = xc + diag * Cos(a): dy2 = yc + diag * Sin(a): dx3 = xc + diag * Cos(a + p2 / 64): dy3 = yc + diag * Sin(a + p2 / 64)
_MapTriangle (sx1, sy1)-(sx2, sy2)-(sx3, sy3), source& To(dx1, dy1)-(dx2, dy2)-(dx3, dy3), 0
Next
'Line (0, 0)-(xc - 1.5 * yc, _Height), &HFF000000, BF
'Line (xc + 1.5 * yc, 0)-(_Width, _Height), &HFF000000, BF
_PutImage (0, 0)-(_Width, _Height), , , (xc - 1.5 * yc, 0)-(xc + 1.5 * yc, _Height)
toggle = 1 - toggle
If toggle Then _Display
'_Limit 80
ro = ro - 1
Wend
If _KeyDown(27) Then System
Wend

Function Plasma~& ()
cN = cN + .2
Plasma~& = _RGB32(127 + 127 * Sin(pR * cN), 127 + 127 * Sin(pG * cN), 127 + 127 * Sin(pB * cN))
End Function

Sub resetPlasma ()
pR = Rnd ^ 2: pG = Rnd ^ 2: pB = Rnd ^ 2
End Sub

Going back to the original, the modifications here were rather simple. Going through your mod of the original, things get complicated fast. LOL!

For this, the original is already set up with all you need. Those black bars on the side are intentional and are created by the two LINE statements.

If you want the center to stretch all the way to the edges, simply remove those LINE statements and use the X/Y reference points to putimage that center to the whole screen. That's it. All that's required.

'Line (0, 0)-(xc - 1.5 * yc, _Height), &HFF000000, BF
'Line (xc + 1.5 * yc, 0)-(_Width, _Height), &HFF000000, BF
_PutImage (0, 0)-(_Width, _Height), , , (xc - 1.5 * yc, 0)-(xc + 1.5 * yc, _Height)

Presto! Whamo! Done! Big Grin
Reply




Users browsing this thread: 2 Guest(s)