diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/cursor.cpp | 13 | ||||
-rw-r--r-- | src/client/window.cpp | 16 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/client/cursor.cpp b/src/client/cursor.cpp new file mode 100644 index 0000000..4e76151 --- /dev/null +++ b/src/client/cursor.cpp @@ -0,0 +1,13 @@ +struct Cursor { + int x; + int y; + Window *w; + + void move_left() { + if (x > 0) x--; + } + + void move_right() { + if (x < w->width - 1 && w->pos(x + 1, y) != 0) x++; + } +}; diff --git a/src/client/window.cpp b/src/client/window.cpp new file mode 100644 index 0000000..e718e63 --- /dev/null +++ b/src/client/window.cpp @@ -0,0 +1,16 @@ +struct Window { + char *view; + int width; + int height; + + void init() { + view = new char[width * height]; + for (int i = 0; i < width * height; i++) { + view[i] = 0; + } + } + + char pos(size_t x, size_t y) { + return view[x + y * width]; + } +}; |