🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Beta Code Question - Why use SNeheSettings?

Started by
5 comments, last by MVP 17 years, 2 months ago
Why not just put all the variables from the SNeheSettings struct into CNeheBaseWindow? I'm not criticizing, I am just asking for learning purposes as that's what I would have done.
Advertisement
We could have done it either way. However, this method allows us to turn the structure into a class with LoadSettings() and SaveSettings() type functions without much hassle. IIRC at one stage I did start writing such methods but removed them as they were uneccessary for the basecode.
Member of the NeHe team.
Ahhh good deal to write out to an ini and read settings from it or something. Gotcha. :)

Oh another question? For the m_keyStates variable why an array of 256 when there are over 300?
Um, the original NeHe tutorials used 255, also there are 255 VK_* codes in Windows, that's not to say that the value 255 is right however, I think this is just one of those things that has just carried over. I'll look into it.
Member of the NeHe team.
In the SDL key definitions there are 322 and they keypad definitions are a little bit after 255 so you are missing those ..I think.. unless I totally missed something which is very possible. :)
well, but who needs keys like Windows key, Power, sleep or wake up keys and this stuff for an openGL app?

If you want to write an ultrarealistical flight simulator you perhaps need them, but then the game's no fun anymore so ... Do you really miss something with "only" 255 keys?
/* Numeric keypad */
SDLK_KP0 = 256,
SDLK_KP1 = 257,
SDLK_KP2 = 258,
SDLK_KP3 = 259,
SDLK_KP4 = 260,
SDLK_KP5 = 261,
SDLK_KP6 = 262,
SDLK_KP7 = 263,
SDLK_KP8 = 264,
SDLK_KP9 = 265,
SDLK_KP_PERIOD = 266,
SDLK_KP_DIVIDE = 267,
SDLK_KP_MULTIPLY = 268,
SDLK_KP_MINUS = 269,
SDLK_KP_PLUS = 270,
SDLK_KP_ENTER = 271,
SDLK_KP_EQUALS = 272,

/* Arrows + Home/End pad */
SDLK_UP = 273,
SDLK_DOWN = 274,
SDLK_RIGHT = 275,
SDLK_LEFT = 276,
SDLK_INSERT = 277,
SDLK_HOME = 278,
SDLK_END = 279,
SDLK_PAGEUP = 280,
SDLK_PAGEDOWN = 281,

/* Function keys */
SDLK_F1 = 282,
SDLK_F2 = 283,
SDLK_F3 = 284,
SDLK_F4 = 285,
SDLK_F5 = 286,
SDLK_F6 = 287,
SDLK_F7 = 288,
SDLK_F8 = 289,
SDLK_F9 = 290,
SDLK_F10 = 291,
SDLK_F11 = 292,
SDLK_F12 = 293,
SDLK_F13 = 294,
SDLK_F14 = 295,
SDLK_F15 = 296,

/* Key state modifier keys */
SDLK_NUMLOCK = 300,
SDLK_CAPSLOCK = 301,
SDLK_SCROLLOCK = 302,
SDLK_RSHIFT = 303,
SDLK_LSHIFT = 304,
SDLK_RCTRL = 305,
SDLK_LCTRL = 306,
SDLK_RALT = 307,
SDLK_LALT = 308,
SDLK_RMETA = 309,
SDLK_LMETA = 310,
SDLK_LSUPER = 311, /* Left "Windows" key */
SDLK_RSUPER = 312, /* Right "Windows" key */
SDLK_MODE = 313, /* "Alt Gr" key */
SDLK_COMPOSE = 314, /* Multi-key compose key */

/* Miscellaneous function keys */
SDLK_HELP = 315,
SDLK_PRINT = 316,
SDLK_SYSREQ = 317,
SDLK_BREAK = 318,
SDLK_MENU = 319,
SDLK_POWER = 320, /* Power Macintosh power key */
SDLK_EURO = 321, /* Some european keyboards */
SDLK_UNDO = 322, /* Atari keyboard has Undo */

Those are the ones being missed I think.

This topic is closed to new replies.

Advertisement