I haven't looked at your tut yet but I'm sure that
I will find it usefull when I do because...
Thanks to you I have started my own 3D-Editor
Screenie -
<REVOVED>
ATM it's still buggy and doesn't do anything much but it's a
start
Edit: Great tut
Edit: I'm having some problems with my program
Here's the code that is most important:
sync on
sync rate 0
startblue "ID","PASS"
globals()
createUI()
createMainMenu()
make object cone 1,100
objx#=object position x(1)
objy#=object position y(1)
objz#=object position z(1)
make mesh from object 1,1
make memblock from mesh 1,1
delete mesh 1
delete Object 1
` memblock dword(1, 8) = Number of Vertecies
global vertex
vertex=memblock dword(1,8)
dim Selected(10000,2)
dim Polys#( (vertex/3) ,3,4)
` POLYS Verts XYZ Selected?
index=0
for v=1 to vertex-3
Polys#(index,1,1)=memblock float(1,(12+((32*v))-32)+0)+objx#
Polys#(index,1,2)=memblock float(1,(12+((32*v))-32)+4)+objy#
Polys#(index,1,3)=memblock float(1,(12+((32*v))-32)+8)+objz#
v=v+1
Polys#(index,2,1)=memblock float(1,(12+((32*v))-32)+0)+objx#
Polys#(index,2,2)=memblock float(1,(12+((32*v))-32)+4)+objy#
Polys#(index,2,3)=memblock float(1,(12+((32*v))-32)+8)+objz#
v=v+1
Polys#(index,3,1)=memblock float(1,(12+((32*v))-32)+0)+objx#
Polys#(index,3,2)=memblock float(1,(12+((32*v))-32)+4)+objy#
Polys#(index,3,3)=memblock float(1,(12+((32*v))-32)+8)+objz#
index=index+1
next v
oldindex=index
index=0
for a=0 to oldindex
print "Poly: "+str$(a)+"/"+str$(oldindex)
print " V1: Xpos - "+str$(polys#(a,1,1))
print " Ypos - "+str$(polys#(a,1,2))
print " Zpos - "+str$(polys#(a,1,3))
print " V2: Xpos - "+str$(polys#(a,2,1))
print " Ypos - "+str$(polys#(a,2,2))
print " Zpos - "+str$(polys#(a,2,3))
print " V3: Xpos - "+str$(polys#(a,3,1))
print " Ypos - "+str$(polys#(a,3,2))
print " Zpos - "+str$(polys#(a,3,3))
sync
sleep 5
cls
next a
index=0
for v=1 to vertex-3
write memblock float 1,(12+((32*v))-32)+0, polys#(index,1,1)
write memblock float 1,(12+((32*v))-32)+4, polys#(index,1,2)
write memblock float 1,(12+((32*v))-32)+8, polys#(index,1,3)
v=v+1
write memblock float 1,(12+((32*v))-32)+0, polys#(index,2,1)
write memblock float 1,(12+((32*v))-32)+4, polys#(index,2,2)
write memblock float 1,(12+((32*v))-32)+8, polys#(index,2,3)
v=v+1
write memblock float 1,(12+((32*v))-32)+0, polys#(index,3,1)
write memblock float 1,(12+((32*v))-32)+4, polys#(index,3,2)
write memblock float 1,(12+((32*v))-32)+8, polys#(index,3,3)
index=index+1
next v
make mesh from memblock 1,1
make object 1, 1, 0
set camera view screen width()/2+10,screen height()/2+10,screen width(),screen height()
autocam off
draw to back
ink rgb(255,255,255),1
box 0,0,screen width(),screen height()
refreshtop()
refreshside()
refreshleft()
do
`select_tool_top()
zoomcheck()
`draw_viewpoints()
getevent
select_tool_top()
vertex_size()
if tools=gadgetUnderMouse()
tool_select()
endif
menu_check()
refresh()
` refreshtop()
` refreshside()
` refreshleft()
rotate object 1,wrapvalue(object angle x(1)+1),wrapvalue(object angle y(1)+1),wrapvalue(object angle z(1)+1)
sync
loop
Just remove the functions and the blue gui stuff and it should work.
Here's the entire of the code-
`1) DWORD = FVF Format (Usually 338)
`2) DWORD = FVF Size (Default 36) (Size ,in bytes, of single vertex)
`3) DWORD = Number of Vertecies in mesh
`
` *Vertex - Section*
`4) a.FLOAT = X Position
` b.FLOAT = Y Position
` c.FLOAT = z Position
`
` a.FLOAT = Normal.1
` b.FLOAT = Normal.2
` c.FLOAT = Normal.3
`
`5) DWORD = Diffuse Colour (Colour of Vertex)
`6) FLOAT = U (Texture)
`7) FLOAT = V (Texture)
`
`NOTES: 36 x No. Of Vertecies in Mesh = Mesh Data Size.
` Every 3 Vertecies = 1 Polygon.
`Other NOTES: Top = X+Z Side = Z+Y Front = X+Y
sync on
sync rate 0
startblue "ID","PASS"
globals()
createUI()
createMainMenu()
make object cone 1,100
objx#=object position x(1)
objy#=object position y(1)
objz#=object position z(1)
make mesh from object 1,1
make memblock from mesh 1,1
delete mesh 1
delete Object 1
` memblock dword(1, 8) = Number of Vertecies
global vertex
vertex=memblock dword(1,8)
dim Selected(10000,2)
dim Polys#( (vertex/3) ,3,4)
` POLYS Verts XYZ Selected?
index=0
for v=1 to vertex-3
Polys#(index,1,1)=memblock float(1,(12+((32*v))-32)+0)+objx#
Polys#(index,1,2)=memblock float(1,(12+((32*v))-32)+4)+objy#
Polys#(index,1,3)=memblock float(1,(12+((32*v))-32)+8)+objz#
v=v+1
Polys#(index,2,1)=memblock float(1,(12+((32*v))-32)+0)+objx#
Polys#(index,2,2)=memblock float(1,(12+((32*v))-32)+4)+objy#
Polys#(index,2,3)=memblock float(1,(12+((32*v))-32)+8)+objz#
v=v+1
Polys#(index,3,1)=memblock float(1,(12+((32*v))-32)+0)+objx#
Polys#(index,3,2)=memblock float(1,(12+((32*v))-32)+4)+objy#
Polys#(index,3,3)=memblock float(1,(12+((32*v))-32)+8)+objz#
index=index+1
next v
oldindex=index
index=0
for a=0 to oldindex
print "Poly: "+str$(a)+"/"+str$(oldindex)
print " V1: Xpos - "+str$(polys#(a,1,1))
print " Ypos - "+str$(polys#(a,1,2))
print " Zpos - "+str$(polys#(a,1,3))
print " V2: Xpos - "+str$(polys#(a,2,1))
print " Ypos - "+str$(polys#(a,2,2))
print " Zpos - "+str$(polys#(a,2,3))
print " V3: Xpos - "+str$(polys#(a,3,1))
print " Ypos - "+str$(polys#(a,3,2))
print " Zpos - "+str$(polys#(a,3,3))
sync
sleep 5
cls
next a
index=0
for v=1 to vertex-3
write memblock float 1,(12+((32*v))-32)+0, polys#(index,1,1)
write memblock float 1,(12+((32*v))-32)+4, polys#(index,1,2)
write memblock float 1,(12+((32*v))-32)+8, polys#(index,1,3)
v=v+1
write memblock float 1,(12+((32*v))-32)+0, polys#(index,2,1)
write memblock float 1,(12+((32*v))-32)+4, polys#(index,2,2)
write memblock float 1,(12+((32*v))-32)+8, polys#(index,2,3)
v=v+1
write memblock float 1,(12+((32*v))-32)+0, polys#(index,3,1)
write memblock float 1,(12+((32*v))-32)+4, polys#(index,3,2)
write memblock float 1,(12+((32*v))-32)+8, polys#(index,3,3)
index=index+1
next v
make mesh from memblock 1,1
make object 1, 1, 0
set camera view screen width()/2+10,screen height()/2+10,screen width(),screen height()
autocam off
draw to back
ink rgb(255,255,255),1
box 0,0,screen width(),screen height()
refreshtop()
refreshside()
refreshleft()
do
`select_tool_top()
zoomcheck()
`draw_viewpoints()
getevent
select_tool_top()
vertex_size()
if tools=gadgetUnderMouse()
tool_select()
endif
menu_check()
refresh()
` refreshtop()
` refreshside()
` refreshleft()
rotate object 1,wrapvalue(object angle x(1)+1),wrapvalue(object angle y(1)+1),wrapvalue(object angle z(1)+1)
sync
loop
global zoom#
zoom = 100
function refresh()
if mousex()>0
if mousex()<screen width()/2-10
`Either Top or Side :)
if mousey()>0
if mousey()<screen height()/2-10
`Redraw Top
refreshtop()
endif
endif
if mousey()>screen height()/2+10
`Redraw Side
refreshside()
endif
endif
endif
if mousex()>screen width()/2+10
if mousey()>0
if mousey()<screen height()/2-10
`Refresh Left
refreshleft()
endif
endif
endif
endfunction
function zoomcheck()
msmvz = mousemovez()
if msmvz < 0
inc Gradientpos#,0.2
endif
if msmvz > 0
inc Gradientneg#,0.2
endif
zoom# = zoom# + Gradientpos#
zoom# = zoom# - Gradientneg#
if Gradientpos# >0 then Gradientpos# = Gradientpos# - 0.1
if Gradientneg# >0 then Gradientneg# = Gradientneg# - 0.1
endfunction
function refreshtop()
ink rgb(100,100,100),1
box 0,0,screen width()/2-10,screen height()/2-10
ink rgb(50,50,50),1
for x=0 to screen width()/2-10 step 10
line x,0,x,screen height()/2-10
next x
for y=0 to screen height()/2-10 step 10
line 0,y,screen width()/2-10,y
next y
ink rgb(255,255,255),1
vertex=memblock dword(1,8)
for polygon = 1 to vertex/3
x1=int((screen width()/2-10)/2+int(polys#(polygon,1,1)*zoom#))-int(zoom#/10)
y1=int((screen height()/2-10)/2+int(polys#(polygon,1,3)*zoom#))-int(zoom#/10)
if between(0,screen width()/2-10,x1)=1 and between(0,screen height()/2-10,y1)=1
circle x1,y1,2
endif
x2=int((screen width()/2-10)/2+int(polys#(polygon,2,1)*zoom#))-int(zoom#/10)
y2=int((screen height()/2-10)/2+int(polys#(polygon,2,3)*zoom#))-int(zoom#/10)
if between(0,screen width()/2-10,x2)=1 and between(0,screen height()/2-10,y2)=1
circle x2,y2,2
endif
x3=int((screen width()/2-10)/2+int(polys#(polygon,3,1)*zoom#))-int(zoom#/10)
y3=int((screen height()/2-10)/2+int(polys#(polygon,3,3)*zoom#))-int(zoom#/10)
if between(0,screen width()/2-10,x3)=1 and between(0,screen height()/2-10,y3)=1
circle x3,y3,2
endif
drawlinec(x1,y1,x2,y2,0,0,screen width()/2-10,screen height()/2-10)
drawlinec(x2,y2,x3,y3,0,0,screen width()/2-10,screen height()/2-10)
drawlinec(x1,y1,x3,y3,0,0,screen width()/2-10,screen height()/2-10)
next
endfunction
function refreshside()
ink rgb(100,100,100),1
box 0,screen height()/2+10,screen width()/2-10,screen height()
ink rgb(50,50,50),1
for x=0 to screen width()/2-10 step 10
line x,screen height()/2+10,x,screen height()
next x
for y=screen height()/2+10 to screen height() step 10
line 0,y,screen width()/2-10,y
next y
ink rgb(255,255,255),1
vertex=memblock dword(1,8)
for polygon = 1 to vertex/3
x1=int((screen width()/2-10)/2+int(polys#(polygon,1,2)*zoom#))-int(zoom#/10)
y1=int((screen height()/2-10)/2+int(polys#(polygon,1,3)*zoom#))-int(zoom#/10)+300
if between(0,screen width()/2-10,x1)=1 and between(screen height()/2+10,screen height(),y1)=1
circle x1,y1,2
endif
x2=int((screen width()/2-10)/2+int(polys#(polygon,2,2)*zoom#))-int(zoom#/10)
y2=int((screen height()/2-10)/2+int(polys#(polygon,2,3)*zoom#))-int(zoom#/10)+300
if between(0,screen width()/2-10,x2)=1 and between(screen height()/2+10,screen height(),y2)=1
circle x2,y2,2
endif
x3=int((screen width()/2-10)/2+int(polys#(polygon,3,2)*zoom#))-int(zoom#/10)
y3=int((screen height()/2-10)/2+int(polys#(polygon,3,3)*zoom#))-int(zoom#/10)+300
if between(0,screen width()/2-10,x3)=1 and between(screen height()/2+10,screen height(),y3)=1
circle x3,y3,2
endif
drawlinec(x1,y1,x2,y2,0,screen height()/2+10,screen width()/2-10,screen height())
drawlinec(x2,y2,x3,y3,0,screen height()/2+10,screen width()/2-10,screen height())
drawlinec(x1,y1,x3,y3,0,screen height()/2+10,screen width()/2-10,screen height())
next
endfunction
function refreshleft()
ink rgb(100,100,100),1
box screen width()/2+10,0,screen width(),screen height()/2-10
ink rgb(50,50,50),1
for x=screen width()/2+10 to screen width() step 10
line x,0,x,screen height()/2-10
next x
for y=0 to screen height()/2-10 step 10
line screen height()/2+110,y,screen height()+500,y
next y
ink rgb(255,255,255),1
vertex=memblock dword(1,8)
for polygon = 1 to vertex/3
x1=int((screen width()/2-10)/2+int(polys#(polygon,1,1)*zoom#))-int(zoom#/10)+430
y1=int((screen height()/2-10)/2+int(polys#(polygon,1,2)*zoom#))-int(zoom#/10)
if between(screen width()/2+10,screen width(),x1)=1 and between(0,screen height()/2-10,y1)=1
circle x1,y1,2
endif
x2=int((screen width()/2-10)/2+int(polys#(polygon,2,1)*zoom#))-int(zoom#/10)+430
y2=int((screen height()/2-10)/2+int(polys#(polygon,2,2)*zoom#))-int(zoom#/10)
if between(screen width()/2+10,screen width(),x2)=1 and between(0,screen height()/2-10,y2)=1
circle x2,y2,2
endif
x3=int((screen width()/2-10)/2+int(polys#(polygon,3,1)*zoom#))-int(zoom#/10)+430
y3=int((screen height()/2-10)/2+int(polys#(polygon,3,2)*zoom#))-int(zoom#/10)
if between(screen width()/2+10,screen width(),x3)=1 and between(0,screen height()/2-10,y3)=1
circle x3,y3,2
endif
drawlinec(x1,y1,x2,y2,screen width()/2+10,0,screen width(),screen height()/2-10)
drawlinec(x2,y2,x3,y3,screen width()/2+10,0,screen width(),screen height()/2-10)
drawlinec(x1,y1,x3,y3,screen width()/2+10,0,screen width(),screen height()/2-10)
next
endfunction
function drawlinec(Ax as float,Ay as float,Bx as float,By as float,culx1,culy1,culx2,culy2)
local Dx as float
local Dy as float
local NumSteps as float
Dx=Bx-Ax
Dy=By-Ay
Bx=abs(Dx)
By=abs(Dy)
if Bx>By
NumSteps=Bx
else
NumSteps=By
endif
Bx=Dx/NumSteps
By=Dy/NumSteps
while (NumSteps>=0.0)
dot Ax,Ay
inc Ax,Bx
inc Ay,By
if between(culx1,culx2,Ax)=0 or between(culy1,culy2,Ay)=0
exitfunction
endif
dec NumSteps
endwhile
endfunction
function select_tool_top()
if mouseclick()=1
if select_tool=1 and selection=0
if mousex()>0 and mousex()<screen width()/2-10 and mousey()>0 and mousey()<screen height()/2-10
`Set starting x+y coords
sel_x=mousex()
sel_y=mousey()
box sel_x,sel_y,mousex(),mousey()
selection=1
endif
endif
endif
if mouseclick()=1 and selection=1 and select_tool=1
box sel_x,sel_y,mousex(),mousey()
endif
if select_tool=1 and selection=1 and mouseclick()=0
end_x=mousex()
end_y=mousey()
`Start selecting!!!!!
for a=1 to vertex/3
for b=1 to 3
if between(sel_x,end_x,int((screen width()/2-10)/2+int(polys#(a,b,1)*zoom#))-int(zoom#/10))=1
if between(sel_y,end_y,int((screen width()/2-10)/2+int(polys#(a,b,3)*zoom#))-int(zoom#/10))=1
`Select it!
polys#(a,b,4)=1
endif
endif
next b
next a
endif
endfunction
function between(a,b,c)
`Is c between a+b?
if a<b
if c>a and c<b
`Woo! it is!
return#=1
exitfunction return#
endif
else
if c<a and c>b
`Woo! it is!
return#=1
exitfunction return#
endif
endif
`Awwwww, it's not :(
return#=0
endfunction return#
function tool_select()
if eventtype() = mouse_click
if eventsource() = selectbutton
tool_selected = selectbutton
setGadgetVisible SelectSETTINGS, 1
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = vertexbutton
tool_selected = vertexbutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 1
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = polygonbutton
tool_selected = polygonbutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 1
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = scalebutton
tool_selected = scalebutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 1
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = rotatebutton
tool_selected = rotatebutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 1
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = facebutton
tool_selected = facebutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 1
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = extrudebutton
tool_selected = extrudebutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 1
setGadgetVisible ObjectSETTINGS, 0
endif
if eventsource() = objectbutton
tool_selected = objectbutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 1
endif
if eventsource() = movebutton
tool_selected = movebutton
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible MoveSETTINGS, 1
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endif
endif
endfunction
function vertex_size()
if gadgetclicked() = SIZEvertexSETTINGS
data$ = itemText( SIZEvertexSETTINGS, selectedItem( SIZEvertexSETTINGS ))
if data$ = "1" then vertex_draw_size = 1
if data$ = "2" then vertex_draw_size = 2
if data$ = "3" then vertex_draw_size = 3
if data$ = "4" then vertex_draw_size = 4
if data$ = "5" then vertex_draw_size = 5
endif
endfunction
function menu_check()
if eventdata() = 4
set window size 0,0
if questionMessage("Are you sure?", "Exit?") = 1
end
else
set window size 800,600
endif
endif
endfunction
function globals()
global menu
#constant MENU_FILE 0
global menuFile
#constant MENU_NEW 1
#constant MENU_SAVE 2
#constant MENU_EXIT 4
#constant MENU_VIEW 5
#constant MENU_TOOLS 6
#constant MENU_HELP 7
global menuHelp
#constant MENU_HELPDOCUMENTS 8
#constant MENU_ABOUT 10
global selections
global sel_x
global set_y
global select_tool
global selection
global tool_selected
global Tools
global Main
global SelectBUTTON
global MoveBUTTON
global ScaleBUTTON
global RotateBUTTON
global ExtrudeBUTTON
global ObjectBUTTON
global PolygonBUTTON
global VertexBUTTON
global SelectSETTINGS
global VertexSELECT
global FaceSELECT
global GroupSETTINGS
global MoveSETTINGS
global XmoveSETTINGS
global YmoveSETTINGS
global ZmoveSETTINGS
global ScaleSETTINGS
global CENTREscaleSETTINGS
global XscaleAXIS
global YscaleSETTINGS
global ZscaleSETTINGS
global ALLscaleSETTINGS
global EQUALscaleSETTINGS
global RotateSETTINGS
global STICKYrotateSETTINGS
global CENTRErotateSETTINGS
global ExtrudeSETTINGS
global TOGextrudeSETTINGS
global SEPextrudeSETTINGS
global ObjectSETTINGS
global BOXobjectSETTINGS
global SPHEREobjectSETTINGS
global SPHBOXobjectSETTINGS
global RowEDITobjectSETTINGS
global ROWSobjectSETTINGS
global COLUMNSobjectSETTINGS
global ColEDTobjectSETTINGS
global CONEobjectSETTINGS
global PolygonSETTINGS
global DRAWpolygonSETTINGS
global SELpolygonSETTINGS
global VertexSETTINGS
global SIZEvertexSETTINGS
global DRAWvertexSETTINGS
global vertex_draw_size = 2
endfunction
function createUI()
set window on
set window layout 1,1,0
set window size 800,600
set window title "3D-Editor by Matinuker"
Tools=createWindow(102,197,163,437,"Tools",WINDOW_FIXED,WINDOW_TOOLWINDOW,0,0)
Main=createPanel(-1,0,191,670,Tools)
setPanelBorderStyle Main,2
SelectBUTTON=createButton(-1,-1,75,25,"Select",0,Main)
MoveBUTTON=createButton(76,-1,76,25,"Move",0,Main)
ScaleBUTTON=createButton(-1,27,75,25,"Scale",0,Main)
RotateBUTTON=createButton(76,27,75,25,"Rotate",0,Main)
ExtrudeBUTTON=createButton(-1,55,75,25,"Extrude",0,Main)
ObjectBUTTON=createButton(76,55,75,25,"Object",0,Main)
PolygonBUTTON=createButton(-1,83,75,25,"Polygon",0,Main)
VertexBUTTON=createButton(76,83,75,25,"Vertex",0,Main)
SelectSETTINGS=createFrame(2,112,146,285,"Select -",Main)
VertexSELECT=createButton(3,19,75,25,"Vertex",0,SelectSETTINGS)
FaceSELECT=createButton(3,50,75,25,"Face",0,SelectSETTINGS)
MoveSETTINGS=createFrame(2,112,146,285,"Move -",Main)
XmoveSETTINGS=createCheckBox(12,16,75,20,"X-Axis",MoveSETTINGS)
YmoveSETTINGS=createCheckBox(12,38,75,20,"Y-Axis",MoveSETTINGS)
ZmoveSETTINGS=createCheckBox(12,61,75,20,"Z-Axis",MoveSETTINGS)
ScaleSETTINGS=createFrame(2,112,146,285,"Scale -",Main)
CENTREscaleSETTINGS=createCheckBox(16,17,75,20,"From Centre",ScaleSETTINGS)
XscaleAXIS=createCheckBox(16,89,75,20,"X-Axis",ScaleSETTINGS)
YscaleSETTINGS=createCheckBox(16,112,75,20,"Y-Axis",ScaleSETTINGS)
ZscaleSETTINGS=createCheckBox(16,135,75,20,"Z-Axis",ScaleSETTINGS)
ALLscaleSETTINGS=createCheckBox(16,39,75,20,"All Axis",ScaleSETTINGS)
EQUALscaleSETTINGS=createCheckBox(16,63,84,17,"Equal Scaling",ScaleSETTINGS)
RotateSETTINGS=createFrame(2,112,146,285,"Rotate -",Main)
STICKYrotateSETTINGS=createCheckBox(18,18,97,21,"Sticky Rotation",RotateSETTINGS)
CENTRErotateSETTINGS=createCheckBox(18,43,97,17,"From Centre",RotateSETTINGS)
ExtrudeSETTINGS=createFrame(2,112,146,285,"Extrude -",Main)
TOGextrudeSETTINGS=createRadioButton(22,20,88,20,"Together",ExtrudeSETTINGS)
SEPextrudeSETTINGS=createRadioButton(22,50,88,20,"Seperatly",ExtrudeSETTINGS)
ObjectSETTINGS=createFrame(2,112,146,285,"Object -",Main)
BOXobjectSETTINGS=createButton(10,20,75,25,"Box",0,ObjectSETTINGS)
SPHBOXobjectSETTINGS=createPanel(7,92,113,111,ObjectSETTINGS)
setPanelBorderStyle SPHBOXobjectSETTINGS,2
SPHEREobjectSETTINGS=createButton(3,3,75,25,"Sphere",0,SPHBOXobjectSETTINGS)
RowEDITobjectSETTINGS=createEdit(6,39,75,20,0,SPHBOXobjectSETTINGS)
ROWSobjectSETTINGS=createLabel(8,26,50,20,"Rows",SPHBOXobjectSETTINGS)
COLUMNSobjectSETTINGS=createLabel(8,59,50,15,"Columns",SPHBOXobjectSETTINGS)
ColEDTobjectSETTINGS=createEdit(6,74,75,20,0,SPHBOXobjectSETTINGS)
CONEobjectSETTINGS=createButton(8,56,75,25,"Cone",0,ObjectSETTINGS)
PolygonSETTINGS=createFrame(2,112,146,285,"Polygon -",Main)
DRAWpolygonSETTINGS=createRadioButton(10,24,120,20,"Draw Vertecies",PolygonSETTINGS)
SELpolygonSETTINGS=createRadioButton(10,50,122,19,"Select Vertecies",PolygonSETTINGS)
VertexSETTINGS=createFrame(2,112,146,285,"Vertex -",Main)
SIZEvertexSETTINGS=createComboBox(8,44,75,100,VertexSETTINGS)
DRAWvertexSETTINGS=createLabel(9,24,77,16,"Draw Size:",VertexSETTINGS)
addItem SIZEvertexSETTINGS,"1"
addItem SIZEvertexSETTINGS,"2"
addItem SIZEvertexSETTINGS,"3"
addItem SIZEvertexSETTINGS,"4"
addItem SIZEvertexSETTINGS,"5"
setGadgetVisible MoveSETTINGS, 0
setGadgetVisible SelectSETTINGS, 0
setGadgetVisible VertexSETTINGS, 0
setGadgetVisible PolygonSETTINGS, 0
setGadgetVisible ScaleSETTINGS, 0
setGadgetVisible RotateSETTINGS, 0
setGadgetVisible FaceSETTINGS, 0
setGadgetVisible ExtrudeSETTINGS, 0
setGadgetVisible ObjectSETTINGS, 0
endfunction
function createMainMenu()
menu=createMenu(0)
addMenuItem menu,"File",0
menuFile=createSubMenu(menu,0)
addMenuItem menuFile,"New",1
addMenuItem menuFile,"Save",2
addMenuSplitter menuFile
addMenuItem menuFile,"Exit",4
addMenuItem menu,"View",5
addMenuItem menu,"Tools",6
addMenuItem menu,"Help",7
menuHelp=createSubMenu(menu,7)
addMenuItem menuHelp,"Help Documents",8
addMenuSplitter menuHelp
addMenuItem menuHelp,"About",10
endfunction
gui_stuff()
Function gui_stuff()
`Gadget Constants (gui.dba)
`==========================
`Robert Knight 2004
`BlueGUI v2. edition
`Information about this file
`==========================
`Constants give names to numbers. For example, after clicking on a gadget, eventType() will return 514 (which
`can also be written as 0x202). This number isn't very helpful if you are trying to remember it to use in an
`IF statement, or if you are trying to understand some code you wrote previously. Hence this file provides the constant
`MOUSE_CLICK=0x202. In your code you can simply do:
`If eventType()=MOUSE_CLICK
`...
`Endif
`Which is far more readable, especially when you come back to look at code you have not been working on for a while
`How to include this file
`==========================
`You do not *have* to use this file, but it is strongly recommended. In order to use this file, you can either put
`#include "gui.dba"
`at the top of your main source file, or you can use the Browse button on the Files tab (normal editor) or the Browse button
`above the includes list on the Project tab (BlueIDE)
`This is used so you can tell if the gui.dba file was included or not
#constant GUI_CONSTANTS 1
`eventType() Constants
`===========================================================================================================================
`These are the different types of messages which eventType() can return.
`[Advanced Users: These are the same as the WM_XXX messages used by the Windows API. For some messages the eventData() and
`eventDataEx() information may be changed by the DLL to make it more convenient for users]
#constant MOUSE_CLICK 0x202
#constant LEFTBUTTON_UP 0x202
#constant RIGHTMOUSE_CLICK 0x205
#constant RIGHTBUTTON_UP 0x205
#constant MOUSE_MOVE 0x200
#constant GADGET_TIMER 0x113
#constant MENU_CLICK 0x111
#constant TOOLBAR_CLICK 0x111
#constant HOTKEY 0x312
#constant LEFTBUTTON_DOWN 513
#constant KEYDOWN 0x100
#constant KEYUP 0x101
#constant COMBOBOX_CHANGE 0x111
#constant TREEVIEW_CHANGE 0x111
#constant LOSEFOCUS 0x8
#constant GADGET_SIZING 0x214
#constant GADGET_SIZE 0x5
#constant WINDOW_CLOSE 0x10
#constant SCROLLBAR_CHANGE 0xE0
`setPanelBorderStyle Constants
`===========================================================================================================================
`These values are passed as the borderStyle parameter of setPanelBorderStyle to set the appearence of a panel gadget
#constant BORDER_NONE 0
#constant BORDER_FLAT 1
#constant BORDER_3D 2
#constant BORDER_SUNKEN 3
`setGadgetAlign Constants
`===========================================================================================================================
`These values set how the gadget auto-aligns to its parent
#constant ALIGN_NONE 0
#constant ALIGN_ALL 1
#constant ALIGN_TOP 2
#constant ALIGN_LEFT 3
#constant ALIGN_RIGHT 4
#constant ALIGN_BOTTOM 5
`Standard Toolbar Buttons
`===========================================================================================================================
`These are the values you pass to addButton to add standard buttons like file open / save, cut/copy/paste etc. to a toolbar
`gadget.
`In order to use these, you must call addStandardButtons immediately after you create the toolbar, eg:
`
`toolbar=createToolbar(0)
`addStandardButtons toolbar
`addButton toolbar,TOOLBAR_OPEN,0
#constant TOOLBAR_CUT 0
#constant TOOLBAR_COPY 1
#constant TOOLBAR_PASTE 2
#constant TOOLBAR_UNDO 3
#constant TOOLBAR_REDO 4
#constant TOOLBAR_DELETE 5
#constant TOOLBAR_NEW 6
#constant TOOLBAR_OPEN 7
#constant TOOLBAR_SAVE 8
#constant TOOLBAR_PRINTPREVIEW 9
#constant TOOLBAR_PROPERTIES 10
#constant TOOLBAR_HELP 11
#constant TOOLBAR_FIND 12
#constant TOOLBAR_REPLACE 13
#constant TOOLBAR_PRINT 14
`createWindow Style Options
`===========================================================================================================================
`These values are passed to createWindow to set the style and appearence of the window.
`Generally speaking, the only values you will normally need to use are WINDOW_NORMAL or WINDOW_FIXED for the styles parameter,
`and either 0 or WINDOW_TOOLWINDOW for the extraStyles parameter.
`If you want to put multiple styles together, just add them! (see WINDOW_NORMAL comment below)
`styles
`******
`Gives the window a titlebar
#constant WINDOW_TITLEBAR 12582912
`With the exception of toolwindows,
`this also adds a system menu and icon to the window
#constant WINDOW_CLOSEBUTTON 524288
`Windows with a maximize button must also have a close button
#constant WINDOW_MAXBUTTON 65536
`Windows with a minimize button must also have a close button
#constant WINDOW_MINBUTTON 131072
`Allows the user to drag the edges of the window to resize it
#constant WINDOW_RESIZEABLE 262144
`A window with no border
#constant WINDOW_NOBORDER -2147483648
`extraStyles
`***********
`Like a normal window, but with a thinner frame and no system menu - usually used for floating toolboxes.
#constant WINDOW_TOOLWINDOW 128
`standard styles (created from ones above)
`*****************************************
`A normal resizeable window with close,min & max buttons
`WINDOW_TITLEBAR+WINDOW_CLOSEBUTTON+WINDOW_MAXBUTTON+WINDOW_MINBUTTON+WINDOW_RESIZEABLE
#constant WINDOW_NORMAL 13565952
`A dialog-type window with a caption and close button but a fixed size
`WINDOW_TITLEBAR+WINDOW_CLOSEBUTTON
#constant WINDOW_FIXED 13107200
#constant WINDOW_OVR 0
`setListViewStyle Viewing Mode Options
`===========================================================================================================================
`Listview gadgets are highly flexible, and have several different ways in which they can display information. These are the
`different possible viewing style values
#constant LISTVIEW_ICON 0 `Big icons with captions underneath, ideal for texture/model browsers etc
#constant LISTVIEW_REPORT 1 `A table where each item can have additional information (subitems) listed as well
#constant LISTVIEW_LIST 3 `Small icons with captions to their right.
EndFunction
remstart
function draw_viewpoints()
ink rgb(100,100,100),1
box 0,0,screen width()/2-10,screen height()/2-10
box 0,screen height()/2+10,screen width()/2-10,screen height()
box screen width()/2+10,0,screen width(),screen height()/2-10
ink rgb(50,50,50),1
for x=0 to screen width() step 10
line x,0,x,screen height()
next x
for y=0 to screen height() step 10
line 0,y,screen width(),y
next y
set camera view screen width()/2+10,screen height()/2+10,screen width(),screen height()
endfunction