Crafter.Graphics/interfaces/Crafter.Graphics-WindowWaylandWayland.cppm

65 lines
2.3 KiB
Text
Raw Normal View History

2025-05-07 19:21:51 +02:00
/*
Crafter®.Graphics
Copyright (C) 2025 Catcrafts®
Catcrafts.net
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
2025-04-19 15:46:26 +02:00
export module Crafter.Graphics:WindowWaylandWayland;
2025-11-16 15:32:11 +01:00
import std;
2025-04-19 15:46:26 +02:00
import Crafter.Event;
import :WindowWayland;
export namespace Crafter {
2025-06-14 14:58:02 +02:00
/**
* @brief A specialized Wayland window implementation for direct drawing.
*
* This class inherits from `WindowWayland` and provides a framebuffer using the pixel format `Pixel_BU8_GU8_RU8_AU8`.
*/
2025-04-19 15:46:26 +02:00
class WindowWaylandWayland : public WindowWayland {
public:
2025-06-14 14:58:02 +02:00
/**
* @brief Framebuffer for the window using the BGRA 8-bit unsigned pixel format, use this for direct drawing to the window.
*/
Pixel_BU8_GU8_RU8_AU8* framebuffer = NULL;
/**
* @brief Constructs a new WindowWaylandWayland object.
*
* @param name The title of the window.
* @param width The width of the window in pixels.
* @param height The height of the window in pixels.
*/
2025-04-19 15:46:26 +02:00
WindowWaylandWayland(std::string name, std::uint32_t width, std::uint32_t height);
2025-06-14 14:58:02 +02:00
/**
* @brief Destructor cleans up Wayland-specific window resources and framebuffer.
*/
2025-06-13 23:59:36 +02:00
~WindowWaylandWayland();
2025-06-14 14:58:02 +02:00
/**
* @brief Starts the event loop asynchronously.
*
* This method triggers rendering without blocking the caller.
*/
2025-06-13 23:59:36 +02:00
void StartAsync();
2025-06-14 14:58:02 +02:00
/**
* @brief Starts the event loop synchronously.
*
* This method blocks the caller until the event loop stops.
*/
2025-06-13 23:59:36 +02:00
void StartSync();
2025-04-19 15:46:26 +02:00
private:
std::thread thread;
};
}