Implemented something like a console (still WIP).
This commit is contained in:
@@ -19,6 +19,14 @@ private:
|
||||
public:
|
||||
[[nodiscard]] bool full() const noexcept { return mBufferedElements == SIZE; }
|
||||
[[nodiscard]] bool empty() const noexcept { return mBufferedElements == 0; }
|
||||
[[nodiscard]] std::size_t size() const noexcept { return mBufferedElements; }
|
||||
|
||||
[[nodiscard]] T& operator[](std::size_t index) noexcept { return at(index); }
|
||||
[[nodiscard]] const T& operator[](std::size_t index) const noexcept { return at(index); }
|
||||
|
||||
[[nodiscard]] T& at(std::size_t index) noexcept { return mElements[(index + mPosition) % SIZE]; }
|
||||
[[nodiscard]] const T& at(std::size_t index) const noexcept { return mElements[(index + mPosition) % SIZE]; }
|
||||
|
||||
bool append(T element) noexcept
|
||||
{
|
||||
if (full()) {
|
||||
@@ -29,6 +37,7 @@ public:
|
||||
mPosition = (mPosition + 1) % SIZE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool next(T& outElement) noexcept
|
||||
{
|
||||
if (empty()) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#if !defined(OS_TTY_HPP_INCLUDED)
|
||||
#define OS_TTY_HPP_INCLUDED 1
|
||||
|
||||
#include <string>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -39,9 +40,12 @@ void initialize() noexcept;
|
||||
void setColor(VgaDoubleColor color) noexcept;
|
||||
void putEntryAt(char chr, VgaDoubleColor color, size_t posX, size_t posY) noexcept;
|
||||
void putChar(char chr) noexcept;
|
||||
void deleteChar() noexcept;
|
||||
void write(const char* data, size_t size) noexcept;
|
||||
void write(const char* data) noexcept;
|
||||
|
||||
[[nodiscard]] const std::string& readLine() noexcept;
|
||||
|
||||
bool setPSFFont(const void* data, size_t length) noexcept;
|
||||
} // namespace tty
|
||||
|
||||
|
||||
Reference in New Issue
Block a user