65 lines
No EOL
2.3 KiB
C++
65 lines
No EOL
2.3 KiB
C++
/*
|
|
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
|
|
*/
|
|
|
|
export module Crafter.Graphics:WindowWaylandWayland;
|
|
import std;
|
|
import Crafter.Event;
|
|
import :WindowWayland;
|
|
|
|
export namespace Crafter {
|
|
/**
|
|
* @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`.
|
|
*/
|
|
class WindowWaylandWayland : public WindowWayland {
|
|
public:
|
|
/**
|
|
* @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.
|
|
*/
|
|
WindowWaylandWayland(std::string name, std::uint32_t width, std::uint32_t height);
|
|
/**
|
|
* @brief Destructor cleans up Wayland-specific window resources and framebuffer.
|
|
*/
|
|
~WindowWaylandWayland();
|
|
/**
|
|
* @brief Starts the event loop asynchronously.
|
|
*
|
|
* This method triggers rendering without blocking the caller.
|
|
*/
|
|
void StartAsync();
|
|
/**
|
|
* @brief Starts the event loop synchronously.
|
|
*
|
|
* This method blocks the caller until the event loop stops.
|
|
*/
|
|
void StartSync();
|
|
private:
|
|
std::thread thread;
|
|
};
|
|
} |