Hi Guys,
I want to first say thanks for the awesome work you’ve put into openframworks. It certainly has made my multi-touch app development much more fun and less painful 
Anyways, I’ve been developing a multi-touch app using openframeworks, and I am wondering if does anyone know of a virtual keyboard addon/package/solution that can be readily incorporated into openframeworks? I have came across various other virtual keyboards, but they were written in either AS3 or python, so it doesn’t mesh well with openframeworks/c++.
Thanks for any help!
Can you post your multi touch source code here?
are you talking about the blob tracking part of my multi-touch app?
If so, I am currently using http://ccv.nuigroup.com/
The CCV code within the svn depository comes with openframeworks 0.06 included, so pretty much everything is set up for you. hope that helps
Hey Soccerbud,
I’m also working on a longer-term multitouch app and I’m super interesting in making an on screen keyboard. If you can post up some links to any flash code or whatever for this it would be a good start. I am probably gonna make something like this in the near future in OF.
Hello all, I´m also interested on virtual keyboard for multitouch projects.
I develop one using processing I think it could be easy to port it to c++.
I´m new at OF and C++ so I´m stack on the basic part of opening and splitting the info of the map.kbd
This is the keyboard map that use to draw it. It´s use polar geometry in order to be possible the rotation and not loosing functionality. The source is well commented but in my raw english 
Here is the source and the post explaining how it works: http://www.patriciogonzalezvivo.com/blog/?p=94
I thinks together we can make this work pretty easy.
Patricio
Hello! I start migrating the virtual keyboard app that I made on Processing.
Just the one that use the keyboard map, not the one that makes it.
But as I said I´m stock on the loading of the file. It compile. Runs… start loading the information of where to put the keys… but it seams that get an error when loads the keys in to a .
End tragically with:
Tiper3Debug(7408,0xa0a35500) malloc: *** error for object 0x930c00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Tiper3Debug(7408,0xa0a35500) malloc: *** error for object 0x8e6800: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Program received signal: EXC_BAD_ACCESS.
sharedlibrary apply-load-rules all
Cannot access memory at address 0xc1080000
This is part of the code that it´s geting me crazy:
bool ofxKeyboard::loadMap(const string& _keymapPath){
ifstream file;
file.open( ofToDataPath(_keymapPath).c_str(),ifstream::in);
if (file.is_open()){
int counter = 0;
while (file.good()){
string line;
getline(file, line);
cout << "Reading: " << line << endl;
vector <string> values = ofSplitString(line, ",");
if ( (counter == 0) && (values.size()) == 4) {
w = ofToFloat(values[2]);
h = ofToFloat(values[3]);
printf("Header saved.\n");
} else if ((values.size() == 5)) {
string letter = values[0].c_str();
float radio = ofToFloat(values[1].c_str());
float angle = ofToFloat(values[2].c_str());
int width = ofToInt(values[3].c_str());
int height = ofToInt(values[4].c_str());
keys.push_back(ofxKey(pos, letter, radio, angle, width, height));
}
counter++;
}
file.close();
}
}
Any idea? recomendation? help!
Here the source code: http://dl.dropbox.com/u/335522/web/code/ofTiper3.zip
the original on processing: http://dl.dropbox.com/u/335522/web/code/Tiper3.zip
And the keymap maker: http://dl.dropbox.com/u/335522/web/code-…-pMaker.zip
Hello! I´m glad to say that now I works!
I put it together like a addons.
I hope you found it usefull. Here is the code and the example:
http://dl.dropbox.com/u/335522/web/code/ofxKeyboard.zip
Lot´s of things need to be done… like event handlers
I´m looking how to host the code on google codes… buts my first time in every thing
Sorry that I´m writing lot´s of entries.
I´m exited for contributing to the project.
I move the source to:
http://code.google.com/p/ofxkeyboard/
Patricio
Hello again, I have been working on this addon and I need some mathematics help to figurate out:
- how to make the movements and rotation more smooth and accurate
- When resize it lose some proportion the key layout with the border of the keyboard
- How to recognize rectangular areas using polar coordinates ( I guess there is a mathematical equation to calculate this). In order to make SPACE bar and SHIT / CONTROL keys work
The source it´s at:
http://code.google.com/p/ofxkeyboard/
Here it´s a video showing how it´s works right now:
http://www.youtube.com/watch?v=NK7HprPYQMY
And here is the code that handles this actions:
void ofxKeyboard::tuioAdded(ofxTuioCursor &tuioCursor){
Vec2f loc = Vec2f(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
if (isOver(loc)) // IF the cursor is over the keyboard
if (!checkKeys(loc)) // ... and it´s not pressing a key
if (isOnBorder(loc)){ // ... and wish location is near the borders
tCursor c;
c.idN = tuioCursor.getSessionId();
c.loc = loc;
if (cursorsOnBorder.size() == 0){ // If it´s the first finger over the border it will save remember it
cursorsOnBorder.push_back(c);
} else if (cursorsOnBorder.size() == 1){ // If it´s the second one it will check if it´s at the right distance
if (cursorsOnBorder[0].loc.distance(loc) >= width*0.8){ // It it is it will remember the distance, position and angle between fingers
cursorsOnBorder.push_back(c);
Vec2f horizont = cursorsOnBorder[0].loc - loc;
orgDis = cursorsOnBorder[0].loc.distance(loc);
orgAng = -1*atan2(horizont.x, horizont.y) - angle;
orgLoc = position - (cursorsOnBorder[0].loc + (horizont/2));
}
}
}
}
void ofxKeyboard::tuioUpdated(ofxTuioCursor &tuioCursor){
Vec2f loc = Vec2f(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
for ( int i = 0; i < cursorsOnBorder.size(); i++)
if (cursorsOnBorder[i].idN == tuioCursor.getSessionId())
cursorsOnBorder[i].loc = loc;
if (cursorsOnBorder.size() == 2){
Vec2f horizont = cursorsOnBorder[0].loc - cursorsOnBorder[1].loc;
float distance = cursorsOnBorder[0].loc.distance(cursorsOnBorder[1].loc);
float scaleFactor = distance / orgDis;
float newAngle = -1*atan2(horizont.x, horizont.y) - orgAng;
Vec2f newPos = cursorsOnBorder[0].loc + (horizont/2) + orgLoc;
if ((scaleFactor <= 0.9)||(scaleFactor >= 1.1)){
orgLoc *= scaleFactor;
resize(scaleFactor);
orgDis = distance;
}
if ((newAngle >= -0.5) || (newAngle >= 0.5)) {
angle = newAngle;
}
if ( newPos.distance(position) >= 10 ){
position = newPos;
orgLoc = position - (cursorsOnBorder[0].loc + (horizont/2));
for (int i = 0; i < nKeys; i++){
keys[i].update();
}
}
}
}
void ofxKeyboard::tuioRemoved(ofxTuioCursor &tuioCursor){
for (int i = 0; i < cursorsOnBorder.size(); i++ )
if (cursorsOnBorder[i].idN == tuioCursor.getSessionId())
cursorsOnBorder.clear();
}
Hi Patricio,
Is it compatible with Of 0.9? I’m running the example but it gives a white keyboard, I will try using 0.8