my vres is
SetWindowSize( 1024, 768, 1 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
I have everything else showing,here is the whole code:
// Project: menumake_standalone
// Created: 2016-07-29
// show all errors
//SetErrorMode(2)
// set window properties
SetWindowTitle( "menumake_standalone" )
SetWindowSize( 1024, 768, 1 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
#constant maxbuttons=12
#constant KEY_ENTER = 13
#CONSTANT KEY_ESCAPE=27
#constant KEY_F1=112
#constant KEY_F4=115
#constant KEY_F5=116
#constant KEY_F8=119
#constant KEY_F7=118
type TMouse
x1#
y1#
x2#
y2#
x4
y4
x4#
y4#
x3
y3
endtype
type buttons
btext$ as string
buttonid as integer
oldx as integer
oldy as integer
size# as float
tilevalue
tilevalue2
red as integer
green as integer
blue as integer
readytoselect as integer
alpha as integer
role as integer
set as integer
endtype
dim button[maxbuttons] as buttons
global Mouse as TMouse
global buttonpointer = 0
global buttoncount = 0
global buttonalpha = 255
global buttonred = 255
global buttongreen = 255
global buttonblue = 255
global button_name$="Button"
global text_name$="Text String"
global texteditbox=300
global buttoneditbox=301
global bsizebox=302
global textsizebox=303
global balphabox=304
global talpha=255
global balpha=255
global buttonredbox=305
global buttongreenbox=306
global buttonbluebox=307
global talphabox=308
global mybsize#=80
global mytsize=40
global followmouse=0
global oldx# = 0
global oldy# = 0
global baseboxX# = 10
global baseboxY# = 600
global ygap# = 28
global diff# = 150
global gridx = 32
global gridy = 32
global myboxcol=47
global mycursor=1
global mode=0
global mylayoutname$="default.dat"
global bdropsprite=2000
//global backdropimage=20
init()
menu_designer()
end
function Menu_designer()
//createmyeditbox(texteditbox,baseboxX#*5-diff#,baseboxY#+ygap#*2,1,255,0,0,0,110,20,255,text_name$,1)
//createmyeditbox(textsizebox,baseboxX#*5-diff#,baseboxY#+ygap#*3,1,255,0,0,0,40,20,255,"20",1)
//createmyeditbox(talphabox,baseboxX#*5-diff#,baseboxY#+ygap#*4,1,255,0,0,0,40,20,255,str(talpha),1)
repeat
if getspriteexists(bdropsprite)
print("bdrop exists!!")
endif
drawbox(mouse.x3-mybsize#/2,mouse.y3-mybsize#/2,mouse.x3+mybsize#/2,mouse.y3+mybsize#/2,myboxcol,myboxcol,myboxcol,myboxcol,0)
if getrawkeypressed(KEY_F8)
clear_layout()
endif
if getrawkeypressed(KEY_F7)
select_image()
endif
if getrawkeypressed(KEY_F5)
inc mode
if mode>1
mode=0
endif
select mode
case 1
hide_stuff()
endcase
case 0
show_stuff()
endcase
endselect
endif
print(str(mouse.x3))
if getrawkeypressed(KEY_ESCAPE)
quit=1
endif
if getrawkeypressed(KEY_ENTER)
read_editor_boxes()
endif
//read_editor_boxes()
FillMouse(gridx,gridy)
f=gettexthittest(3000,Mouse.x2#,Mouse.y2#)
v=GetRawMouseRightReleased()
if getpointerpressed() and buttoncount<12
inc buttonpointer
inc buttoncount
make_my_button(buttonpointer,mouse.x3,mouse.y3,mybsize#,button_name$,buttonred,buttongreen,buttonblue,balpha)
set_value(buttonpointer)
endif
if getspriteexists(mycursor)
setspriteposition(mycursor,mouse.x3-getspritewidth(mycursor)/2,mouse.y3-getspriteheight(mycursor)/2)
endif
if getrawkeypressed(KEY_F4)
save_layout(mylayoutname$)
endif
if getrawkeypressed(KEY_F1)
load_layout(mylayoutname$)
endif
sync()
until quit=1
for n=1 to 12
if getvirtualbuttonexists(n)
deletevirtualbutton(n)
endif
next n
quit=0
deletetext(3000)
endfunction
// Read the boxes and set appropriate values
function read_editor_boxes()
focus=GetCurrentEditBox()
select focus
case bsizebox
t$=geteditboxtext(bsizebox)
t#=valfloat(t$)
mybsize#=t#
endcase
case textsizebox
t$=geteditboxtext(textsizebox)
t=val(t$)
mytsize=t
endcase
case buttoneditbox
t$=geteditboxtext(buttoneditbox)
button_name$=t$
endcase
case texteditbox
t$=geteditboxtext(buttoneditbox)
text_name$=t$
endcase
case buttonredbox
t$=geteditboxtext(buttonredbox)
t=val(t$)
buttonred=t
endcase
case buttongreenbox
t$=geteditboxtext(buttongreenbox)
t=val(t$)
buttongreen=t
endcase
case buttonbluebox
t$=geteditboxtext(buttonbluebox)
t=val(t$)
buttonblue=t
endcase
endselect
endfunction
function save_layout(f$)
myfile=opentowrite(f$,0)
for n=1 to maxbuttons
writestring(myfile,button[n].btext$)
writeinteger(myfile,button[n].alpha)
writeinteger(myfile,button[n].blue)
writeinteger(myfile,button[n].buttonid)
writeinteger(myfile,button[n].green)
writeinteger(myfile,button[n].oldx)
writeinteger(myfile,button[n].oldy)
writeinteger(myfile,button[n].readytoselect)
writeinteger(myfile,button[n].red)
writeinteger(myfile,button[n].role)
writeinteger(myfile,button[n].set)
writefloat(myfile,button[n].size#)
writeinteger(myfile,button[n].tilevalue)
writeinteger(myfile,button[n].tilevalue2)
next n
closefile(myfile)
print("Layout Saved!")
sync()
sleep(3000)
endfunction
function load_layout(f$)
if getfileexists(f$)
clear_layout()
myfile=opentoread(f$)
for n=1 to maxbuttons
button[n].btext$=readstring(myfile)
button[n].alpha=readinteger(myfile)
button[n].blue=readinteger(myfile)
button[n].buttonid=readinteger(myfile)
button[n].green=readinteger(myfile)
button[n].oldx=readinteger(myfile)
button[n].oldy=readinteger(myfile)
button[n].readytoselect=readinteger(myfile)
button[n].red=readinteger(myfile)
button[n].role=readinteger(myfile)
button[n].set=readinteger(myfile)
button[n].size#=readfloat(myfile)
button[n].tilevalue=readinteger(myfile)
button[n].tilevalue2=readinteger(myfile)
next n
closefile(myfile)
endif
for n=1 to maxbuttons
if button[n].buttonid<>0
//xc=worldtoscreenx(button[n].oldx)
//yc=worldtoscreeny(button[n].oldy)
//AddVirtualButton(button[n].buttonid,button[n].oldx,button[n].oldy,button[n].size#)
AddVirtualButton(button[n].buttonid,button[n].oldx,button[n].oldy,button[n].size#)
setvirtualbuttontext(button[n].buttonid,button[n].btext$)
SetVirtualButtonColor(button[n].buttonid,button[n].red,button[n].green,button[n].blue)
SetVirtualButtonAlpha(button[n].buttonid,button[n].alpha)
SetVirtualButtonVisible(button[n].buttonid,1)
inc buttoncount
endif
if buttonpointer<=button[n].buttonid and button[n].buttonid <12
buttonpointer=button[n].buttonid+1
endif
next n
print("Layout Loaded!")
//for n=1 to 12
endfunction
function clear_layout()
for n=1 to maxbuttons
button[n].btext$=""
button[n].alpha=0
button[n].blue=0
button[n].buttonid=0
button[n].green=0
button[n].oldx=0
button[n].oldy=0
button[n].readytoselect=0
button[n].red=0
button[n].role=0
button[n].set=0
button[n].size#=0
button[n].tilevalue=0
button[n].tilevalue2=0
if GetVirtualButtonExists(n)
DeleteVirtualButton(n)
endif
next n
buttonpointer=0
buttoncount=0
endfunction
function createmytext(number,x#,y#,size,r,g,b,mystring$,depth)
createtext(number,mystring$)
settextsize(number,size)
settextcolor(number,r,b,g,talpha)
SetTextPosition(number,x#,y#)
FixTextToScreen(number,1)
settextdepth(number,depth)
endfunction
function createmyeditbox(number,x#,y#,bordersize#,r,g,b,backcolor,bsizex#,bsizey#,alpha,box$,v)
createeditbox(number)
SetEditBoxBorderSize(number,bordersize#)
SetEditBoxTextColor(number,r,g,b)
SetEditBoxBorderColor(number,r,g,b,alpha)
SetEditBoxBackgroundColor( number, 0, 0, 0, alpha )
seteditboxsize(number,bsizex#,bsizey#)
SetEditBoxPosition(number,x#,y#)
FixEditBoxToScreen(number,1)
seteditboxdepth(number,0)
SetEditBoxText(number,box$)
seteditboxvisible(number,v)
endfunction
function FillMouse(gridx,gridy)
Mouse.x1#=getpointerx()
Mouse.y1#=getpointery()
Mouse.x2#=screentoworldx(Mouse.x1#)
Mouse.y2#=screentoworldy(Mouse.y1#)
Mouse.x3=floor(Mouse.x2#/gridx)*gridx
Mouse.y3=floor(Mouse.y2#/gridy)*gridy
endfunction
function make_my_button(index,x,y,size#,text$,br,bg,bb,al)
AddVirtualButton( index,x, y, size# )
setvirtualbuttontext(index,text$)
SetVirtualButtonColor(index,br,bg,bb)
SetVirtualButtonAlpha(index,al)
SetVirtualButtonVisible(index,1)
endfunction
function set_value(buttn)
button[buttn].buttonid=buttn
button[buttn].oldx=mouse.x3
button[buttn].oldy=mouse.y3
button[buttn].size#=mybsize#
button[buttn].btext$=button_name$
button[buttn].red=buttonred
button[buttn].green=buttongreen
button[buttn].blue=buttonblue
button[buttn].alpha=balpha
endfunction
function init()
createmytext(1,baseboxX#,baseboxY#-1+ygap#*2,25,255,0,0,"B-name --",0)
createmytext(2,baseboxX#,baseboxY#-1+ygap#*3,25,255,0,0,"B-size --",0)
createmytext(3,baseboxX#,baseboxY#-1+ygap#*4,25,255,0,0,"B-Alpha -",0)
createmytext(4,baseboxX#+diff#*3,baseboxY#-1+ygap#*2,25,255,0,0,"B-Red --",0)
createmytext(5,baseboxX#+diff#*3,baseboxY#-1+ygap#*3,25,255,0,0,"B-Green -",0)
createmytext(6,baseboxX#+diff#*3,baseboxY#-1+ygap#*4,25,255,0,0,"B-Blue --",0)
createmytext(3000,10,10,25,255,0,0,"Create Button",0)
v$=str(mybsize#)
mbs$=left(v$,2)
createmyeditbox(buttoneditbox,baseboxX#+diff#,baseboxY#+ygap#*2,1,255,0,0,0,110,20,255,button_name$,1)
createmyeditbox(bsizebox,baseboxX#+diff#,baseboxY#+ygap#*3,1,255,0,0,0,40,20,255,mbs$,1)
createmyeditbox(balphabox,baseboxX#+diff#,baseboxY#+ygap#*4,1,255,0,0,0,40,20,255,str(buttonalpha),1)
createmyeditbox(buttonredbox,baseboxX#+diff#*4,baseboxY#+ygap#*2,1,255,0,0,0,40,20,255,str(buttonred),1)
createmyeditbox(buttongreenbox,baseboxX#+diff#*4,baseboxY#+ygap#*3,1,255,0,0,0,40,20,255,str(buttongreen),1)
createmyeditbox(buttonbluebox,baseboxX#+diff#*4,baseboxY#+ygap#*4,1,255,0,0,0,40,20,255,str(buttonblue),1)
myboxcol=MakeColor(0,255,0)
endfunction
function hide_stuff()
for n=1 to 1000
if gettextexists(n)
SetTextVisible(n,0)
endif
if geteditboxexists(n)
SetEditBoxVisible(n,0)
endif
next n
endfunction
function show_stuff()
for n=1 to 1000
if gettextexists(n)
SetTextVisible(n,1)
endif
if geteditboxexists(n)
SetEditBoxVisible(n,1)
endif
next n
endfunction
function select_image()
model$=ChooseRawFile("*.png")
loadimage(1,model$)
createsprite(10,1)
setspritesize(10,128,128)
//setspritecolor(bdropsprite,255,0,0,255)
//setspritesize(bdropsprite,800,600)
setspriteposition(10,100,100)
endfunction
I press F7 to choose a file, in this program one can place virtual buttons on screen with the mouse, save the setup with F4 and load back with F1, it is a whole menu editor I am trying to create, pressing f5 hides/shows the edit boxes you use to set the buttons params before putting it down with the left mouse button, whilst f8 clears the whole thing! the code needs no media,I have yet to code in the ability to delete a button already created, but will do, it is pretty much early days, only started coding it yesterday.I actually ripped it out of the even bigger project of the 2D Level editor as this was going to be integrated into it, but got messy so developing it seperately
Hail to the king, baby!