rewrite time
This commit is contained in:
parent
d6b9b87da4
commit
4428cfe12c
24 changed files with 1208 additions and 893 deletions
72
interfaces/Crafter.Graphics-WindowBase.cppm
Normal file
72
interfaces/Crafter.Graphics-WindowBase.cppm
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
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 version 3.0 as published by the Free Software Foundation;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
module;
|
||||
|
||||
#ifdef CRAFTER_GRAPHICS_WAYLAND
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include "../lib/xdg-shell-client-protocol.h"
|
||||
#include "../lib/wayland-xdg-decoration-unstable-v1-client-protocol.h"
|
||||
#include <wayland-cursor.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
#endif
|
||||
|
||||
export module Crafter.Graphics:WindowBase;
|
||||
import std;
|
||||
import :Types;
|
||||
import Crafter.Event;
|
||||
|
||||
export namespace Crafter {
|
||||
enum WindowCapabilities {
|
||||
CRAFTER_WINDOWCAPTABILITIES_FRAMEBUFFER = 0b1,
|
||||
CRAFTER_WINDOWCAPTABILITIES_KEYBOARD = 0b10,
|
||||
CRAFTER_WINDOWCAPTABILITIES_MOUSE = 0b100,
|
||||
};
|
||||
|
||||
class UiElementBase;
|
||||
class WindowBase {
|
||||
public:
|
||||
Event<void> onClose;
|
||||
Event<void> onUpdate;
|
||||
bool open;
|
||||
std::vector<std::unique_ptr<UiElementBase>> elements;
|
||||
WindowBase(WindowBase&) = delete;
|
||||
WindowBase(WindowBase&&) = delete;
|
||||
WindowBase& operator=(const WindowBase&) = delete;
|
||||
void StartSync();
|
||||
void StartUpdate(void* window);
|
||||
void StopUpdate();
|
||||
#ifdef CRAFTER_GRAPHICS_WAYLAND
|
||||
WindowBase();
|
||||
~WindowBase();
|
||||
#endif
|
||||
protected:
|
||||
friend class WindowKeyboard;
|
||||
friend class WindowFramebuffer;
|
||||
friend class WindowTitle;
|
||||
#ifdef CRAFTER_GRAPHICS_WAYLAND
|
||||
wl_surface* surface = nullptr;
|
||||
wl_callback* cb = nullptr;
|
||||
static void wl_surface_frame_done(void* data, struct wl_callback *cb, uint32_t time);
|
||||
static wl_callback_listener surface_frame_listener;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue