mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 23:27:49 +01:00
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
//
|
|
// Created by Stepan Usatiuk on 26.07.2025.
|
|
//
|
|
|
|
#ifndef WINDOW_HPP
|
|
#define WINDOW_HPP
|
|
|
|
#include <type_traits>
|
|
|
|
#include "Event.hpp"
|
|
#include "Pixel.hpp"
|
|
#include "StandardEvents.hpp"
|
|
#include "utils.hpp"
|
|
|
|
template<typename Derived, typename PixelType>
|
|
requires std::is_base_of_v<Pixel, PixelType>
|
|
class Surface;
|
|
|
|
template<typename SurfaceType>
|
|
class Window : StandardEventHandler<Window<SurfaceType>> {
|
|
public:
|
|
using PixelType = typename SurfaceType::PixelType;
|
|
|
|
explicit Window(SurfaceType* owner) : _owner(owner) {
|
|
// static_assert(is_specialization_of<Surface, SurfaceType>::value);
|
|
}
|
|
|
|
virtual ~Window() = default;
|
|
|
|
EventHandlingResult handle(auto Event) { return handle_v(Event); }
|
|
|
|
virtual EventHandlingResult handle_v(KeyboardEvent) { return EventHandlingResult::CONTINUE; }
|
|
virtual EventHandlingResult handle_v(SurfaceEvent) { return EventHandlingResult::CONTINUE; }
|
|
virtual EventHandlingResult handle_v(SurfaceResizeEvent) { return EventHandlingResult::CONTINUE; }
|
|
|
|
protected:
|
|
SurfaceType* _owner = nullptr;
|
|
};
|
|
|
|
#endif // SURFACE_HPP
|