[SDL] Problem with uppercase characters.

Bill Conan billconan at gmail.com
Sat Jan 6 19:46:45 PST 2007


to Alan Wolfe:

thank you for replying, but i'm pretty sure that i used
SDL_EnableUNICODE(1); before everything.

the program is fine when i type lowercase characters.

is there any examples?

here is my current code:

in the loop:

			SDL_Event event;
			while(SDL_PollEvent(&event))
			{
				switch(event.type)
				{
					case SDL_QUIT:
					{
						break;
					}
					case SDL_MOUSEBUTTONUP:
					{
						AssortedWidgets::UI::getSingleton().importMouseRelease(event.button.button,event.button.x,event.button.y);
						break;
					}
					case SDL_MOUSEBUTTONDOWN:
					{
						AssortedWidgets::UI::getSingleton().importMousePress(event.button.button,event.button.x,event.button.y);
						break;
					}
					case SDL_KEYDOWN:
					{
						AssortedWidgets::UI::getSingleton().importKeyDown(event.key.keysym.unicode,event.key.keysym.mod);
						break;
					}
					case SDL_KEYUP:
					{
						//out=true;
						AssortedWidgets::UI::getSingleton().importKeyUp(event.key.keysym.unicode,event.key.keysym.mod);
						break;
					}
				}
			}

and this is the function to handle the key event:

		void importKeyDown(int keyCode,int modifier)
		{
                        //if i press shift, the keyCode is zero and
modifier is 4096
			if(Manager::TypeActiveManager::getSingleton().isActive())
			{
				Manager::TypeActiveManager::getSingleton().onCharTyped(static_cast<char>(keyCode),modifier);
			}
			printf("%d",keyCode);
		};

can i determine whether the key event is generated by normal keys or
by modifiers? i think every time i press the shift key, it generates a
key down event before i press the character key. and that is why i
always get the keycode 0.




More information about the SDL mailing list