Virtual Keyboard Improvements

From ScummVM :: Wiki
Jump to navigation Jump to search

Eugene's thoughts about Virtual Keyboard implementation

For virtual keyboard I offer following approach:

  • A "keyboard pack" will look similar to our GUI theme pack, i.e. it will contain images along with some kind of .ini file with the pack description
  • We will use HTML IMGMAP format for describing particular positions of the keys on a bitmap, but restirct it to polygons and rectangles. This will let us use free tools like Gimp to produce keyboard layouts
  • Then there will be several enchancements to IMGMAP format (in fact, it will be incapsulated into some bigger file). You should be able to assign some keys special actions such as switching keyboard layout. Those will not generate any key events, but will switch internal state of the keyboard.
  • Another enchancement is that single pack should contain not only different layouts such as Caps lock, special characters, normal, but also layouts for several resolutions. I.e. since we deliberately put this restriction and use bitmaps for the layouts, and not some kind of vector format (due to visual richness this approach will bring us), we need to make sure the pack will work in all modes.
  • The keyboard bitmaps should support keycolor transparency

All bitmap loading code is already present in ScummVM, so there is no need to worry about. Also it is assumed that the keyboard will live in same 16-bit surface as our GUI does.

Speaking of the functionality, we have EventManager, where all engines get events from, so this is trivial to inject those events into its queue.

Also it is assumed that keyboard will pause engine, i.e. will not work in real time. For real time action there are hardware key mappings. Although, it is still possible to do, just will be not easy.