Mercurial > hg > tweakathon2ios
annotate UI code/UIGrid.mm @ 52:89944ab3e129 tip
fix oF linker errors ios8
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 03 Feb 2015 13:18:23 +0000 |
parents | a223551fdc1f |
children |
rev | line source |
---|---|
rt300@0 | 1 // |
rt300@0 | 2 // UIGrid.cpp |
rt300@0 | 3 // emptyExample |
rt300@0 | 4 // |
rt300@0 | 5 // Created by Robert Tubb on 22/05/2013. |
rt300@0 | 6 // |
rt300@0 | 7 // |
rt300@0 | 8 |
rt300@0 | 9 #include "UIGrid.h" |
rt300@0 | 10 |
rt300@0 | 11 |
rt300@0 | 12 |
rt300@0 | 13 template<class T> void UIGrid<T>::print(){ |
rt300@0 | 14 cout << "uh \n"; |
rt300@0 | 15 } |
rt300@0 | 16 |
rt300@0 | 17 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) |
rt300@0 | 18 { |
rt300@0 | 19 |
rt300@0 | 20 // grid of what ? |
rt300@0 | 21 double cw = width/(double)numColumns; |
rt300@0 | 22 double ch = height/(double)numRows; |
rt300@0 | 23 |
rt300@0 | 24 double eWidth = cw - spacing; |
rt300@0 | 25 double eHeight = ch - spacing; |
rt300@0 | 26 double ex,ey; |
rt300@0 | 27 double radius = (eWidth < eHeight ? eWidth : eHeight)/6.0; |
rt300@0 | 28 double thickness = radius; |
rt300@0 | 29 for(int i=0; i< numColumns; i++){ |
rt300@0 | 30 ex = x + i*cw + spacing/2.0; |
rt300@0 | 31 for(int j=0; j<numRows; j++){ |
rt300@0 | 32 // make buttons |
rt300@0 | 33 |
rt300@0 | 34 ey = y + j*ch + spacing/2.0; |
rt300@0 | 35 T *butt = new T(ex,ey,eWidth,eHeight,thickness,radius,hi,bg,lo,bg); |
rt300@0 | 36 |
rt300@0 | 37 |
rt300@0 | 38 subElements.push_back(butt); |
rt300@0 | 39 } |
rt300@0 | 40 } |
rt300@0 | 41 |
rt300@0 | 42 } |
rt300@0 | 43 |