HISE Logo Forum
    • Categories
    • Register
    • Login

    Panel image painting not working with other code

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 73 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jpbc
      last edited by

      Content.makeFrontInterface(400, 600);

      namespace Tooltip
      {
      const pnlTooltip = Content.getComponent("pnlTooltip");

      const svgData = [
      

      110,109,247,228,78,65,155,102,2,65,98,66,207,78,65,231,70,6,65,51,51,77,65,169,246,9,65,22,106,74,65,225,168,12,65,98,144,160,71,65,24,91,15,65,189,227,67,65,230,215,16,65,71,3,64,65,226,204,16,65,98,236,47,61,65,194,180,16,65,235,115,58,65,86,200,15,
      65,24,38,56,65,221,36,14,65,98,220,215,53,65,111,129,12,65,215,18,52,65,120,57,10,65,191,14,51,65,30,150,7,65,98,61,10,50,65,197,242,4,65,137,210,49,65,178,17,2,65,152,110,50,65,178,157,254,64,98,61,10,51,65,22,24,249,64,176,114,52,65,237,13,244,64,225,
      122,54,65,54,31,240,64,98,18,131,56,65,148,48,236,64,169,19,59,65,93,138,233,64,35,219,61,65,69,129,232,64,98,157,162,64,65,24,120,231,64,216,129,67,65,173,23,232,64,67,28,70,65,68,76,234,64,98,174,182,72,65,199,128,236,64,53,239,74,65,38,49,240,64,250,
      126,76,65,192,231,244,64,98,40,15,78,65,69,158,249,64,143,228,78,65,174,37,255,64,248,228,78,65,155,102,2,65,99,109,134,167,52,65,165,61,132,65,108,134,167,52,65,207,102,50,65,98,119,156,52,65,189,227,48,65,163,223,52,65,78,98,47,65,92,109,53,65,68,250,
      45,65,98,21,251,53,65,58,146,44,65,19,208,54,65,140,74,43,65,12,224,55,65,76,55,42,65,98,157,239,56,65,163,35,41,65,109,52,58,65,187,73,40,65,106,154,59,65,24,183,39,65,98,104,0,61,65,117,36,39,65,156,128,62,65,140,219,38,65,70,3,64,65,72,225,38,65,98,
      5,129,65,65,223,224,38,65,21,251,66,65,224,45,39,65,28,90,68,65,202,195,39,65,98,35,185,69,65,75,89,40,65,148,246,70,65,110,52,41,65,197,254,71,65,23,72,42,65,98,246,6,73,65,192,91,43,65,44,212,73,65,203,161,44,65,238,90,74,65,247,6,46,65,98,176,225,
      74,65,35,108,47,65,79,30,75,65,16,233,48,65,132,13,75,65,208,102,50,65,108,132,13,75,65,166,61,132,65,98,132,13,75,65,220,249,132,65,97,195,74,65,58,180,133,65,156,51,74,65,26,98,134,65,98,110,163,73,65,250,15,135,65,20,208,72,65,21,174,135,65,214,197,
      71,65,52,51,136,65,98,153,187,70,65,83,184,136,65,203,127,69,65,204,33,137,65,11,36,68,65,226,105,137,65,98,226,199,66,65,249,177,137,65,38,83,65,65,11,215,137,65,186,218,63,65,11,215,137,65,98,78,98,62,65,11,215,137,65,41,237,60,65,249,177,137,65,104,
      145,59,65,226,105,137,65,98,168,53,58,65,203,33,137,65,114,249,56,65,82,184,136,65,53,239,55,65,51,51,136,65,98,247,228,54,65,20,174,135,65,157,17,54,65,249,15,135,65,216,129,53,65,25,98,134,65,98,170,241,52,65,57,180,133,65,135,167,52,65,219,249,132,
      65,135,167,52,65,165,61,132,65,99,109,0,0,64,65,0,0,172,65,98,106,222,136,65,0,0,172,65,0,0,170,65,106,222,138,65,0,0,170,65,0,0,68,65,98,0,0,170,65,26,134,228,64,106,222,136,65,0,0,64,64,0,0,64,65,0,0,64,64,98,26,134,220,64,0,0,64,64,0,0,48,64,26,134,
      228,64,0,0,48,64,0,0,68,65,98,0,0,48,64,106,222,138,65,26,134,220,64,0,0,172,65,0,0,64,65,0,0,172,65,99,101,0,0

      ];
      
      const infoIcon = Content.createPath();
      infoIcon.loadFromData(svgData);
      
      
      pnlTooltip.setPaintRoutine(function(g)
      {
      	var t = Content.getCurrentTooltip();
      	
      	t == "" ? g.setColour(0x00) : g.setColour(Colours.withAlpha(this.get("bgColour"), 0.2));
      	g.fillRoundedRectangle([0, 0, this.getWidth(), this.getHeight()], 5);
      	
      	g.setColour(this.get("textColour"));
      	
      	if (t != "")
      	{
      		g.fillPath(infoIcon, [5, 0, this.getHeight(), this.getHeight()]);		
      		g.drawAlignedText(t, [30, 0, this.getWidth(), this.getHeight()], "left");	
      	}
      	
      });
      
      pnlTooltip.setTimerCallback(function()
      {
      	this.repaint();
      });
      
      pnlTooltip.startTimer(250);
      

      }

      namespace LooknFeel
      {

      const laf = Engine.createGlobalScriptLookAndFeel();

      laf.registerFunction("drawRotarySlider", function(g, obj)
      {

      var a = obj.area;
      
      g.setColour(obj.bgColour);
      g.fillEllipse(a);
      
      g.setColour(obj.itemColour1);
      g.fillEllipse([10, 10, a[2] - 20, a[3] - 20 ]);
      
      var start = 2.5;
      var end = start * 2 * obj.valueNormalized - start;
      
      g.rotate(end, [a[2] / 2, a[3] / 2]);
      
      g.setColour(obj.itemColour2);
      g.fillRoundedRectangle([a[2] / 2 - 8 / 2, 8, 8, 100], 5);
      

      });

      laf.registerFunction("drawLinearSlider", function(g, obj)
      {
      
      	var a = obj.area;
      	
      	g.fillAll(obj.bgColour);
      	g.setColour(obj.itemColour1);
      	
      	if (obj.style == 2) //Horizontal
      	{
      	
      	var w = a[2] / 4;
      	var x = a[2] * obj.valueNormalized - (w + 4) * obj.valueNormalized + 2;
      	
      	g.fillRoundedRectangle([x, 2, w, a[3] - 4], 5);	
      	
      	}
      	else //Vertical
      	{
      
      		
      	}
      });
      

      }

      include("Paths.js");

      const laf = Engine.createGlobalScriptLookAndFeel();

      laf.registerFunction("drawToggleButton", function(g, obj)
      {

      var a = obj.area;
      
      if (obj.text.indexOf("icon") != -1)
      
      {
      
      	var icon = obj.text.replace("icon-");
      	
      	
      	g.setColour(obj.bgColour);
      	
      	if(obj.over)
      		g.setColour(obj.itemColour1);
      		
      		
      	if(obj.down)
      		g.setColour(obj.itemColour2);
      	
      	g.fillPath(Paths.icons[icon], a);
      
      
      }
      
      
      
      const Panel1 = Content.getComponent("Panel1");
      
      Panel1.loadImage("{PROJECT_FOLDER}images/500.jpeg", "background");
      
      Panel1.setPaintRoutine(function(g)
      {
      

      });

      so the problem I'm having is a global declaration error on my const Panel1 = Content.getComponent line and it's highlighting Panel1 as the actual error. i'm not entirely sure

      d.healeyD 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @jpbc
        last edited by

        @jpbc Try to place it all within code tags, it's hard to read otherwise

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @jpbc
          last edited by

          @jpbc I think you're just missing a closing parenthesis and semi colon after the laf function registration.

          By the way, you should probably use local look and feel here rather than global - it wasn't available when I made the video you're following.

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          13

          Online

          1.7k

          Users

          11.9k

          Topics

          103.6k

          Posts