Jump to content

On Screen keyboard


photo

Recommended Posts

Hi all,

I want to create a screen keyboard for desktop touch devices. Because I want it to be multiplatform (Win, Linux and OSX) and skinable my first intention it's to make it completely in UnigineScript.

The idea is, every time a key sprite is pressed, inject the corrensponding key event. the problem is engine.app.setKeyState doesn't accept other keys but APP_KEY_*.

 

There is any other way to inject key events to the application?

 

Thanks in advance.

Link to comment

Hi Andrey,

thanks for the answer.

 

I tried this:

/*
 */
void _click() {
	log.message("click!");
	engine.app.setKeyState('a', 1);
}

/*
 */
void foo(int key) {
	log.message("key: %d", key);
}

/*
 */
int init() {

	Gui gui= engine.getGui();
	
	WidgetButton btn= new WidgetButton(gui, "Press");
	btn.setCallback(GUI_CLICKED, "_click");
	btn.setData("a");
	gui.addChild(btn, GUI_ALIGN_BOTTOM);

	//register callback to receive key events.
	engine.gui.setKeyPressCallback("foo");

	return 1;
}

/*
 */
int shutdown() {
	return 1;
}

/*
 */
int update() {
	if(engine.app.clearKeyState('a'))
		log.message("a pressed");

	return 1;
}

 

Looks like gui system is not receiving key event.

Link to comment
×
×
  • Create New...