diff options
Diffstat (limited to 'Source/Framebuffer.cxx')
| -rw-r--r-- | Source/Framebuffer.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/Framebuffer.cxx b/Source/Framebuffer.cxx new file mode 100644 index 00000000..045e405a --- /dev/null +++ b/Source/Framebuffer.cxx @@ -0,0 +1,39 @@ +/* + * ======================================================== + * + * hCore + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#include <KernelKit/Framebuffer.hpp> + +namespace hCore +{ + Framebuffer::Framebuffer(hCore::Ref<FramebufferContext*> &addr) + : m_FrameBufferAddr(addr), m_Colour(FramebufferColorKind::RGB32) + {} + + Framebuffer::~Framebuffer() = default; + + volatile UIntPtr* Framebuffer::operator[](const UIntPtr& width_and_height) + { + if (m_FrameBufferAddr) + return reinterpret_cast<volatile hCore::UIntPtr*>(m_FrameBufferAddr->m_Base + width_and_height); + + return nullptr; + } + + Ref<FramebufferContext*>& Framebuffer::Leak() { return m_FrameBufferAddr; } + + Framebuffer::operator bool() { return m_FrameBufferAddr; } + + const FramebufferColorKind& Framebuffer::Color(const FramebufferColorKind& colour) + { + if (colour != FramebufferColorKind::INVALID) + m_Colour = colour; + + return m_Colour; + } +} // namespace hCore |
