diff UI code/UIGrid.mm @ 0:a223551fdc1f

First commit - copy from tweakathlon.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 10 Oct 2014 11:46:42 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI code/UIGrid.mm	Fri Oct 10 11:46:42 2014 +0100
@@ -0,0 +1,43 @@
+//
+//  UIGrid.cpp
+//  emptyExample
+//
+//  Created by Robert Tubb on 22/05/2013.
+//
+//
+
+#include "UIGrid.h"
+
+
+
+template<class T> void UIGrid<T>::print(){
+    cout << "uh \n";
+}
+
+template<class T> UIGrid<T>::UIGrid(int ax,int ay, int awidth, int aheight, int numColumns,int numRows,  int spacing,ofColor hi, ofColor lo, ofColor bg)
+{
+    
+    // grid of what ?
+    double cw = width/(double)numColumns;
+    double ch = height/(double)numRows;
+    
+    double eWidth = cw - spacing;
+    double eHeight = ch - spacing;
+    double ex,ey;
+    double radius = (eWidth < eHeight ? eWidth : eHeight)/6.0;
+    double thickness = radius;
+    for(int i=0; i< numColumns; i++){
+        ex = x + i*cw + spacing/2.0;
+        for(int j=0; j<numRows; j++){
+            // make buttons
+            
+            ey = y + j*ch + spacing/2.0;
+            T *butt = new T(ex,ey,eWidth,eHeight,thickness,radius,hi,bg,lo,bg);
+        
+            
+            subElements.push_back(butt);
+        }
+    }
+    
+}
+