Microsoft Small Basic
RSS

Navigation





Quick Search
»
Advanced Search »

PoweredBy

Paint/interpreter*Fixed*

RSS
Modified on 2011/09/25 07:41 by 78.47.82.142 Categorized as Samples
a paint program using commands from the textwindow.*Fixed*

'Epic Paint' 'V1.3' 'SKC161' '540 lines!' GraphicsWindow.Title = "Paint V1.0" TextWindow.Title = "Command reader for Paint V1.0" OH = GraphicsWindow.Height OW = GraphicsWindow.Width GraphicsWindow.Height = OH GraphicsWindow.Width = OW GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.KeyDown = K GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawBoundText(10,10,100,"Press H for help") GraphicsWindow.DrawBoundText(10,30,200,"Click to draw") GraphicsWindow.DrawBoundText(10,50,200,"Type commands.list in the Text Window for more help") GraphicsWindow.DrawBoundText(10,80,300,"Paint your masterpeice!") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("What's your name?") RNT = TextWindow.Read() GraphicsWindow.Title = RNT + "'s masterpeice! V1.1" TextWindow.Title = RNT + "'s masterpeic TextWindow.ForegroundColor = "gray" While(1=1) Sound.PlayClick() TextWindow.WriteLine("type commands") P = TextWindow.Read() C = Text.ConvertToLowerCase(P) Read() EndWhile

Sub K If(GraphicsWindow.LastKey = "H")Then Sound.PlayClick() Help() Endif Endsub

Sub OnMouseDown Sound.PlayClick() prevX = GraphicsWindow.MouseX prevY = GraphicsWindow.MouseY EndSub

Sub OnMouseMove x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown) Then GraphicsWindow.DrawLine(prevX, prevY, x, y) EndIf prevX = x prevY = y EndSub

Sub Read If(C = "pen.color")Then Sound.PlayClick() Color() EndIf If(C = "paint.bgcolor")Then Sound.PlayClick() Bgcolr() EndIf If(C = "pen.size")Then Sound.PlayClick() Pen() EndIf If(C = "paint.clear")Then Sound.PlayClick() Clear() EndIf If(C = "paint.window.size")Then Sound.PlayClick() GWS() EndIf If(C = "text.clear")Then Sound.PlayClick() ClearT() EndIf If(C = "paint.eraser")Then Sound.PlayClick() Eraser() EndIf If(C = "paint.rbgcolor")Then Sound.PlayClick() RBG() EndIf If(C = "window.size = desktop")Then Sound.PlayClick() Desktop() EndIf If(C = "window.size = half")Then Sound.PlayClick() Half() EndIf If(C = "window.size = orignal")Then Sound.PlayClick() Original() EndIf If(C = "paint.rpcolor")Then RPC() EndIf If(C = "text.color")Then TC() EndIf If(C = "project.new")Then Sound.PlayClick() New() EndIf If(C = "commands.list")Then Sound.PlayClick() Commands() EndIf If(C = "turtle.moveto")Then Sound.PlayClick() TurtleM() EndIf If(C = "turtle.move")Then Sound.PlayClick() Turtle() EndIf If(C = "flickr.random")THen Sound.PlayClick() Flickr() Endif If(C = "text.bgcolor")Then Sound.PlayClick() TBGC() EndIf If(C = "text.name")THen Sound.PlayClick() TWN() EndIf If(C = "project.name")Then Sound.PlayClick()ap PaintN() EndIf If(C = "paint.pen")Then Sound.PlayClick() PPEN() EndIf If(C = "turtle.hide")Then Sound.PlayClick() TurtleH() EndIf EndSub

