Alert boxes by etereo30th Aug 2007 20:11
|
---|
Summary Three alert boxes with one, two and tree selecionable buttons. Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com rem functions alert boxs by etereo rem work in all screen modes that you include in functions (at the begining) rem examples to call functions rem set display mode 1024,768,16 rem set display mode 800,600,32 rem set display mode 640,480,32 sync on set text font "Verdana": set text size 18 ink rgb(200,220,0),0:text 223,381,"Alert box examples...." sel=alerta_dos(200,70,"Elige una opcion","","cancela","acepta") print "Has elegido "; sel wait 200 sel=alerta_dos(200,70,"Select an option","","option1","option2") print "You have selected "; sel print "Has elegido "; sel wait 200 sel=alerta_tres(220,70,"Elige una numerito",""," uno "," dos"," tres ") print "Has elegido "; sel wait 200 sel=alerta_tres(220,70,"Select an option","","option1","option2","option3") print "You have selected "; sel wait 200 alerta_uno(174,70," ¿Seguro que quieres"," salir del programa?", " SI ") wait 200 alerta_uno(174,70,"Do you want to exit"," from this program?", " YES ") wait 200 end `------------------------------------------------------------- rem Alerta simple de un solo boton aceptar. `------------------------------------------------------------- function alerta_uno(left,top,texto1$,texto2$,click1$) right=left : bottom=top if screen width()=640 and screen height()=480 then left=640/2-left/2 : top=480/2-top/2 :axis=640/2 :`testea el modo de pantalla. Hay dos, pero se pueden poner mas... if screen width()=800 and screen height()=600 then left=800/2-left/2 : top=600/2-top/2 :axis=800/2 :`test screen mode. There are two but you can add more if screen width()=1024 and screen height()=768 then left=1024/2-left/2 : top=768/2-top/2 :axis=1024/2 `---------------------------------- get image 1111,left-1,top-1,left+right+1,top+bottom+1 :` Graba la imagen de bitmap del recorte donde va la caja de alerta ink rgb(180,180,0),1 :box left,top,left+right,top+bottom :` caja exterior ink rgb(20,100,100),1 :box left+1,top+1,left+right-1,top+bottom-1 :` caja interior ink rgb(0,0,0),1: text left+5,top+5,texto1$: text left+5,top+22,texto2$ :` texto 1 y 2 ink rgb(0,0,0),1: box axis-29,top+bottom-26,axis+29,top+bottom-6 :` boton de picar exterior ink rgb(215,205,200),1:box axis-28,top+bottom-25,axis+28,top+bottom-7 :` boton de picar interior ink rgb(0,0,0),1:text axis-28,top+bottom-24, click1$ :` texto a clickear do my1 = top+bottom-25 : my2=top+bottom-5 if mousex()> axis-19 and mousex()<axis+21 and mousey()> my1 and mousey()< my2 ink rgb(255,255,255),1 : text axis-28,top+bottom-24, click1$ :rem texto a clickear invertido else ink rgb(0,0,0),1: text axis-28,top+bottom-24, click1$ :rem texto a clickear normal endif if mouseclick() = 1 and mousex()> axis-21 and mousex()<axis+19 and mousey()> my1 and mousey()< my2 ink rgb(100,200,100),1 : box axis-28,top+bottom-25,axis+28,top+bottom-7 : rem boton pulsado boton interior y salir ink rgb(180,180,255),1 : text axis-28,top+bottom-24, click1$ : rem texto pulsado e invertido y salir eleccion = 1 : cliked$ = click1$ : wait 100 exit endif sync loop paste image 1111,left-1,top-1 : rem Pega la imagen de bitmap del recorte donde va la caja de alerta endfunction `------------------------------------------------------------- rem alerta doble de tipo aceptar o cancelar, si/no, etc. `------------------------------------------------------------- function alerta_dos(left,top,texto1$,texto2$,click1$,click2$) right=left : bottom=top if screen width()=640 and screen height()=480 then left=640/2-left/2 : top=480/2-top/2 :axis=640/2 :`testea el modo de pantalla. Hay dos, pero se pueden poner mas... if screen width()=800 and screen height()=600 then left=800/2-left/2 : top=600/2-top/2 :axis=800/2 :`test screen mode. There are two but you can add more if screen width()=1024 and screen height()=768 then left=1024/2-left/2 : top=768/2-top/2 :axis=1024/2 `---------------------------------- `---------------------------------- get image 1112,left-1,top-1,left+right+1,top+bottom+1 :` Graba la imagen de bitmap del recorte donde va la caja de alerta ink rgb(190,0,170),1 :box left,top,left+right,top+bottom :` caja exterior ink rgb(100,0,0),1 :box left+1,top+1,left+right-1,top+bottom-1 :` caja interior ink rgb(250,250,0),1 :text left+5,top+5,texto1$:text left+5,top+22,texto2$ :` texto 1 y 2 de informacion ink rgb(0,0,0),1 :box axis-3-58,top+bottom-26,axis-3,top+bottom-6 :` boton de picar exterior izquierdo box axis+3,top+bottom-26,axis+3+58,top+bottom-6 :` boton de picar exterior derecho ink rgb(215,215,215),1:box axis-3-57,top+bottom-25,axis-4,top+bottom-7 :` boton de picar interior izquierdo box axis+4,top+bottom-25,axis+3+57,top+bottom-7 :` boton de picar interior derecho ink rgb(0,0,0),1 :` texto a clickear izquierdo text axis-3-57,top+bottom-24, click1$ text axis+4,top+bottom-24, click2$ :` texto a clickear derecho do my1 = top+bottom-25 : my2=top+bottom-5 : ` Detecta el boton en la zona izquierda if mousex()> axis-60 and mousex()<axis-3 and mousey()> my1 and mousey()< my2 ink rgb(255,255,255),1: text axis-3-57,top+bottom-24, click1$ :rem texto click invertido else ink rgb(0,0,0),1 :text axis-3-57,top+bottom-24, click1$ :rem texto a clickear normal endif my1 = top+bottom-25 : my2=top+bottom-5 :` Detecta el boton en la zona derecha if mousex()> axis+3 and mousex()<axis+60 and mousey()> my1 and mousey()< my2 ink rgb(255,255,255),1: text axis+4,top+bottom-24, click2$ :rem texto click invertido else ink rgb(0,0,0),1:text axis+4,top+bottom-24, click2$ :rem texto a clickear normal endif rem Selecionado el boton interior IZQUIERDO y salir if mouseclick() = 1 and mousex()> axis-60 and mousex()<axis-3 and mousey()> my1 and mousey()< my2 ink rgb(100,100,100+100),1:box axis-3-57,top+bottom-25,axis-4,top+bottom-7 :rem boton de picar interior izquierdo ink rgb(180,180,255),1 :text axis-3-57,top+bottom-24, click1$ :rem texto izquierdo pulsado e invertido y salir eleccion = 1 : cliked$ = click1$: wait 100 exit endif rem Selecionado el boton interior DERECHO y salir if mouseclick() = 1 and mousex()> axis+3 and mousex()<axis+60 and mousey()> my1 and mousey()< my2 ink rgb(100,100,100+100),1: box axis+4,top+bottom-25,axis+3+57,top+bottom-7 : rem boton de picar interior derecho ink rgb(180,180,255),1:text axis+4,top+bottom-24, click2$ :rem texto derecho pulsado e invertido y salir eleccion = 2 : cliked$ = click2$ :wait 100 exit endif sync loop paste image 1112,left-1,top-1 :rem Pega la imagen de bitmap del recorte donde va la caja de alerta endfunction eleccion function alerta_tres(left,top,texto1$,texto2$,click1$,click2$,click3$) `------------------------------------------------------------- rem alerta triple de dos botones tipo aceptar o cancelar, si/no, etc. `------------------------------------------------------------- right=left : bottom=top if screen width()=640 and screen height()=480 then left=640/2-left/2 : top=480/2-top/2 :axis=640/2 :`testea el modo de pantalla. Hay dos, pero se pueden poner mas... if screen width()=800 and screen height()=600 then left=800/2-left/2 : top=600/2-top/2 :axis=800/2 :`test screen mode. There are two but you can add more if screen width()=1024 and screen height()=768 then left=1024/2-left/2 : top=768/2-top/2 :axis=1024/2 `--------------------- get image 1113,left-1,top-1,left+right+1,top+bottom+1 :` Graba la imagen de bitmap del recorte donde va la caja de alerta ink rgb(225,225,225),1:box left,top,left+right,top+bottom :` caja exterior ink rgb(100,0,0),1:box left+1,top+1,left+right-1,top+bottom-1 :` caja interior ink rgb(255,255,0),1:text left+5,top+5,texto1$:text left+5,top+22,texto2$ :` texto 1 y 2 de informacion ink rgb(0,0,0),1: box axis-3-58+98,top+bottom-26,axis-3+40,top+bottom-6 :` boton de picar exterior izquierdo (1) box axis-29,top+bottom-26,axis+29,top+bottom-6 :` boton de picar exterior central (2) box axis+43,top+bottom-26,axis+3+58+40,top+bottom-6 :` boton de picar exterior derecho (3) ink rgb(225,225,225),1 : box axis-3-57+97,top+bottom-25,axis-4+40,top+bottom-7 :` boton de picar interior izquierdo (1) box axis-28,top+bottom-25,axis+28,top+bottom-7 :` boton de picar interior central (2) box axis+44,top+bottom-25,axis+3+57+40,top+bottom-7 :` boton de picar interior derecho (3) ink rgb(0,0,0),1: text axis-3-57-97,top+bottom-24, click1$ :` texto a clickear izquierdo text axis-28,top+bottom-24, click2$ :` texto a clickear centro text axis+3+41,top+bottom-24, click3$ :` texto a clickear derecho do my1 = top+bottom-25 : my2=top+bottom-5 :` Detecta el boton en la zona izquierda (1) if mousex()> axis-100 and mousex()<axis-42 and mousey()> my1 and mousey()< my2 ink rgb(255,255,255),1:text axis-3-57-97,top+bottom-24, click1$ :rem texto click invertido else ink rgb(0,0,0),1:text axis-3-57-97,top+bottom-24, click1$ :rem texto a clickear normal endif if mousex()> axis-29 and mousex()<axis+30 and mousey()> my1 and mousey()< my2 :` Detecta el boton en la zona central (2) ink rgb(255,255,255),1:text axis-28,top+bottom-24, click2$ :rem texto a clickear invertido else ink rgb(0,0,0),1 :text axis-28,top+bottom-24, click2$ :rem texto a clickear normal endif if mousex()> axis+43 and mousex()<axis+102 and mousey()> my1 and mousey()< my2 :` Detecta el boton en la zona derecha (3) ink rgb(255,255,255),1:text axis+3+41,top+bottom-24, click3$ :rem texto click invertido else ink rgb(0,0,0),1 :text axis+3+41,top+bottom-24, click3$ :rem texto a clickear normal endif rem Selecionado el boton interior IZQUIERDO y salir (1) if mouseclick() = 1 and mousex()> axis-100 and mousex()<axis-42 and mousey()> my1 and mousey()< my2 ink rgb(100,200,100),1:box axis-3-57+97,top+bottom-25,axis-4+40,top+bottom-7 : rem boton de picar interior izquierdo ink rgb(180,180,255),1:text axis-3-57-97,top+bottom-24, click1$ :rem texto izquierdo pulsado e invertido y salir eleccion = 1 :cliked$ = click1$: wait 100 exit endif rem Selecionado el boton interior CENTRAL y salir (2) if mouseclick() = 1 and mousex()> axis-29 and mousex()<axis+30 and mousey()> my1 and mousey()< my2 ink rgb(100,200,100),1:box axis-28,top+bottom-25,axis+28,top+bottom-7 :rem boton de picar interior central ink rgb(180,180,255),1:text axis-28,top+bottom-24, click2$ :rem texto central pulsado e invertido y salir eleccion = 2 : cliked$ = click2$: wait 100 exit endif rem Selecionado el boton interior DERECHO y salir (3) if mouseclick() = 1 and mousex()> axis+43 and mousex()<axis+102 and mousey()> my1 and mousey()< my2 ink rgb(100,200,100),1:box axis+44,top+bottom-25,axis+3+57+40,top+bottom-7 :rem boton de picar interior derecho ink rgb(180,180,255),1:text axis+3+41,top+bottom-24, click3$ :rem texto derecho pulsado e invertido y salir eleccion = 3 : cliked$ = click3$ : wait 100 exit endif sync loop paste image 1113,left-1,top-1 :rem Pega la imagen de bitmap del recorte donde va la caja de alerta endfunction eleccion |