Paint/Write Code (hard to explain!)
Author |
Message |
TylerL
|
Posted: Wed Jun 07, 2006 11:58 am Post subject: Paint/Write Code (hard to explain!) |
|
|
This program lets you draw lines in Turing and have the code written out for you in a text file.
code: | View.Set ("graphics")
Mouse.ButtonChoose ("multibutton")
% Hold L to draw a line. To stop drawing a line, right click while holding L.
% You must create code.txt in the same directory as this file before using
% this program. Clear the code.txt file before using again.
var x, y, button, right, lastx, lasty, counter : int
var filename : string := "code.txt"
var filenumber : int
var drawline1 : string := "drawline("
var comma : string := ", "
var drawline2 : string := ", black)"
var stringx : string
var thisvar : string
var keydown : array char of boolean
counter := 0
right := 100
open : filenumber, filename, put
loop
loop
Input.KeyDown (keydown)
if keydown ('l') then
delay (75)
Mouse.Where (x, y, button)
if button = 1 and counter = 0 then
lastx := x
lasty := y
counter := 1
elsif button = 1 then
put : filenumber, drawline1 ..
put : filenumber, lastx ..
put : filenumber, comma ..
put : filenumber, lasty ..
put : filenumber, comma ..
put : filenumber, x ..
put : filenumber, comma ..
put : filenumber, y ..
put : filenumber, drawline2
drawline (lastx, lasty, x, y, black)
lastx := x
lasty := y
end if
exit when button = 100
end if
end loop
counter := 0
lastx := 0
lasty := 0
end loop
close : filenumber
|
Enjoy! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
CodeMonkey2000
|
Posted: Wed Jun 07, 2006 2:23 pm Post subject: (No subject) |
|
|
not bad
code: |
var x, y, button : int
var c:int:=10
var keydown : array char of boolean
loop
Input.KeyDown (keydown)
if keydown ('c') then
cls
elsif keydown ('v') then
randint (c,1,255)
end if
Mouse.Where (x, y, button)
if button = 0 then
else
drawfilloval (x, y , 5, 5, c)
end if
end loop
|
|
|
|
|
|
|
Clayton
|
Posted: Wed Jun 07, 2006 2:51 pm Post subject: (No subject) |
|
|
@spearmonkey2000 : your above post is spam, plz refrain from doing so in the future
now as for the program TylerL, not bad but believe me, this is not the first of its kind, keep working on it using new ideas, check the Turing Walkthrough for anything new and start learning new things |
|
|
|
|
|
upthescale
|
Posted: Wed Jun 07, 2006 3:00 pm Post subject: (No subject) |
|
|
super freak why do u talk, u always spam and double post, u haven o right to say, cuz i do mistakes to so i kleep my motuh shut |
|
|
|
|
|
iker
|
Posted: Wed Jun 07, 2006 3:23 pm Post subject: (No subject) |
|
|
upthescale wrote: super freak why do u talk, u always spam and double post, u haven o right to say, cuz i do mistakes to so i kleep my motuh shut
upthescale, you're realy starting to get anoying and ridiculous. People change over time, just because super freak may have spammed/double posted before, it doesn't mean he didn't learn from those mistakes, unlike some people (mainly you) who keep on spamming even after being told not to. |
|
|
|
|
|
_justin_
|
Posted: Wed Jun 07, 2006 10:48 pm Post subject: (No subject) |
|
|
eh thats a rather useful program when it comes to drawing line
you should add a feature where you can select a color for the line to be
but anywho good job |
|
|
|
|
|
|
|