Sub Color TextWindow.WriteLine("Type color") L = TextWindow.Read() GraphicsWindow.PenColor = L EndSub Sub Bgcolr TextWindow.WriteLine("Type color") W = TextWindow.Read() GraphicsWindow.BackgroundColor = W EndSub Sub Pen TextWindow.WriteLine("Type size") Size = TextWindow.ReadNumber() GraphicsWindow.PenWidth = Size GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawBoundText(GraphicsWindow.Width-GraphicsWindow.Width+10,GraphicsWindow.Height-20,100,"Pen.Size = " + Size) EndSub Sub Clear GraphicsWindow.Clear() EndSub Sub GWS TextWindow.WriteLine("Type Height") HE = TextWindow.ReadNumber() Sound.PlayClick() TextWindow.WriteLine("Type Width") WI = TextWindow.ReadNumber() GraphicsWindow.Height = HE GraphicsWindow.Width = WI EndSub Sub Help GraphicsWindow.ShowMessage("Instructions", "HELP") GraphicsWindow.ShowMessage("Click to draw", "HELP") GraphicsWindow.ShowMessage("Use the Text Window to type commands", "HELP") GraphicsWindow.ShowMessage("Type color to access the colors function", "HELP") GraphicsWindow.ShowMessage("Then type the color you want to change it to", "HELP") GraphicsWindow.ShowMessage("Type bg color to access the background colors", "HELP") GraphicsWindow.ShowMessage("Type window size to resize the Graphics window", "HELP") GraphicsWindow.ShowMessage("Type clear to clear the screen", "HELP") GraphicsWindow.ShowMessage("Type clear textwindow to clear the textwindow", "HELP") GraphicsWindow.ShowMessage("Type window.size = desktop to make a full screen window", "HELP") GraphicsWindow.ShowMessage("Type window.size = half for a half screen window", "HELP") GraphicsWindow.ShowMessage("Type rbg color for a random background color", "HELP") GraphicsWindow.ShowMessage("Type rp color for a random pencolor", "HELP") EndSub

Sub ClearT TextWindow.Clear() EndSub

Sub Eraser GraphicsWindow.PenColor = GraphicsWindow.BackgroundColor EndSub

Sub RBG GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() EndSub

Sub Desktop GraphicsWindow.Height = Desktop.Height - 65 GraphicsWindow.Width = Desktop.Width - 10 EndSub

Sub Half GraphicsWindow.Height = Desktop.Height-200 GraphicsWindow.Width = Desktop.Width-200 EndSub Sub Original GraphicsWindow.Width = OW GraphicsWindow.Height = OH EndSub Sub RPC GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() EndSub Sub TC TextWindow.WriteLine("Type text foreground color") Forec = TextWindow.Read() TextWindow.ForegroundColor = Forec EndSub Sub New GraphicsWindow.Clear() TextWindow.Clear() EndSub Sub Commands TextWindow.Clear() TextWindow.ForegroundColor = "yellow" TextWindow.WriteLine("Here is a list of all the commands") Sound.PlayClick() TextWindow.WriteLine("Commands will be listed in red") Sound.PlayClick() TextWindow.WriteLine("Sub commands will be liste in blue under there parent command(Will be added in later version)") Sound.PlayClick() TextWindow.WriteLine("Summarys of commands and Sub commands will be listed under there parent in gray") TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" Sound.PlayClick() TextWindow.WriteLine("pen.color") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("will let you choose the color of the pen/pencil") TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" Sound.PlayClick() TextWindow.WriteLine("Pen.Size") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you choose the size of the pen/pencil") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.bgcolor") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you choose the background color of the graphicswindow") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.Clear") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will clear the project screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.Window.Size") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you choose the size of the project window") Sound.PlayClick() TextWindow.ForegroundColor = "red" TextWindow.WriteLine(" ") TextWindow.WriteLine("Text.Clear") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will clear the command screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.Eraser") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will change the pen to an eraser") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.Pen") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will change the pen from eraser back to pen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.RBGColor") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will change the project screens background color to a random color") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Window.Size") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you change the size of the project window") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Window.Size = Desktop") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will make the project window full screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Window.Size = Half") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will change the project window to half screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Paint.RPColor") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will change the pen to a random color") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Text.Color") TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("This will let you change the color of the text in the command screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Project.New") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("This will clear both the command screen and the project screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Commands.List") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("This will list all the commands and sub commands in the system") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Turtle.Move") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("This will let you draw lines with the turtle function") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Turtle.MoveTo") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you draw lines with the turtle using the X and Y axis") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Flickr.Random") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will choose a random picture from Flickr and set it for the background") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Text.BGColor") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you choose the background color for the command screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Text.Name") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Will let you choose the name of the command screen, the text on the top bar of the command screen") Sound.PlayClick() TextWindow.WriteLine(" ") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Project.Name") Sound.PlayClick() TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("This will let you change the name of the project screen, the text on the top bar of the project screen") EndSub Sub TurtleM TextWindow.WriteLine("Pen up or Pen down?") RRR = TextWindow.Read() Sound.PlayClick() If(RRR = "up")Then Turtle.PenUp() Sound.PlayClick() TextWindow.WriteLine("Turtle.MoveTo X co's?") R = TextWindow.ReadNumber() Sound.PlayClick() TextWindow.WriteLine("Turtle.MoveTo Y co's") RR = TextWindow.ReadNumber() Turtle.MoveTo(R,RR) ElseIf(RRR = "down")Then Sound.PlayClick() TextWindow.WriteLine("What color?") RRRR = TextWindow.Read() GraphicsWindow.PenColor = RRRR Turtle.PenDown() Sound.PlayClick() TextWindow.WriteLine("Turtle.MoveTo X co's?") R = TextWindow.ReadNumber() Sound.PlayClick() TextWindow.WriteLine("Turtle.MoveTo Y co's") RR = TextWindow.ReadNumber() Turtle.MoveTo(R,RR) EndIf GraphicsWindow.PenColor = L EndSub

Sub Turtle Loop = 0 TextWindow.WriteLine("Which direction") RD = TextWindow.Read() Sound.PlayClick() TextWindow.WriteLine("How many degrees?") RTD = TextWindow.ReadNumber() Sound.PlayClick() TextWindow.WriteLine("Pen up or Pen down?") RUD = TextWindow.Read() Sound.PlayClick() TextWindow.WriteLine("How far?") RDD = TextWindow.ReadNumber() Sound.PlayClick() TextWindow.WriteLine("What color?") RC = TextWindow.Read() GraphicsWindow.PenColor = RC Sound.PlayClick() TextWindow.WriteLine("Loop how many times?") Looptime = TextWindow.ReadNumber() While(Loop
Sub Flickr TextWindow.WriteLine("Subject one?") RSO = TextWindow.Read() Sound.PlayClick() TextWindow.WriteLine("Subject two") RST = TextWindow.Read() Pic = Flickr.GetRandomPicture(RSO + RST) GraphicsWindow.DrawResizedImage(Pic,0,0,GraphicsWindow.Width,GraphicsWindow.Height) EndSub

Sub TBGC TextWindow.WriteLine("Type text background color") RTBGC = TextWindow.Read() TextWindow.BackgroundColor = RTBGC TextWindow.Clear() EndSub Sub TWN TextWindow.WriteLine("New Name?") RNN = TextWindow.Read() TextWindow.Title = RNN Endsub Sub PaintN TextWindow.WriteLine("New project name?") RNPN = TextWindow.Read() GraphicsWindow.Title = RNPN EndSub Sub PPEN GraphicsWindow.PenColor = "black" EndSub Sub TurtleH Turtle.Hide() EndSub pacquiao vs marquez hopkins vs dawson donaire vs narvaez cotto vs margarito pacquiao vs marquez velasquez vs dos santos st-pierre vs diaz pacquiao vs marquez tickets

ScrewTurn Wiki version 3.0.5.600. Some of the icons created by FamFamFam.