Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 New Commands for Turing
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bacchus




PostPosted: Fri Jul 01, 2005 11:11 pm   Post subject: (No subject)

Take a look at the Flexible Array Tutorial by Cervantes, its doesnt work the best, but you can resize multi-dimensional flexible arrays. If you really wanted to, you could even look up the old thread that inspired the edit into that Tutorial.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Mon Jul 04, 2005 2:43 pm   Post subject: (No subject)

Here's the finished Str module. I think I only added one or two new functions, since a lot of them I can't do (they use blocks, or return an array with a dynamic upper bounds, or maybe some other things Turing can't do).

Is someone going to tackle the Array module? I have a feeling a lot of the methods can't be translated into Turing (mostly because of blocks and an unknown upper bounds) so it shouldn't be too daunting a task. Smile



Str.tu
 Description:

Download
 Filename:  Str.tu
 Filesize:  6.75 KB
 Downloaded:  104 Time(s)

jamonathin




PostPosted: Wed Jul 06, 2005 11:35 pm   Post subject: (No subject)

I was juss screwin around with Turing's RGB thinger, and I came up with this little tool. I figured I'd post a demo of it before making a big deal about it, seeing as it may not be good enough for our lil update, but here it is.

It just asks the user to input 2 colors and it creates a shaded image of it between the two colors. Click the mouse somewhere.

P.S - good job on the str. mod.
code:
setscreen ("graphics:max;max,nobuttonbar")
colorback (black)
cls
var mx, my, mz : int

procedure ShadeOval (x, y, a, b, c1, c2 : int)
    var high : int
    if a > b then
        high := a
    elsif b > a then
        high := b
    else
        high := a
    end if
    var r, g, bl : array 1 .. 2 of real
    RGB.GetColor (c1, r (1), g (1), bl (1))
    RGB.GetColor (c2, r (2), g (2), bl (2))
    var C : int
    var dr, dg, db : real
    dr := (r (1) - r (2)) / high
    dg := (g (1) - g (2)) / high
    db := (bl (1) - bl (2)) / high
    for decreasing i : high .. 2
        r (2) += dr
        g (2) += dg
        bl (2) += db
        C := RGB.AddColor (r (2), g (2), bl (2))
        drawfilloval (x, y, round (a * (i / high)), round (b * (i / high)), C)
    end for
end ShadeOval

loop
    mousewhere (mx, my, mz)
    if mz = 1 then
        ShadeOval (mx, my, 15, 15, yellow, black)
    end if
end loop

MysticVegeta




PostPosted: Thu Jul 07, 2005 11:29 am   Post subject: (No subject)

Nice! That looks pretty cool, looks like an oval gradient, good job Smile
StarGateSG-1




PostPosted: Mon Jul 11, 2005 3:58 pm   Post subject: (No subject)

I don;t know if anyoen noticed this but Draw.ThinkLine already existed??, I haven been away and AM not sure if thsi was brought up??
[Gandalf]




PostPosted: Mon Jul 11, 2005 5:44 pm   Post subject: (No subject)

Yes, it already existed although it was not officially supported. We did not add any Draw.ThickLine - but that's what I got the idea from to make 'thick' shapes.

Really nice 'oval gradient'! Good for making graphics on Turing. Only thing I would try to fix is the constant black outline around it - makes it look a bit worse.
jamonathin




PostPosted: Tue Jul 12, 2005 2:00 am   Post subject: (No subject)

what black line are you talking about [Gandalf]? I checked it out on different colored backgrounds, with different oval color, and still nothing. Thinking
Shyfire




PostPosted: Tue Jul 12, 2005 2:04 pm   Post subject: fullscreen???????????????????????/

k iv got an idea Idea how about editing the window module to have a fullscreen function
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Tue Jul 12, 2005 3:35 pm   Post subject: (No subject)

Thats not possible because turing cannot interact with Windows API.
Shyfire




PostPosted: Tue Jul 12, 2005 3:54 pm   Post subject: (No subject)

o ic well there goes that idea Sad Crying or Very sad Sad Crying or Very sad Sad Crying or Very sad
[Gandalf]




PostPosted: Tue Jul 12, 2005 6:57 pm   Post subject: (No subject)

Well, see at the attachment, how there is always a black outline (not line Smile) wherever a cirlce overlaps? That's what would happen if there was a, say red background too.


untitled.GIF
 Description:
screenshot of oval gradient (.gif for some reason...)
 Filesize:  2.41 KB
 Viewed:  1445 Time(s)

untitled.GIF


jamonathin




PostPosted: Wed Jul 13, 2005 1:53 pm   Post subject: (No subject)

That's because that's the first (largest) oval being drawn, which is the second color (last value in command). What the command does is, it asks for two colors, and draws the fade between them.
See, what my first idea was, was to have the oval fade into whatever color the background was, but then there would be some screwups with Pic.Draw's and whatnot, and originality of the oval. So I just had the user pick whatever two colors they wanted the ball to be. So, are you saying have the 'yellow' fade into whatever whatdotcolor is behind the oval?
[Gandalf]




PostPosted: Wed Jul 13, 2005 6:18 pm   Post subject: (No subject)

Yep. You could just have two different commands or something. I'm not sure how it would mess anything up, I didn't look at the code, but the idea I had of this is having it slowly fade into the background. It's up to you and either way it works pretty good.
jamonathin




PostPosted: Wed Jul 13, 2005 10:14 pm   Post subject: (No subject)

Well firstly, I meant the background at first was a problem, because sometimes when I make a program, my background color is green or something, and I have pictures drawn on top of the background that don't relate to green whatsoever. And always making the circle draw with the background color could make the proggy look ugly.

But if we were to draw a circle like such, we could compare every color in the background with the circle
code:
proc circle (c : int)
    for a : 0 .. 360
        for i : 1 .. c
            drawdot (round (100 + sin (a) * i), round (100 + cos (a) * i), black)
        end for
    end for
    drawdot (100, 100, black)
end circle

circle (20)


And then we can incorporate our RGB thinger.
code:
proc circle (c, X : int)
    var res : array 1 .. 360, 1 .. c of int
    var r, g, b : array 1 .. 2 of real
    var C : int
    for d : 1 .. 2
        for a : 1 .. 360
            for i : 1 .. c
                if d = 1 then
                    C := whatdotcolor (round (maxx div 2 + sin (a) * i), round (maxy div 2 + cos (a) * i))
                    RGB.GetColor (C, r (1), g (1), b (1))
                    RGB.GetColor (X, r (2), g (2), b (2))
                    res (a, i) := RGB.AddColor ((r (1) + r (2)) / 2, (g (1) + g (2)) / 2, (b (1) + b (2)) / 2)
                else
                    drawdot (round (maxx div 2 + sin (a) * i), round (maxy div 2 + cos (a) * i), res (a, i))

                end if
            end for
        end for
    end for
    C := whatdotcolor (maxx div 2, maxy div 2)
    RGB.GetColor (C, r (1), g (1), b (1))
    RGB.GetColor (X, r (2), g (2), b (2))
    var BLAAAAAAAAH : int := RGB.AddColor ((r (1) + r (2)) / 2, (g (1) + g (2)) / 2, (b (1) + b (2)) / 2)
    drawdot (maxx div 2, maxy div 2, BLAAAAAAAAH)
end circle
setscreen ("graphics:300;200,nobuttonbar,position:center;center")
for i : 1 .. 1000
    drawfilloval (Rand.Int (0, maxx), Rand.Int (0, maxy), Rand.Int (5, 20), Rand.Int (5, 20), Rand.Int (1, 6))
end for
circle (20, black)

But now that we have that, try changing the 20,black to 200, black. Looks kinda cool, but wont work.

I first I thought I knew what you were saying, and now i forgot, so this is all I have lol. Confused Not sure where to go after this.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 8 of 8  [ 119 Posts ]
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8
Jump to:   


Style:  
Search: