HISE Logo Forum
    • Categories
    • Register
    • Login

    Drawing a line grid into a panel with LAF

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 132 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.
    • MorphoiceM
      Morphoice
      last edited by Morphoice

      How would I go about drawing a grid of 11 horizontal lines filing an entire panel's height?
      As a scale to put behind sliders like e.g a Juno has.

      I did some experiments with paint routine according to Dave's videos but it got me nowhere ;(

      const var Grid1 = Content.getComponent("Grid1");
      
      Grid1.setPaintRoutine(function(g) 
      {
      		var a = this.getLocalBounds(0);
      		var spacer = a[3]/10;
      		//g.fillAll(this.get("bgColour"));
      		g.setColour(Colours.white);
      		for (i=0;i<=10;i++)
      		{			
      			var y = i * spacer;
      			g.fillRect([0,y,a[2],y+2]);	
      		}
      });
      

      I just get a weird block with one line on top... probably a thinking mistake on my end but I can't figure it out

      Screenshot 2025-01-05 at 15.07.20.png

      Also how would I wrap the routine into someting I can assign to other panels aswell?

      https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

      d.healeyD 1 Reply Last reply Reply Quote 0
      • MorphoiceM Morphoice deleted this topic on
      • MorphoiceM Morphoice restored this topic on
      • d.healeyD
        d.healey @Morphoice
        last edited by

        @Morphoice You'll find these useful

        https://youtu.be/nmB_Ml-XWGg
        https://youtu.be/jO-KOEcJRKo

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

        MorphoiceM 1 Reply Last reply Reply Quote 0
        • MorphoiceM
          Morphoice @d.healey
          last edited by

          @d-healey yep that's exactly what my script is based of ;)) However, I now realize it should be 2 not y+2 as the forth parameter is a height not a position I guess ;)

          https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

            @Morphoice Yeah, [x y, width, height]. So a[3] for the full height of the panel.

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

            MorphoiceM 1 Reply Last reply Reply Quote 0
            • MorphoiceM
              Morphoice @d.healey
              last edited by

              @d-healey brilliant! again without you and your videos I'd be nothing!

              this is what I came up with in the end:

              
              const var Grid1 = Content.getComponent("Grid1");
              
              Grid1.setPaintRoutine(function(g) 
              {
              	drawPandelGrid();
              });
              
              inline function drawPandelGrid()
              {
              	local a = this.getLocalBounds(0);
              	local spacer = a[3]/10;
              	//g.fillAll(this.get("bgColour"));
              	g.setColour(Colours.withAlpha(Colours.white, 0.1));
              	for (i=0;i<=10;i++)
              	{			
              		local y = i * spacer;
              		g.fillRect([0,y,a[2],2]);	
              	}
              }
              

              and it gives a nice panel of lines to go behind my faders

              Screenshot 2025-01-05 at 15.28.21.png

              https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

              72

              Online

              1.7k

              Users

              11.8k

              Topics

              103.0k

              Posts