Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Guichan's changes from 1ca1ea270f50bb33bb5b06402808075b837c1e9c… #41

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}