GlovePIE GUI Script

From WiiLi

Jump to: navigation, search
/**************************************************/
/*      GlovePIE GUI Scipt v2                     */
/*      by marsuten                               */
/*                                                */
/* Experimental project to do a full working GUI  */
/* using small ICO images, implement some buttons */
/* that allow to activate/desactivate any script, */
/* to switch between them, move/minimize the skin,*/
/* and anything you can imagine.                  */
/*                                                */
/* The GUI is fully skinable, it uses images .ICO */
/* that you can edit with some ico editor.        */
/* The script is some complex but is really useful*/
/* Only the buttons work when is pressed and      */
/* released inside them.                          */
/*                                                */
/* You'll need the ico images pack that use this  */
/* script. You can find it here:                  */
/* http://fon.gs/glovepiegui2                     */
/* http://rapidshare.com/files/156935090/glovepiegui.zip.html
/*                                                */
/* Feel free to modify and improve.               */
/**************************************************/

if var.action
//ACTION SCRIPT START----------------


//ACTION SCRIPT END------------------
var.action.end=true
endif

//Variables
if starting then     var.push = false  //True = action per click / False = action ON or OF
if starting then  var.pushpss = false  //(only if push=true) True = action when is pressed / False = action when is released
if starting then     var.space = 20    //Anchor space (min 0)
//SKIN 32x32
    var.OFFdef = "OFFdef.ico"
     var.OFFup = "OFFup.ico"
   var.OFFdown = "OFFdown.ico"
    var.OFFmov = "OFFmov.ico"
    var.OFFmin = "OFFmin.ico"
     var.ONdef = "ONdef.ico"
      var.ONup = "ONup.ico"
    var.ONdown = "ONdown.ico"
     var.ONmov = "ONmov.ico"
     var.ONmin = "ONmin.ico"
 var.MINOFFdef = "MINOFFdef.ico"
  var.MINOFFup = "MINOFFup.ico"
  var.MINONdef = "MINONdef.ico"
   var.MINONup = "MINONup.ico"
*Action Button
     var.actX1 = 4
     var.actX2 = 27
     var.actY1 = 0
     var.actY2 = 10
*Move Button
     var.movX1 = 27
     var.movX2 = 30
     var.movY1 = -7
     var.movY2 = -1
*Minimize Button
     var.minX1 = 22
     var.minX2 = 26
     var.minY1 = -7
     var.minY2 = -1
*Skin position
     var.defX1 = 0
     var.defX2 = 31
     var.defY1 = -7
     var.defY2 = 12

//Debug
debug = "("+removeunits(var.mx)+"x"+removeunits(var.my)+")"+"  difx="+removeunits(int(var.difx))+" dify="+removeunits(int(var.dify))+"   Action: "+int(var.action)

//Cursors variables
var.resx = screen.Width
var.resy = screen.Height
var.mx = mouse.CursorPosX+1
var.my = mouse.CursorPosY+1

//Cursor Distance to skin
var.difx=int(var.mx-var.c1x)
var.dify=int(var.my-var.c1y)

//Skin position
if var.smoothmove
cursor1.x=smooth(1/(var.resx/var.c1x),4)
cursor1.y=smooth(1/(var.resy/var.c1y),4)
var.smoothmove=false
endif

if var.smoothmini
cursor1.x=smooth(1/(var.resx/var.c1x),20)
cursor1.y=smooth(1/(var.resy/var.c1y),20)
var.smoothmini=false
endif

if not(var.smoothmove and var.smoothmini)
cursor1.x=smooth(1/(var.resx/var.c1x),1)
cursor1.y=smooth(1/(var.resy/var.c1y),1)
endif

//Cursor images
if var.action then cursor1.Image=var.ONdef else cursor1.Image=var.OFFdef
if var.action then cursor2.Image=var.MINONdef else cursor2.Image=var.MINOFFdef
cursor1.Visible=!var.mini
cursor2.Visible=var.mini

//Cursor minimize
cursor2.Caption=""
cursor2.x=1/(var.resx/(var.resx-30))
cursor2.y=1/(var.resy/(var.resy-23))

//Starting..
if starting then cursor1.caption=""
if starting then var.c1x=int(var.resx/2)
if starting then var.c1y=int(var.resy/2)

//Push or ON OFF
if !var.push then var.pushpss=false
if var.action.end and var.push
var.action=false
var.action.end=false
endif

// BUTTONS  (Only the buttons work when is pressed and released inside them)

//>>>> ACTION Button <<<<<
var.pass1=(var.c1x+var.actX1)<= var.mx <=(var.c1x+var.actX2) and (var.c1y+var.actY1)<= var.my <=(var.c1y+var.actY2) and !var.move and !var.mini
if mouse.LeftButton and !var.pass1 then var.passc=true else   if released(mouse.LeftButton) then var.passc=false
var.pass2 = mouse.LeftButton and var.pass1 and !var.passc
if var.pass1 then if var.action then cursor1.Image=var.ONup else cursor1.Image=var.OFFup
if var.pass2 then if var.action then cursor1.Image=var.ONdown else cursor1.Image=var.OFFdown
if var.pushpss then var.action=var.pass2
if released(var.pass2) and !var.passc and !var.pusspss
   toggle(var.action)
endif

//>>>> MOVE Button <<<<<
if (var.c1x+var.movX1)<= var.mx <=(var.c1x+var.movX2) and (var.c1y+var.movY1)<= var.my <=(var.c1y+var.movY2) and !var.mini
   if var.action=true then cursor1.Image=var.ONmov else cursor1.Image=var.OFFmov
   if !mouse.LeftButton then var.up2=true
   if mouse.LeftButton and var.up2
      var.move=true
      if !var.ancla
         var.anclax=var.difx
         var.anclay=var.dify
         var.ancla=true
      endif
   endif
else
var.up2=false
endif

//>>>> MINIMIZE Button <<<<<
var.c1.pass1=(var.c1x+var.minX1)<= var.mx <=(var.c1x+var.minX2) and (var.c1y+var.minY1)<= var.my <=(var.c1y+var.minY2) and !var.move and !var.mini
if mouse.LeftButton and !var.c1.pass1 then var.c1.passc=true else if released(mouse.LeftButton) then var.c1.passc=false
var.c1.pass2 = mouse.LeftButton and var.c1.pass1 and !var.c1.passc
if var.c1.pass1 or var.c1.pass2 then if var.action then cursor1.Image=var.ONmin else cursor1.Image=var.OFFmin
if released(var.c1.pass2) and !var.c1.passc
   var.smoothmini=true
   var.Mc1x=var.c1x
   var.Mc1y=var.c1y
   var.c1x=var.resx
   var.c1y=var.resy
   wait 80 ms
   var.mini=true
endif

//>>>> MINI Button <<<<<
var.c2.pass1=(var.resx-12)<= var.mx <=(var.resx) and (var.resy-12)<= var.my <=(var.resy) and var.mini and !var.move
if mouse.LeftButton and !var.c2.pass1 then var.c2.passc=true else   if released(mouse.LeftButton) then var.c2.passc=false
var.c2.pass2 = mouse.LeftButton and var.c2.pass1 and !var.c2.passc
if var.c2.pass1 or var.c2.pass2 then if var.action then cursor2.Image=var.MINONup else cursor2.Image=var.MINOFFup
if released(var.c2.pass2) and !var.c2.passc
   var.smoothmini=true
   var.c1x=var.Mc1x
   var.c1y=var.Mc1y
   var.mini=false
endif

//Button moving
if var.move=true then
   if var.action then cursor1.Image=var.ONmov else cursor1.Image=var.OFFmov
   var.c1x=var.mx-var.anclax
   var.c1y=var.my-var.anclay
   //Anclajes
   if var.c1x>var.resx-var.space-var.defX2
      var.c1x=var.resx-var.defX2
      var.mx=var.resx-var.anclax
   endif
   if var.c1y>var.resy-var.space-var.defY2
      var.c1y=var.resy-var.defY2
      var.my=var.resy-var.anclay
   endif
   if var.c1x<var.space-var.defX1
      var.c1x=0-var.defX1
      var.mx=var.anclax
   endif
   if var.c1y<var.space-var.defY1
      var.c1y=0-var.defY1
      var.my=var.anclay
   endif
   var.smoothmove = (var.c1x>var.resx-var.space-var.defX2) or (var.c1y>var.resy-var.space-var.defY2) or (var.c1x<var.space-var.defX1) or (var.c1y<var.space-var.defY1)
   if released(mouse.LeftButton)
      var.ancla=false
      var.move=false
   endif
endif

//end
Personal tools