Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KeyBoard Library (for QB64PE v 4.4.0 up)
#1
This is basically Windows Only.  You can plug it into your Linux/Mac systems, but it simply defaults back to _KEYHIT and does nothing else for you guys.

Keyboard Input Enhancement Library

High‑Precision, Fully Remappable, International‑Ready Keyboard Control for QB64

The Keyboard Input Enhancement Library is a complete replacement for QB64’s built‑in keyboard handling. It delivers a modern, event‑driven input system with full modifier awareness, customizable key mappings, international layout support, and an advanced text‑entry engine. Whether you’re building a game, a text editor, a form system, or a multilingual application, this library gives you precise, reliable control over every key on the keyboard.

At its core, the library captures raw key states directly from the operating system and translates them into a flexible mapping table covering all 254 physical key indices. Each key can return different values depending on Shift, Ctrl, Alt, AltGr, or any combination of modifiers. Developers can freely redefine how any key behaves, making it easy to support custom layouts, shortcut systems, or specialized input schemes.

The library includes a robust initialization system that loads a complete default US keyboard layout and optionally applies German, Western European, or Italian remaps. Every key’s unmodified, shifted, controlled, alt‑modified, and AltGr‑modified values can be overridden, along with extended combinations like Ctrl+Alt+Shift or Shift+AltGr.

For real‑time input, the library provides two essential tools:
• KeyHit — an event‑based function that reports key presses, releases, repeats, and modifier states
• KeyDown — a polling function that reports whether a mapped key is currently held

Together, they offer the responsiveness and precision needed for games, editors, and interactive applications.

For text entry, the library includes a fully interactive input engine that behaves more like a lightweight editor than a traditional INPUT statement. It supports cursor movement, backspace, delete, undo, paste, password masking, numeric validation, length limits, screen positioning, and ALT‑code entry. This system is available both as a SUB (writing into a variable) and as a FUNCTION (returning the final string directly).

AltGr support is fully customizable, allowing developers to define which key or key combination should act as AltGr. This is essential for international keyboards and applications requiring third‑level characters.

Overall, the Keyboard Input Enhancement Library transforms QB64’s keyboard handling into a powerful, flexible, and highly configurable system suitable for modern software. It gives developers complete control over key behavior, modifier logic, and text input, enabling richer interfaces and more professional user experiences.


Attached Files
.7z   Keyboard Library.7z (Size: 18.6 KB / Downloads: 8)
Reply
#2
Updated this library to now work with QB64PE version 4.4.0 and up.

There's now documentation included in here.  YAYYY!!

The library now is also in the new *.QLB format which I'm personally adopting to tell the difference in old style *.BI and *.BM libraries and new libraries which are completely self contained *.QLB libraries.

Just put this single include at the top of your code and you're good to go.
Reply
#3
Yeah, we're in the same camp on this one, but I sure wish GLUT would get fixed to improve key selection, fix that ctrl + j is the same as ctrl + Enter, and few other regularities like the Inkey$ one I posted in a General Discussion thread. I have a few apps that are Windows only, because of these problems. I just needed better keyboard and mouse use, so I went to using Win32API for these solutions. 

I do like your library defaults back to _Keyhit for non-windows users. Very 'Pete' of you! Big Grin

Pete
Reply
#4
Reloaded the library to use *.QLB for the joint library extension instead of *.LIB.  

lib is used in modern languages, whereas QLB doesn't seem to be.  PLUS, QLB was the old QB45 library extension for use with Quick Libraries.  It just seemed more suitable and less confusing than .LIB did.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Draw Library (for QB64PE v4.4 up) SMcNeill 5 785 02-12-2026, 01:54 AM
Last Post: madscijr
  Input Devices Library SMcNeill 2 164 02-01-2026, 10:36 PM
Last Post: SMcNeill
  Date Library (v 4.4.0 up) SMcNeill 4 251 02-01-2026, 09:37 PM
Last Post: SMcNeill
  Screen Library SMcNeill 0 573 05-09-2025, 02:41 PM
Last Post: SMcNeill
  Text to Speech Library (Windows only) SMcNeill 11 4,026 07-01-2023, 07:58 PM
Last Post: mnrvovrfc

Forum Jump:


Users browsing this thread: 1 Guest(s)