58 lines
1.0 KiB
C++
58 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
struct xcb_connection_t;
|
|
|
|
struct alignas(16) Vec4 {
|
|
float x, y, z, w;
|
|
};
|
|
|
|
namespace ffi {
|
|
struct Core;
|
|
|
|
struct RedrawArgs {
|
|
Vec4 background;
|
|
float cam_yaw;
|
|
float cam_pitch;
|
|
float cam_distance;
|
|
float cam_fovy;
|
|
};
|
|
} // namespace ffi
|
|
|
|
using ffi::RedrawArgs;
|
|
|
|
class MutCore {
|
|
friend class BoxCore;
|
|
|
|
public:
|
|
explicit operator bool() const { return ptr; }
|
|
|
|
void configure(std::uint32_t width, std::uint32_t height) const;
|
|
void redraw(const RedrawArgs& args) const;
|
|
|
|
private:
|
|
ffi::Core* ptr = nullptr;
|
|
ffi::Core* use() const;
|
|
};
|
|
|
|
class BoxCore {
|
|
public:
|
|
BoxCore() = default;
|
|
BoxCore(const BoxCore&) = delete;
|
|
BoxCore(BoxCore&&);
|
|
BoxCore& operator=(const BoxCore&) = delete;
|
|
BoxCore& operator=(BoxCore&&);
|
|
~BoxCore();
|
|
|
|
explicit operator bool() const { return !!ptr; }
|
|
const MutCore* operator->() const { return &ptr; }
|
|
|
|
void reset();
|
|
|
|
static BoxCore from_xcb(xcb_connection_t* connection, std::uint32_t window, std::uint32_t width, std::uint32_t height);
|
|
|
|
private:
|
|
MutCore ptr;
|
|
};
|