Advertisement
Guest User

custom groovy

a guest
Mar 22nd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 7.32 KB | None | 0 0
  1. import com.simsilica.lemur.*;
  2. import com.simsilica.lemur.Button.ButtonAction;
  3. import com.simsilica.lemur.component.*;
  4.  
  5. // lemur-proto import
  6. import com.jme3.material.RenderState.BlendMode;
  7.  
  8. def gradient = TbtQuadBackgroundComponent.create(
  9.                                         texture( name:"/com/simsilica/lemur/icons/bordered-gradient.png",
  10.                                                  generateMips:false ),
  11.                                                  1, 1, 1, 126, 126,
  12.                                                  1f, false );
  13.  
  14. def bevel = TbtQuadBackgroundComponent.create(
  15.                                         texture( name:"/com/simsilica/lemur/icons/bevel-quad.png",
  16.                                                  generateMips:false ),
  17.                                                  0.125f, 8, 8, 119, 119,
  18.                                                  1f, false );
  19.  
  20. def border = TbtQuadBackgroundComponent.create(
  21.                                         texture( name:"/com/simsilica/lemur/icons/border.png",
  22.                                                  generateMips:false ),
  23.                                                  1, 1, 1, 6, 6,
  24.                                                  1f, false );
  25. def border2 = TbtQuadBackgroundComponent.create(
  26.                                         texture( name:"/com/simsilica/lemur/icons/border.png",
  27.                                                  generateMips:false ),
  28.                                                  1, 2, 2, 6, 6,
  29.                                                  1f, false );
  30.                                                  
  31. // lemur-proto def
  32. def transparent = new QuadBackgroundComponent(color(0, 0, 0, 0))
  33.  
  34. def doubleGradient = new QuadBackgroundComponent( color(0.5, 0.75, 0.85, 0.5) );  
  35. doubleGradient.texture = texture( name:"/com/simsilica/lemur/icons/double-gradient-128.png",
  36.                                   generateMips:false )
  37.                                  
  38. selector( "custom" ) {
  39.     fontSize = 14
  40. }
  41.  
  42. selector( "label", "custom" ) {
  43.     insets = new Insets3f( 2, 2, 0, 2 );
  44.     color = color(0.5, 0.75, 0.75, 0.85)    
  45. }
  46.  
  47. selector( "container", "custom" ) {
  48.     background = gradient.clone()
  49.     background.setColor(color(0.25, 0.5, 0.5, 0.5))
  50. }
  51.  
  52. selector( "slider", "custom" ) {
  53.     background = gradient.clone()
  54.     background.setColor(color(0.25, 0.5, 0.5, 0.5))
  55. }
  56.  
  57. def pressedCommand = new Command<Button>() {
  58.         public void execute( Button source ) {
  59.             if( source.isPressed() ) {
  60.                 source.move(1, -1, 0);
  61.             } else {
  62.                 source.move(-1, 1, 0);
  63.             }
  64.         }      
  65.     };
  66.    
  67. def stdButtonCommands = [
  68.         (ButtonAction.Down):[pressedCommand],
  69.         (ButtonAction.Up):[pressedCommand]
  70.     ];
  71.  
  72. selector( "title", "custom" ) {
  73.     color = color(0.8, 0.9, 1, 0.85f)
  74.     highlightColor = color(1, 0.8, 1, 0.85f)
  75.     shadowColor = color(0, 0, 0, 0.75f)
  76.     shadowOffset = new com.jme3.math.Vector3f(2, -2, -1);
  77.     background = new QuadBackgroundComponent( color(0.5, 0.75, 0.85, 0.5) );
  78.     background.texture = texture( name:"/com/simsilica/lemur/icons/double-gradient-128.png",
  79.                                   generateMips:false )
  80.     insets = new Insets3f( 2, 2, 2, 2 );
  81.    
  82.     buttonCommands = stdButtonCommands;
  83. }
  84.  
  85.  
  86. selector( "button", "custom" ) {
  87.     background = gradient.clone()
  88.     color = color(0.8, 0.9, 1, 0.85f)
  89.     background.setColor(color(0, 0.75, 0.75, 0.5))
  90.     insets = new Insets3f( 2, 2, 2, 2 );
  91.    
  92.     buttonCommands = stdButtonCommands;
  93. }
  94.  
  95. selector( "slider", "custom" ) {
  96.     insets = new Insets3f( 1, 3, 1, 2 );    
  97. }
  98.  
  99. selector( "slider", "button", "custom" ) {
  100.     background = doubleGradient.clone()
  101.     background.setColor(color(0.5, 0.75, 0.75, 0.5))
  102.     insets = new Insets3f( 0, 0, 0, 0 );
  103. }
  104.  
  105. selector( "slider.thumb.button", "custom" ) {
  106.     text = "[]"
  107.     color = color(0.6, 0.8, 0.8, 0.85)    
  108. }
  109.  
  110. selector( "slider.left.button", "custom" ) {
  111.     text = "-"
  112.     background = doubleGradient.clone()
  113.     background.setColor(color(0.5, 0.75, 0.75, 0.5))
  114.     background.setMargin(5, 0);
  115.     color = color(0.6, 0.8, 0.8, 0.85)    
  116. }
  117.  
  118. selector( "slider.right.button", "custom" ) {
  119.     text = "+"
  120.     background = doubleGradient.clone()
  121.     background.setColor(color(0.5, 0.75, 0.75, 0.5))
  122.     background.setMargin(4, 0);
  123.     color = color(0.6, 0.8, 0.8, 0.85)    
  124. }
  125.  
  126. selector( "checkbox", "custom" ) {
  127.     def on = new IconComponent( "/com/simsilica/lemur/icons/Glass-check-on.png", 1f,
  128.                                  0, 0, 1f, false );
  129.     on.setColor(color(0.5, 0.9, 0.9, 0.9))
  130.     on.setMargin(5, 0);
  131.     def off = new IconComponent( "/com/simsilica/lemur/icons/Glass-check-off.png", 1f,
  132.                                  0, 0, 1f, false );
  133.     off.setColor(color(0.6, 0.8, 0.8, 0.8))
  134.     off.setMargin(5, 0);
  135.    
  136.     onView = on;
  137.     offView = off;    
  138.  
  139.     color = color(0.8, 0.9, 1, 0.85f)
  140. }
  141.  
  142. selector( "rollup", "custom" ) {
  143.     background = gradient.clone()  
  144.     background.setColor(color(0.25, 0.5, 0.5, 0.5))
  145. }
  146.  
  147. selector( "tabbedPanel", "custom" ) {
  148.     activationColor = color(0.8, 0.9, 1, 0.85f)
  149. }
  150.  
  151. selector( "tabbedPanel.container", "custom" ) {
  152.     background = null
  153. }
  154.  
  155. selector( "tab.button", "custom" ) {
  156.     background = gradient.clone()
  157.     background.setColor(color(0.25, 0.5, 0.5, 0.5))
  158.     color = color(0.4, 0.45, 0.5, 0.85f)
  159.     insets = new Insets3f( 4, 2, 0, 2 );
  160.    
  161.     buttonCommands = stdButtonCommands;
  162. }
  163.  
  164. // lemur-proto styles
  165. selector( "optionPanel", "custom" ) {
  166.     background = gradient.clone()
  167.     background.setColor(color(0.25, 0.5, 0.5, 0.5))
  168. }
  169.  
  170. selector( "optionPanel.container", "custom" ) {
  171.  
  172.     background = gradient.clone()
  173.     background.color = color(0.25, 0.4, 0.6, 0.25)
  174.     background.setMargin(10, 10)
  175.     insets = new Insets3f( 2, 2, 2, 2 )
  176. }
  177.  
  178. selector( "title.label", "custom" ) {
  179.     color = color(0.8, 0.9, 1, 0.85f)
  180.     highlightColor = color(1, 0.8, 1, 0.85f)
  181.     shadowColor = color(0, 0, 0, 0.75f)
  182.     shadowOffset = new com.jme3.math.Vector3f(2, -2, -1);
  183.     background = new QuadBackgroundComponent( color(0.5, 0.75, 0.85, 0.5) );
  184.     background.texture = texture( name:"/com/simsilica/lemur/icons/double-gradient-128.png",
  185.                                   generateMips:false )
  186.     insets = new Insets3f( 2, 2, 2, 2 );
  187. }
  188.  
  189. selector( "list.container", "custom" ) {
  190.     background = gradient.clone()
  191.     background.setColor(color(0.25, 0.5, 0.5, 0.5))
  192.     insets = new Insets3f( 2, 2, 2, 2, 2, 2 );
  193. }
  194.  
  195. selector( "list.item", "custom" ) {
  196.     color = color(0.5, 0.75, 0.75, 0.85)    
  197.     background = transparent;
  198. }
  199.  
  200. selector( "list.selector", "custom" ) {
  201.     background = gradient.clone();
  202.     background.color = color(0.4, 0.6, 0.6, 0.5)
  203.     //background.material.material.additionalRenderState.blendMode = BlendMode.Exclusion;
  204.     background.material.material.additionalRenderState.blendMode = BlendMode.AlphaAdditive;
  205. }
  206.  
  207. selector( "colorChooser.value", "custom" ) {
  208.     border = gradient.clone()
  209.     border.setColor(color(0.25, 0.5, 0.5, 0.5))
  210.     insets = new Insets3f( 2, 2, 2, 2, 2, 2 );
  211. }
  212.  
  213. selector( "colorChooser.colors", "custom" ) {
  214.     border = gradient.clone()
  215.     border.setColor(color(0.25, 0.5, 0.5, 0.5))
  216.     insets = new Insets3f( 2, 2, 2, 2, 2, 2 );
  217. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement