Hello Guys, Lately I’ve been experimenting with Keyboard using GetKeyState inside of the Update method and it’s showing good results, however it’s hard to control the flow of program inside the Update method. Currently I’m looking for a way to use GetKeyState to generate a touch or a dispatcher triggering that a ccTouchBegan occurred do you guys have any idea how to do it?
Example
//The button
bool HelloWorld::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
location = this->convertTouchToNodeSpace(touch);
if (CCRect::CCRectContainsPoint(leftButton.BoundingBox(),location))
{
make the sprite move Left....
}
}
The init method that will generate a touch
void HelloWorld::update(ccTime dt)
{
if (GetKeyState(VK_LEFT) & 0x8000)
{
make leftButton get touched....
}
}
Hi, which platform you want to simulate a touch event, you can look at CCEGLView::WindowProc method of CCEGLView_win32.cpp if you just want to achieve that on win32.