// The font used for displaying text declare global MyFont font; // The X and Y position of a click declare global PosX int; declare global PosY int; // The pen for the grid declare global GridPen pen; // ************************************************************************************************************ // Called once when the plugin is started. Do one time setup here. // ************************************************************************************************************ function Init() { createfont(MyFont, "Arial", 12); createpen(GridPen, 0, 2, RGB(255, 255, 255)); } // ************************************************************************************************************ // The plugin must draw all output here ONLY. This is the only valid drawing function. // ************************************************************************************************************ function Render() { int iWidth = getpanelwidth(); int iHeight = getpanelheight(); // Set the number of pixels in from the left of the display panel the grid should be at int iGridTopX = 10; int iGridWidth = iWidth - iGridTopX - 10; // The grid should be 1/4 of the way from the top of the display panel, and take up half the // total height of the panel. int iGridTopY = iHeight / 4; int iGridHeight = iHeight / 2; selectpen(GridPen); // First draw the vertical lines at 1/3 and 2/3 of the grid width int iGridThirdW = iGridWidth / 3; drawline(iGridTopX + iGridThirdW, iGridTopY, iGridTopX + iGridThirdW, iGridTopY + iGridHeight); drawline(iGridTopX + (iGridThirdW * 2), iGridTopY, iGridTopX + (iGridThirdW * 2), iGridTopY + iGridHeight); // Next draw the horizontal lines at 1/3 and 2/3 of the grid height int iGridThirdH = iGridHeight / 3; drawline(iGridTopX, iGridTopY + iGridThirdH, iGridTopX + iGridWidth, iGridTopY + iGridThirdH); drawline(iGridTopX, iGridTopY + (iGridThirdH * 2), iGridTopX + iGridWidth, iGridTopY + (iGridThirdH * 2)); } // ************************************************************************************************************ // Called when left mouse button is released. Params give X,Y pos of cursor at release. // ************************************************************************************************************ function OnMouseLButtonUp(int iX, int iY) { // Store the click position for use in the Render handler PosX = iX; PosY = iY; // Tell Brass to redraw our panel immediately redraw(); }