Sunday, December 13, 2009

The keyboard texturing

Putting up a letter on each key was the trickiest part:

An array of all keys was created:



#declare row1Keys = array[17]{"Esc","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12", "NmLk", "Prnt", "Insr", "Delt" }
#declare row2KeysTop = array[14]{"``","!"," ","£","$","%","^","&","*","(",")","_","+", " "}
#declare row2KeysBtm = array[14]{"¬","1","2","3","4","5","6","7","8","9","0","-","=", "Backspace"}
#declare row3Keys = array[14]{"Tab","Q","W","E","R","T","Y","U","I","O","P","[","]", "~"}
#declare row4Keys = array[13]{"Caps Lock","A","S","D","F","G","H","J","K","L",":","@","Enter"}
#declare row5Keys = array[14]{"Shift","Z","X","C","V","B","N","M","<",">","?","Shift","Up", "End"}
#declare row6Keys = array[11]{"Ctrl","Fn","Win","Alt"," ","Alt Gr","Ctrl","RgtCl","Left","Down","Right"}


Then the following macro was able to create a key and put text on top of it:


// row 1
#local i = 0;
#while (i < 17)

object { keyboardKey (0.84, 0.6) translate<13.3*i, 0, 0>}
object { laptopKeyText(row1Keys[i]) translate <-4+13.3*i, 7.5, -0.5>}

#local i = i+1;
#end

//row 2
#local i = 0;
#while (i < 13)

object { keyboardKey (1, 1) translate<15*i, 0, -12>}
object { laptopKeyText(row2KeysTop[i]) translate <-5+15*i, 7.5, -9.5>}
object { laptopKeyText(row2KeysBtm[i]) translate <-5+15*i, 7.5, -15.5>}

#local i = i+1;
#end
object { keyboardKey (2, 1) translate<204, 0, -12>}
object { laptopKeyText(row2KeysBtm[13]) translate <15*13, 7.5, -15.5>}






The final result:

No comments:

Post a Comment