
-----------------------------------
Catalyst
Thu Apr 03, 2003 3:13 pm

Text Flashlight (also Pic Flashlight)
-----------------------------------
Something i made cuz i was bored



View.Set ("graphics:640,640,nobuttonbar,offscreenonly")
function distance (x1, y1, x2, y2 : real) : real
    result ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
end distance
var clr : int
for i : 1 .. 255
    clr := RGB.AddColor (i / 255, i / 255, i / 255)
end for
var rad : int := 125
var text : array 1 .. maxrow, 1 .. maxcol of char
for i : 1 .. maxrow
    for k : 1 .. maxcol
        text (i, k) := chr (Rand.Int (35, 65))
    end for
end for
var x, y, z : int
loop
    mousewhere (x, y, z)
    for i : 1 .. maxrow
        for k : 1 .. maxcol
            if distance (x, y, k * 8, maxy - (i * 12)) < rad then
                locate (i, k)
                color (510-round (((distance (x, y, k * 8, maxy - (i * 12)) / rad) * 255)))
                colorback (7)
                put text (i, k) ..
            end if
        end for
    end for
    View.Update
    drawfillbox (0, 0, maxx, maxy, 7)
end loop

I'd like to see you bored more often :D I couldn't understand how you did that until I looked at the code behind it. Really interesting and I learned something new... which so good... so +10Bits for that - Tony

-----------------------------------
Catalyst
Thu Apr 03, 2003 5:44 pm

Picture Flashlight
-----------------------------------
heres something i came up with after the text light,
its based on the same ideas...

** Set it up with a picture, but dont put the radius over 30 or it lag badly **


View.Set ("graphics:150,150,nobuttonbar,offscreenonly,position:300;300")
function distance (x1, y1, x2, y2 : real) : real
    result ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
end distance
var clr : int
var homer : int := Pic.FileNew ("pic.jpg")
var r1, g1, b1 : real
var r2, g2, b2 : array 0 .. 255 of real
for i : 0 .. 255
    RGB.GetColor (i, r2 (i), g2 (i), b2 (i))
end for
var p, p0 : real
var c1, c2 : int := 7
var rad : int := 24
var picA : array 0 .. maxx, 0 .. maxy of int
Pic.Draw (homer, 0, 0, picCopy)
for i : 0 .. maxx
    for k : 0 .. maxy
        picA (i, k) := whatdotcolor (i, k)
    end for
end for
RGB.GetColor (c1, r1, g1, b1)
const a := 50
var x, y, z : int
loop
    mousewhere (x, y, z)
    for i : x - rad .. x + rad
        for k : y - rad .. y + rad
            if i > 1 and i < maxx and k > 1 and k < maxy then
                if distance (x, y, i, k) < rad then
                    p := (distance (x, y, i, k) / rad) * 100
                    p0 := 100 - p
                    RGB.SetColor (1, (((r1 * p) + (r2 (picA (i, k)) * p0)) / 2) / a, (((g1 * p) + (g2 (picA (i, k)) * p0)) / 2) / a, (((b1 * p) + (b2 (picA (i, k)) * p0)) / 2) / a)
                    drawdot (i, k, 1)
                end if
            end if
        end for
    end for
    View.Update
    drawfillbox (0, 0, maxx, maxy, black)
end loop


-----------------------------------
Asok
Thu Apr 03, 2003 8:50 pm


-----------------------------------
*bows to catalyst*

WE ARE NOT WORTHY!!

 :D

-----------------------------------
Homer_simpson
Sat Apr 05, 2003 7:47 pm


-----------------------------------
sweet  8)

-----------------------------------
nate
Sun Apr 06, 2003 5:12 pm

man ur good
-----------------------------------
Catalyst how long have u been using turing cause ur amazin at it!!

-nate

-----------------------------------
Catalyst
Sun Apr 06, 2003 6:29 pm


-----------------------------------
ive been doin turing for 6 months

-----------------------------------
Prince
Mon Apr 07, 2003 10:08 am


-----------------------------------
6 months  :shock: ... and u say u made this wen ur bored?? :?

-----------------------------------
Prince
Mon Apr 07, 2003 10:11 am


-----------------------------------
did u make this on turing 4 cus its not workin for me (still usin 3.1.1  :( )

-----------------------------------
Tony
Mon Apr 07, 2003 10:52 am


-----------------------------------
yes, it was made in v4
RGB. and View.Update are v4 only

-----------------------------------
Delta
Mon Apr 07, 2003 12:14 pm

Maybe in turing but...
-----------------------------------
Catalyst how long have you been programming though, not just in TURING but in other languages like BASIC, Pascal, C/C++, VB or something else???

-----------------------------------
Catalyst
Mon Apr 07, 2003 2:32 pm


-----------------------------------
ive been doin turing since october and have been doin c++ and opengl for the past month or so (didnt do ne thing b4 turing)

-----------------------------------
Martin
Tue Apr 22, 2003 8:17 pm


-----------------------------------
Just a quick question, what's a for? I see that it changes the shading of the flashlight, but why?

-----------------------------------
Catalyst
Tue Apr 22, 2003 8:50 pm


-----------------------------------
a converts one the value i get with, for ex.

((r1 * p) + (r2 (c2) * p0)) / 2)

from a percentage to a realnumber 0 to 1 

it affects the brightness and dropoff of the shading
i have it set at 50 so it is brighter (technically it should be 100)

note: if you go below 50 you can get some interesting results

-----------------------------------
Martin
Tue Apr 22, 2003 10:49 pm


-----------------------------------
Yeah, I noticed that

-----------------------------------
HeTeRiC
Mon Nov 17, 2003 8:04 pm

Holy CraP!
-----------------------------------
6 months and catalyst is doint that when here's BOARD!!!
i've been prooging turing fer about 2 hours now and i had no idea turning was capable of something like that!! :clap:  :clap:  :clap: 
amazing! you've inspired me to learn turing inside and out!!!!
:clap::clap::clap:

-----------------------------------
Mazer
Mon Nov 17, 2003 8:27 pm

Re: Holy CraP!
-----------------------------------
inspired me to learn turing inside and out!!!!

careful now, if you do, you'll end up regretting it! :wink:

-----------------------------------
rizzix
Mon Nov 17, 2003 8:57 pm


-----------------------------------
listen to his words of wisdom

-----------------------------------
Catalyst
Mon Nov 17, 2003 9:10 pm


-----------------------------------
i very much agree

-----------------------------------
santabruzer
Thu Nov 20, 2003 6:44 pm


-----------------------------------
Catalyst is freaking amazing.. though i started just this month... hopefully i'll get to the same level as him...
Catalyst is my role model!

-----------------------------------
JayLo
Thu Nov 20, 2003 10:30 pm


-----------------------------------
don't idolize. although catalyst is that good, come on people. common sense?
