Skip to content

Commit

Permalink
Allow user to select enter/space for keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kazzmir committed Aug 22, 2006
1 parent d11a9da commit 0910c86
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const bool Keyboard::getAnyKey( int k1 ){
const bool Keyboard::keyPressed(){
return ::keypressed();
}

void Keyboard::clear(){
::clear_keybuf();
}

const int Keyboard::readKey(){
if ( ! ::keypressed() ){
Expand Down
2 changes: 2 additions & 0 deletions src/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Keyboard{
const int readKey();
const bool keyPressed();

void clear();

std::string keyToString( int key );

extern const int A;
Expand Down
20 changes: 19 additions & 1 deletion src/raptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,10 @@ int intro_screen( int & frames, SpaceObject ** player, DATAFILE * sound ){
current->init();

int option = -1;
while ( option != INIT_QUIT && option != INIT_CONTINUE && option != INIT_PLAY ) {
while ( option != INIT_QUIT &&
option != INIT_CONTINUE &&
option != INIT_PLAY ) {

Util::YIELD();
// al_poll_duh( dumb_player );
/*
Expand Down Expand Up @@ -552,6 +555,21 @@ int intro_screen( int & frames, SpaceObject ** player, DATAFILE * sound ){

}

/* wait for enter/space to be released
* so the user doesnt get into a loop of selecting
* enter or space for the key and then modifying
* that key again
*/
if ( option == CHANGE_KEY_SHOOT ||
option == CHANGE_KEY_FORWARD ||
option == CHANGE_KEY_BACKWARD ||
option == CHANGE_KEY_LEFT ||
option == CHANGE_KEY_RIGHT ){
while ( Keyboard::getAnyKey( Keyboard::SPACE, Keyboard::ENTER ) ){
Util::YIELD();
}
}

/*
if ( changed_frames ) {
free( numnum );
Expand Down

0 comments on commit 0910c86

Please sign in to comment.