Computer Science Canada

Screen Saver

Author:  The_Bean [ Fri Mar 27, 2009 3:20 pm ]
Post subject:  Screen Saver

Unfortunately Turing doesn't support fullscreen so it's not a real screensave, but it's close.

I originally made this in python and decided to see if turing could handle it. Surprisingly it could, and with really high speeds, enough that i actually had to slow it down.
If you want to mess around with it you can change the first 2 variables to control the rate of change between colours, and the number of points in the shape.

Turing:

var colourStep : int := 500 %Colour changing speed %1000
var numPoints := 4 %Number of points in shape %4

View.Set ("graphics:max,max,offscreenonly,nobuttonbar,title:Screen Saver")
Text.ColourBack (7)
cls
type Colour :
    record
        g, r, b : real
    end record
var c : array 1 .. 3 of Colour
c (1).r := 0
c (1).g := 0
c (1).b := 0
c (2).r := Rand.Real ()
c (2).g := Rand.Real ()
c (2).b := Rand.Real ()
c (3) := c (1)
var x, y, a : array 1 .. numPoints of real
for i : 1 .. numPoints
    x (i) := Rand.Int (0, maxx)
    y (i) := Rand.Int (0, maxy)
    a (i) := Rand.Int (0, 360)
end for
var ticker : int := 0
var timer := Time.Elapsed
loop
    c (3).r += (c (2).r - c (1).r) / colourStep
    c (3).g += (c (2).g - c (1).g) / colourStep
    c (3).b += (c (2).b - c (1).b) / colourStep
    ticker += 1
    if ticker = colourStep then
        ticker := 0
        c (1) := c (2)
        c (2).r := Rand.Real ()
        c (2).g := Rand.Real ()
        c (2).b := Rand.Real ()
    end if
    RGB.SetColour (255, c (3).r, c (3).g, c (3).b)
    for i : 1 .. numPoints
        x (i) += cosd (a (i)) * 1
        y (i) += sind (a (i)) * 1
        if x (i) > maxx then
            a (i) := Rand.Int (90, 270)
        elsif x (i) < 0 then
            a (i) := Rand.Int (-90, 90)
        end if
        if y (i) > maxy then
            a (i) := Rand.Int (180, 360)
        elsif y (i) < 0 then
            a (i) := Rand.Int (0, 180)
        end if
    end for
    for i : 1 .. numPoints
        Draw.ThickLine (round (x (i)), round (y (i)), round (x (i mod numPoints + 1)), round (y (i mod numPoints + 1)), 2, 255)
    end for
    exit when hasch
    if Time.Elapsed - timer >= 25 then
        timer := Time.Elapsed
        View.Update
    end if
    Time.DelaySinceLast(1)
end loop

Author:  Insectoid [ Fri Mar 27, 2009 3:28 pm ]
Post subject:  RE:Screen Saver

Um...it's not really doing anything...just drawing a bunch of lines and stuff that make no sense. I think the coding is interesting, but the result just looks like a mess.

As it stands, this counts as a "Omg so trippy cool flashes" to me. I'm not trying to be harsh, maybe it's just buggy on my computer. Can you describe what it's supposed to look like?

Author:  andrew. [ Fri Mar 27, 2009 4:42 pm ]
Post subject:  RE:Screen Saver

It's pretty cool, but I think insectoid's right, it does count as "Omg so trippy cool flashes".

Author:  saltpro15 [ Fri Mar 27, 2009 5:42 pm ]
Post subject:  RE:Screen Saver

pretty cool, I say that the coding is sufficient to keep it where it is, it's not really "OMG trippy flashes" material

Author:  SNIPERDUDE [ Fri Mar 27, 2009 10:22 pm ]
Post subject:  RE:Screen Saver

Hmm, on my computer (I'm not sure if it is just running slow on insectoid's computer) it seems to run smooth and quite fine.

I do believe that considering both the fact that he set is to be a 'screensaver', and the coding is sufficient enough to classify it as a programme, I don't see any problem here. Unless the "OMG trippy flashes" category includes all visual effects.

Cool gradient effect though.

Author:  Tallguy [ Fri Apr 03, 2009 7:28 am ]
Post subject:  RE:Screen Saver

i like it, very well done


: