Author |
Topic: Graphics IDE with mouse draw tools (Read 402 times) |
|
michael
New Member
member is offline
Posts: 28
|
|
Graphics IDE with mouse draw tools
« Thread started on: Sep 7th, 2016, 04:27am » |
|
YOU NEED THE LIBERTY BMP FILES TO USE THIS
Use UP/DOWN arrows to scroll through program (click in area first) (make sure you also make a COLOR and type DOWN at start) *<ENTER> runs stored code and refreshes screen * The ADD button adds a line or circle or rectangle you make * LEFT / RIGHT mouse buttons for draws *Make sure you have it on an empty line when you ADD Code:
on error goto [Error]
dim info$(10,10)
DIM li$(100)'
global adnote
global lstat
global cstat
global bstat
global constx'
global consty
global consth
global constv
global errstate$
global lin
global ideloc
global r
global g
global b
bmpbutton #h.red, "bmp\redbttn.bmp",redclicked, UR,10,10
bmpbutton #h.blue, "bmp\bluebttn.bmp",blueclicked , UR, 10,130
bmpbutton #h.green, "bmp\grnbttn.bmp",greenclicked, UR, 10,70
bmpbutton #h.mred, "bmp\blank5.bmp",mredclicked, UR, 10,40
bmpbutton #h.mblue, "bmp\blank4.bmp",mblueclicked, UR, 10,160
bmpbutton #h.mgreen, "bmp\blank3.bmp",mgreenclicked, UR, 10,100
bmpbutton #h.all, "bmp\grphbttn.bmp",allclicked, UR, 100,160
bmpbutton #h.minusall, "bmp\sqrbttn.bmp",minusallclicked, UR, 130, 160
bmpbutton #h.load,"bmp\OPEN.bmp",[loadit],UR 10,200
bmpbutton #h.save,"bmp\SAVE.bmp",[saveit],UR 10,230
bmpbutton #h.compile,"bmp\xxRun.bmp",[compileit],UR 10,260
bmpbutton #h.helpmsg,"bmp\help.bmp",[HELPME],LL 950,50
bmpbutton #h.lined,"bmp\LINEBTTN.bmp",[linedra],LL 950,100
bmpbutton #h.circd,"bmp\CIRCBTTN.bmp",[circledra],LL 980,100
bmpbutton #h.sqared,"bmp\SQRBTTN.bmp",[squaredraw],LL 1010,100
bmpbutton #h.add,"bmp\ADDBTTN.bmp",[addit],LL 980,140
lin =0
r=50
g=50
b=50
call screen 1200,600
#h.4 "cls;place 10 30;down;backcolor 120 130 125;color white;fill 120 130 125"
#h.4 "\ Click on the ? to get helpful hints-"
errstate$="no"
gcolor$="white"
#h.2, "down;place 10 40;color blue;\";li$(lin);"_"
#h.3 "down;color 140 75 145;backcolor black;place 10 330"
#h.3 "\Hold Left or Right Mouse Button"
#h.3 "place 10 350;\to get a location (needs movement)"
#h.3 "color green;place 150 215;\LOAD"
#h.3 "place 150 245;\SAVE"
#h.3 "place 145 275;\COMPILE"
scan
#h.1 "when leftButtonMove [mouseloc]"
#h.1 "when rightButtonMove [rmouseloc]"
#h.2 "setfocus;place 10 20"
#h.2 "when characterInput [inp]"
[back]
if adnote=1 then adnote=0: call runit
wait
[quit]'
timer 0
#h.1 "discard"
close #h
end
[addit]
txt$=currdraw$
adnote=1
goto [inp]
[linedra]
if lstat=0 then lstat=1 else lstat=0
if lstat=1 then cstat=0:bstat=0
goto [back]
[circledra]
if cstat=0 then cstat=1 else cstat=0
if cstat=1 then lstat=0:bstat=0
goto [back]
[squaredraw]
if bstat=0 then bstat=1 else bstat=0
if bstat=1 then lstat=0:cstat=0
goto [back]
[HELPME]
#h.4 "cls;place 10 30;down;backcolor 120 130 125;color white;fill 120 130 125"
if hmn> 8 then hmn=0
if hmn=0 then #h.4 "\Type commands like: down;color green;line 100 100 200 200;circle 100"
if hmn=1 then #h.4 "\ USE ARROW KEYS TO SCROLL UP AND DOWN THE EDITOR-"
if hmn=2 then #h.4 "\<ENTER> does a line return and auto runs and updates draw."
if hmn=3 then #h.4 "\ Dont forget to type 'down' at the start of your code and dont forget a 'color'"
if hmn=4 then #h.4 "\ Use your Left Mouse Button activate areas you need to use"
if hmn=5 then #h.4 "\ When you click COMPILE it saves to 'A draw in basic.bas'"
if hmn=6 then #h.4 "\ When you click on SAVE it saves to 'A Notbasic.bas'"
if hmn=7 then #h.4 "\ The COMPILER makes draws with #h.1 on each line. Make your graphics box same"
if hmn=8 then #h.4 "\ the semicolon can separate many commands: 'backcolor green;fill green;cls'"
hmn=hmn+1
goto [back]
[Error]'
notice "YOUR ERROR IS: ";li$(lin);"..Try again "
' empty the string so its no longer an error
txt$=""
li$(lin)=""
errstate$="yes"
Resume
end
[mouseloc]
#h.3 "down;color black;backcolor black;place 10 310"
#h.3 "\Left click was at ";constx;",";consty
#h.3 "down;color white;backcolor black;place 10 310"
constx= MouseX
consty= MouseY
call runit
#h.3 "\Left click was at ";constx;",";consty
if lstat=1 then currdraw$= "line "+str$(constx)+" "+str$(consty)+" "+str$(consth)+" "+str$(constv)
if bstat=1 then currdraw$= "line "+str$(constx)+" "+str$(consty)+" "+str$(consth)+" "+str$(consty)+";"+"line "+str$(consth)+" "+str$(consty)+" "+str$(consth)+" "+str$(constv)+";line "+str$(consth)+" "+str$(constv)+" "+str$(constx)+" "+str$(constv)+";line "+str$(constx)+" "+str$(constv)+" "+str$(constx)+" "+str$(consty)
if cstat=1 then currdraw$= "place "+str$(constx)+" "+str$(consty)+";ellipse "+str$(consth)+" "+str$(constv)
print #h.1, "down;color white;";currdraw$
goto [back]
[rmouseloc]
#h.3 "down;color black;backcolor black;place 10 290"
#h.3 "\Right click was at ";consth;",";constv
#h.3 "down;color white;backcolor black;place 10 290"
consth= MouseX
constv= MouseY
call runit
#h.3 "\Right click was at ";consth;",";constv
if lstat=1 then currdraw$= "line "+str$(constx)+" "+str$(consty)+" "+str$(consth)+" "+str$(constv)
if bstat=1 then currdraw$= "line "+str$(constx)+" "+str$(consty)+" "+str$(consth)+" "+str$(consty)+";"+"line "+str$(consth)+" "+str$(consty)+" "+str$(consth)+" "+str$(constv)+";line "+str$(consth)+" "+str$(constv)+" "+str$(constx)+" "+str$(constv)+";line "+str$(constx)+" "+str$(constv)+" "+str$(constx)+" "+str$(consty)
if cstat=1 then currdraw$= "place "+str$(constx)+" "+str$(consty)+";ellipse "+str$(consth)+" "+str$(constv)
print #h.1, "down;color white;";currdraw$
goto [back]
[compileit]
gfile$="A draw in basic.bas"
poz=0'
open gfile$ for output as #fil
while li$(poz)<>""
thestring$= li$(poz)
print #fil, "#h.1 ";chr$(34);thestring$;chr$(34)
poz=poz+1
wend
close #fil
goto [back]
end
[loadit]
gfile$="A Notbasic.bas"
poz=0'temporary variable for increment for array
REDIM li$(100)
if fileExists(DefaultDir$, "A Notbasic.bas") then
open gfile$ for input as #fil
while eof(#fil) > -1
input #fil, thestring$
li$(poz)=thestring$
poz=poz+1
wend
close #fil
else
fexists$=""
end if
txt$=li$(0)
call runit
goto [inp]
end
function fileExists(path$, filename$)
'dimension the array info$( at the beginning of your program
files path$, filename$, info$()
fileExists = val(info$(0, 0)) 'non zero is true
end function
[saveit]
gfile$="A Notbasic.bas"
poz=0' temporary variable for increment for array
open gfile$ for output as #fil
while li$(poz)<>""
thestring$= li$(poz)
print #fil, thestring$
poz=poz+1
wend
close #fil
goto [back]
end
[inp]'
ch$ = Inkey$
#h.2 "down;backcolor 180 180 180;fill 180 180 180;color blue"'
c2$=left$(ch$, 1)
if asc(ch$) >32 and asc(ch$)<127 then txt$=txt$+ch$
if ch$=" " then txt$=txt$+" "
if asc(ch$) =8 then sl= len(txt$)-1:s1$= mid$(txt$,1,len(txt$)-1):txt$= s1$:#h.2 "cls"
if len(Inkey$)>1 then
key1$=right$(Inkey$,1)
key2$=left$(Inkey$,1)
else
key1$=Inkey$
key2$=""
end if
' print len(Inkey$),
if key2$="" then print " ", else print asc(key2$),
ch=asc(key1$)
#h.2 "backcolor 150 150 150;fill 180 180 180 ;cls;color blue"
if asc(ch$)= 13 then call runit'
lpos0$= str$(lin-1)+" "
lpos1$= str$(lin)+" "
lpos2$= str$(lin+1)+" "
if lin>0 then print #h.2, "place 10 20;\";lpos0$;"";li$(lin-1)
#h.2, "place 10 40;\";lpos1$;"";li$(lin);"_"
if lin<500 then print #h.2, "place 10 60;\";lpos2$;"";li$(lin+1)
li$(lin)=txt$ ' this line will make issues if it is active
if ch=37 then curs=curs-1
if ch=39 then curs=curs+1
if ch=38 then lin=lin-1
if lin<0 then lin=0
if ch=40 then lin=lin+1
if ch$="(" then lin=lin-1
if asc(ch$) =13 then if errstate$="no" then lin=lin+1
if errstate$="yes" then errstate$="no"
if lin>100 then lin=100'
lpos0$= str$(lin-1)+" "
lpos1$= str$(lin)+" "
lpos2$= str$(lin+1)+" "
txt$=li$(lin)
#h.2 "backcolor 180 180 180;fill 180 180 180;cls"'<<<<<<<<<<<<<<<<<<<<TEXT
if lin>0 then print #h.2, "place 10 20;\";lpos0$;"";li$(lin-1)
#h.2, "place 10 40;\";lpos1$;"";li$(lin);"_"
if lin<100 then print #h.2, "place 10 60;\";lpos2$;"";li$(lin+1)
'**************************
goto [back]
wait
sub runit
tl=0
#h.1 "place 0 0;down;cls"
[cyclerun]
if len(li$(tl))=0 then goto [getout]
#h.1 "down;";li$(tl)
tl=tl+1
goto [cyclerun]
[getout]
end sub
'
sub allclicked bttnHandle$
r=r+5
g=g+5
b=b+5
if r>255 then r=0
if g>255 then g=0
if b>255 then b=0
call mixedcolor
end sub
sub minusallclicked bttnHandle$
r=r-5
g=g-5
b=b-5
if r < 0 then r=255
if g < 0 then g=255
if b < 0 then b=255
call mixedcolor
end sub
sub redclicked bttnHandle$
r=r+5
if r > 255 then r=0
call mixedcolor
end sub
sub blueclicked bttnHandle$
b=b+5
if b > 255 then b=0
call mixedcolor
end sub
sub greenclicked bttnHandle$
g=g+5
if g >255 then g=0
call mixedcolor
end sub
sub mgreenclicked bttnHandle$
g=g-5
if g<0 then g=255
call mixedcolor
end sub
sub mblueclicked bttnHandle$
b=b-5
if b<0 then b=255
call mixedcolor
end sub
sub mredclicked bttnHandle$
r=r-5
if r<0 then r=255
call mixedcolor
end sub
sub mixedcolor
#h.3 "flush"
#h.3 "place 120 80"
#h.3 "down"
rgb$= str$(r)+" "+str$(g)+" "+str$(b)
#h.3 "color ";r;" ";g;" ";b
#h.3 "backcolor "; rgb$
#h.3 "ellipsefilled 100 100"
#h.3 "place 10 10"
#h.3 " color white"
#h.3 " backcolor black"
#h.3 "\The colors are ";r;" ";g;" ";b;"***"
#h.3 "flush"
end sub
'
sub screen x,y
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=1
UpperLeftY=1
global ch$
global txt$
global name$
global name1$
global getsizeh'
global getsizev
graphicbox #h.1, 0,0,949,450
graphicbox #h.2, 0,500,1200,600
graphicbox #h.3, 950,1,1200,450
graphicbox #h.4, 0,451,949,499
open "THE FIRST REAL TIME GRAPHICS IDE (USE MOUSE LEFT/RIGHT BUTTON TO CLICK ON WORK AREAS TO MAKE THEM WORK" for window_nf as #h
print #h, "trapclose [quit]"
print #h.1, "down;backcolor black;fill black"
print #h.2, "down;backcolor black;fill 180 180 180"
print #h.3, "down;backcolor black;fill black"
print #h.4, "down;backcolor black;fill 120 130 125"
end sub
|
« Last Edit: Sep 7th, 2016, 12:50pm by michael » |
Logged
|
I make program generators and some utilities. Its my hobby
|
|
|
michael
New Member
member is offline
Posts: 28
|
|
Re: Graphics IDE with mouse draw tools
« Reply #1 on: Sep 7th, 2016, 04:29am » |
|
Here is the graphics template for pasting your code Code:call screen 800,600' Generic screen with graphics box to fit ( I may redesign)
'*******************************place graphics bellow here use #h.1 for draw device
'^^^^^^^^^^^^^^^^^^^^^^Put graphics and game stuff above^^^^^^^^^^^^^^^^
wait
[quit]
close #h
end
' Generic screen
sub screen x,y
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=0
UpperLeftY=0
graphicbox #h.1, 0,0,x-1,y-1
open "Generic Window Host" for window_nf as #h
print #h, "trapclose [quit]"
#h.1 "backcolor black;fill black;cls"
end sub
Here is a quick sample of what a person can do in a couple minutes using the powerful tools:
Code:
call screen 800,600' Generic screen with graphics box to fit ( I may redesign)
'*******************************place graphics bellow here use #h.1 for draw device
#h.1 "down"
#h.1 "color green"
#h.1 "place 416 227;ellipse 166 138"
#h.1 "line 500 298 331 298;line 331 298 331 157;line 331 157 500 157;line 500 157 500 298"
#h.1 "color yellow"
#h.1 "place 412 228;ellipse 667 148"
#h.1 "line 744 230 744 352"
#h.1 "line 523 406 744 352"
#h.1 "line 523 407 305 407"
#h.1 "line 80 341 305 407"
#h.1 "line 79 341 79 221"
'^^^^^^^^^^^^^^^^^^^^^^Put graphics and game stuff above^^^^^^^^^^^^^^^^
wait
[quit]
close #h
end
' Generic screen
sub screen x,y
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=0
UpperLeftY=0
graphicbox #h.1, 0,0,x-1,y-1
open "Generic Window Host" for window_nf as #h
print #h, "trapclose [quit]"
#h.1 "backcolor black;fill black;cls"
end sub
|
|
Logged
|
I make program generators and some utilities. Its my hobby
|
|
|
tsh73
Full Member
member is offline
Gender:
Posts: 210
|
|
Re: Graphics IDE with mouse draw tools
« Reply #2 on: Sep 7th, 2016, 06:48am » |
|
Quote:USE MOUSE *LEFT* BUTTON TO *RIGHT* CLICK |
| Err what?
Also, how I start line where I want? Also, why drawing a rectangle uses 4 lines with 4 parameters each (total 16) instead of place / box with 2 parameters each (makes only 4 numbers)?
EDIT If you put Code: between lines Code:'^^^^^^^^^^^^^^^^^^^^^^Put graphics and game stuff above^^^^^^^^^^^^^^^^
wait in template, your picture will stay on screen in JB/ LB.
|
« Last Edit: Sep 7th, 2016, 06:55am by tsh73 » |
Logged
|
|
|
|
michael
New Member
member is offline
Posts: 28
|
|
Re: Graphics IDE with mouse draw tools
« Reply #3 on: Sep 7th, 2016, 12:57pm » |
|
Deleted and Reposted here with warning asking that you would ensure that you were in the main LB directory or use the BMP folder where you are running the snippet.
* Fixed the confusion with the statement.OOPS (that mistake is old and no one pointed it out until now)
You would use UP/DOWN arrows to move your input line.
I only had 2 characters left in the post, so I really had to cut my explanations and assumed I had enough help info in the program.
*** You can use the normal draw commands that Liberty basic offers. I just made an example. ***
(its over a year old. I was assessing possible future use and improvement and stumbled on the problem.)
I actually deleted this post and moved it to this area so it would be in the proper location. (It will be the last time I move it.)
It was in General, and also, I had to modify the ON ERROR line as a comment, in case a person didn't have the BMP folder from LB. Sorry for the confusion.
|
« Last Edit: Sep 7th, 2016, 2:38pm by michael » |
Logged
|
I make program generators and some utilities. Its my hobby
|
|
|
|