-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.2.1 - unicode, string improvements, bugfixes
- Loading branch information
1 parent
de47f20
commit d659e05
Showing
17 changed files
with
330 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef CAT_WINDOW_TEXTFIELD_HPP | ||
#define CAT_WINDOW_TEXTFIELD_HPP | ||
|
||
#include "../base/window.hpp" | ||
|
||
namespace cat { | ||
|
||
class TextField : public Window { | ||
Vector2 curs_position; | ||
size_t idx = 0; | ||
|
||
public: | ||
TextField(const Vector2& position, const Vector2& resolution) | ||
: Window::Window(position,resolution) { | ||
key_check = [](const key& k) { return isprint(k); }; | ||
key_handler = [&](const key& k) { | ||
buffer->get_raw().append(std::string(1,(char)k)); | ||
++idx; | ||
curs_position += Vector2{1,0}; | ||
|
||
clear(); | ||
draw_buffer(); | ||
redraw(); | ||
}; | ||
} | ||
|
||
virtual TextField& append(const CatString& str); | ||
virtual TextField& clear_text(); | ||
virtual CatString& get(); | ||
|
||
}; | ||
|
||
} // namespace cat | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.