Posted: Thu Apr 03, 2003 3:13 pm Post subject: Text Flashlight (also Pic Flashlight)
Something i made cuz i was bored
code:
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 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
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 **
code:
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
Posted: Thu Apr 03, 2003 8:50 pm Post subject: (No subject)
*bows to catalyst*
WE ARE NOT WORTHY!!
Homer_simpson
Posted: Sat Apr 05, 2003 7:47 pm Post subject: (No subject)
sweet 8)
nate
Posted: Sun Apr 06, 2003 5:12 pm Post subject: man ur good
Catalyst how long have u been using turing cause ur amazin at it!!
-nate
Catalyst
Posted: Sun Apr 06, 2003 6:29 pm Post subject: (No subject)
ive been doin turing for 6 months
Prince
Posted: Mon Apr 07, 2003 10:08 am Post subject: (No subject)
6 months ... and u say u made this wen ur bored??
Prince
Posted: Mon Apr 07, 2003 10:11 am Post subject: (No subject)
did u make this on turing 4 cus its not workin for me (still usin 3.1.1 )
Sponsor Sponsor
Tony
Posted: Mon Apr 07, 2003 10:52 am Post subject: (No subject)
yes, it was made in v4
RGB. and View.Update are v4 only
Posted: Mon Apr 07, 2003 12:14 pm Post subject: 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
Posted: Mon Apr 07, 2003 2:32 pm Post subject: (No subject)
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
Posted: Tue Apr 22, 2003 8:17 pm Post subject: (No subject)
Just a quick question, what's a for? I see that it changes the shading of the flashlight, but why?
Catalyst
Posted: Tue Apr 22, 2003 8:50 pm Post subject: (No subject)
a converts one the value i get with, for ex.
code:
((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
Posted: Tue Apr 22, 2003 10:49 pm Post subject: (No subject)
Yeah, I noticed that
HeTeRiC
Posted: Mon Nov 17, 2003 8:04 pm Post subject: 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!!
amazing! you've inspired me to learn turing inside and out!!!!