ASCII Codes for BS and DEL are reversed

Hello all -

I’m having an issue where I’m getting reversed ascii codes for the BS and DEL keys. I have a simple command-line-interface built into my GLUT window where I frequently use the BS & DEL to edit the typed commands.

To help debug the problem, I am displaying the ascii code in my “keys” function that is registered with GLUT:

glutKeyboardFunc( keys );

I have tested this on 5 builds and the only problems (to my understanding) are with the Apple Frameworks for GLUT and OpenGL.

The 5 builds are:

  1. Codewarrior Mac “Carbon” using a downloaded GLUT SDK library
  2. Codewarrior Mac “Mach-O” using the Frameworks
  3. Scons (Mac) linking in the frameworks
  4. XCode, also linking in the frameworks
  5. also, a Linux(mesa?) build using SCons

CW Carbon & Linux yield the expected resulta:

BS → int 8, hex 8
DEL → int 127, hex 7f

However, on the builds using the Frameworks (CW Mach, SCons, XCode), the results are reversed

BS → int 127, hex 7f
DEL → int 8, hex 8

I work in an environment where multi-platform-compatible code is required (Mac, Windows, SGI, Sun, Linux, etc), thus I need to understand what’s happening, so I can put in any “fixes” if there is a problem using the frameworks. I use a G5(2x2.0) with an upgraded ATI graphics card.

I have not tested this on any other platforms as of yet. So, any comments/thoughts would be much appreciated…

Thanks,
ATG

You can obtain the source code for the GLUT OS X framework (might be slightly out of date now…) from
http://developer.apple.com/samplecode/glut/glut.html

If you look at macx_event.m, you can see how the Delete key is handled. Hope that helps.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.