Skip to content

Commit

Permalink
Apply Guichan's changes from 1ca1ea270f50bb33bb5b06402808075b837c1e9c…
Browse files Browse the repository at this point in the history
… (Feb 23th 2008)

== and != operators have been added.
  • Loading branch information
Jarod42 committed Aug 13, 2024
1 parent aedc8ac commit ffaf923
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from 2f431b404983b49adfd3cca1c39a9b0a9616e70d
* Continue rebasing from 3cffde49fee87bfe5a426e8c799f143ed965cc60
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
17 changes: 17 additions & 0 deletions include/guisan/key.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ namespace gcn
*/
char getChar() const;


/**
* Compares to keys.
*
* @param key The key to compare this key with.
* @return True if the keys are equal, false otherwise.
*/
bool operator==(const Key& key) const;

/**
* Compares to keys.
*
* @param key The key to compare this key with.
* @return True if the keys are not equal, false otherwise.
*/
bool operator!=(const Key& key) const;

/**
* An enum with key values.
*/
Expand Down
26 changes: 18 additions & 8 deletions src/key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,22 @@ namespace gcn
{
return mValue;
}

char Key::getChar() const
{
if(mValue == 9 || mValue == 13 || (mValue <= 122 && mValue >= 32))
return (char)mValue;

return '\0';
}

char Key::getChar() const
{
if (mValue == 9 || mValue == 13 || (mValue <= 122 && mValue >= 32))
return (char) mValue;

return '\0';
}

bool Key::operator==(const Key& key) const
{
return mValue == key.mValue;
}

bool Key::operator!=(const Key& key) const
{
return (mValue != key.mValue);
}
}

0 comments on commit ffaf923

Please sign in to comment.