Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualslicer4ever

Posted 14 March 2013 - 11:23 PM

depends on how IsNewKeyPress is implemented, can you capture key changes, or do you poll the entire keyboard?

 

in my keyboard implementation, i store an array of characters that recently changed, so i go over that list, and add the characters to my input field.

 

however, if you don't have any indication of what keys have changed, at best loop over the keys:

 

 

 //assuming ascii key chart, and first key is something like 32, and last key is something like 96 in ascii key chart.
 for(int i=FIRST_KEY;i<=LAST_KEY;i++){
  if(IsNewKeyPress(i)){
   if(LeftShift || RightShift) text+=upper(i); //upper returns an uppercase if possible, otherwise returns i. Also I stream-lined your left/right shift check.
   else text+=i;
 }
}

#1slicer4ever

Posted 14 March 2013 - 11:22 PM

depends on how IsNewKeyPress is implemented, can you capture key changes, or do you poll the entire keyboard?

 

in my keyboard implementation, i store an array of characters that recently changed, so i go over that list, and add the characters to my input field.

 

however, if you don't have any indication of what keys have changed, at best loop over the keys:

 

 //assuming ascii key chart, and first key is something like 32, and last key is something like 96 in ascii key chart.
 for(int i=FIRST_KEY;i<=LAST_KEY;i++){
  if(IsNewKeyPress(i)){
   if(LeftShift || RightShift) text+=upper(i); //upper returns an uppercase if possible, otherwise returns i. //stream-lined your left/right shift check.
   else text+=i;
 }
}

PARTNERS