Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FreeGlut - What do you developers think?
#9
(02-02-2026, 12:55 AM)Kernelpanic Wrote: And what about this? Could that help?

[Text]
glutKeyboardFunc sets a callback function void func(unsigned char key, int x, int y) to handle ASCII keystrokes in GLUT. When a key is pressed, it passes the character (key) and mouse coordinates (x, y). This handles letters, numbers, and symbols, but not special keys like F1 or arrow keys.

Key Details for glutKeyboardFunc:
Signature: void glutKeyboardFunc(void (*func)(unsigned char key, int x, int y)).
Usage: Used to detect key presses such as 'q' for quit or number keys for input.

Callback Parameters:
unsigned char key: The ASCII character of the pressed key.
int x, int y: Mouse position relative to the window when the key was pressed.

Limitations: Does not handle special keys (use glutSpecialFunc instead). Modifiers (Shift/Ctrl) can be checked with glutGetModifiers.
[/Text]

This depends on how the keys are polled. We can poll the Ctrl key in QB64 via freeglut, but while it's held down the plus sign key is no longer polled at its independent value. I wish they thought of that, and made a way to poll both separately. If they did, we have missed taking advantage of it.

For instance: To detect the Ctrl key and the Plus key in Win32 API, you can check for the virtual-key codes VK_CONTROL (0x11) for the Ctrl key and VK_OEM_PLUS (0xBB) for the Plus key in your message handling function. Use the WM_KEYDOWN message to determine when these keys are pressed together.

I prefer this independent system, instead of changing the values for the key combinations. As long as we had a separate way of coding for this, there would be no breaking compatibility.

Pete
Reply


Messages In This Thread
RE: FreeGlut - What do you developers think? - by Pete - 02-02-2026, 01:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Don't look now developers, but you've got a pat on your back! Pete 7 1,298 12-15-2024, 09:59 AM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)