99 lines
2.7 KiB
C++
99 lines
2.7 KiB
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Base/UI/IVulkanWindow.hpp"
|
|
|
|
namespace OpenVulkano
|
|
{
|
|
class MetalViewWindow final : public IVulkanWindow
|
|
{
|
|
WindowConfiguration windowConf;
|
|
IWindowHandler* handler = nullptr;
|
|
void* caMetalLayer = nullptr;
|
|
bool tickHandler = true;
|
|
float contentScale = 1;
|
|
float orientation = 0;
|
|
|
|
public:
|
|
void Init(RenderAPI::RenderApi renderApi) override {}
|
|
|
|
void Init(void* metalLayer, Math::Vector2ui size)
|
|
{
|
|
caMetalLayer = metalLayer;
|
|
windowConf.size = size;
|
|
}
|
|
|
|
void SetMetalLayer(void* metalLayer) { caMetalLayer = metalLayer; }
|
|
|
|
bool HasTitle() override { return false; }
|
|
|
|
const std::string& GetTitle() override { return windowConf.title; }
|
|
|
|
void SetTitle(const std::string& title) override {}
|
|
|
|
WindowMode GetWindowMode() override { return FULLSCREEN; }
|
|
|
|
void SetWindowMode(WindowMode) override {}
|
|
|
|
const WindowConfiguration& GetWindowConfiguration() override { return windowConf; }
|
|
|
|
void SetSize(uint32_t width, uint32_t height) override { windowConf.size = { width, height }; }
|
|
|
|
void SetSizeLimits(int minWidth, int minHeight, int maxWidth, int maxHeight) override {}
|
|
|
|
Math::Vector2i GetPosition() override { return { 0, 0 }; }
|
|
|
|
void SetPosition(int posX, int posY) override {}
|
|
|
|
void Show() override {}
|
|
|
|
void Hide() override {}
|
|
|
|
void Show(bool show) override {}
|
|
|
|
IWindowHandler* GetWindowHandler() override { return handler; }
|
|
|
|
void SetWindowHandler(IWindowHandler* handler) override { this->handler = handler; }
|
|
|
|
uint32_t GetWindowId() const override { return 0; }
|
|
|
|
IOpenGlWindow* GetOpenGlWindow() override { return nullptr; }
|
|
|
|
IVulkanWindow* GetVulkanWindow() override { return this; }
|
|
|
|
bool WindowHasBeenDestroyed() const override { return false; }
|
|
|
|
void SetWindowHasBeenDestroyed() override
|
|
{
|
|
//TODO
|
|
}
|
|
|
|
void* GetNativeWindowHandle() override { return caMetalLayer; }
|
|
|
|
vk::SurfaceKHR CreateSurface(const vk::Instance& instance, const vk::AllocationCallbacks* pAllocator = nullptr) override;
|
|
|
|
std::vector<std::string> GetRequiredInstanceExtensions() override;
|
|
|
|
Math::Vector2ui GetSize() override { return windowConf.size; }
|
|
|
|
void Close() override {}
|
|
|
|
void OnResize(uint32_t width, uint32_t height);
|
|
|
|
virtual float GetContentScale() const override { return contentScale; }
|
|
|
|
virtual float GetInterfaceOrientation() const override { return orientation; }
|
|
|
|
void SetContentScale(float scale) { contentScale = scale; }
|
|
|
|
void SetOrientation(float orientation) { this->orientation = orientation; }
|
|
|
|
void TickHandler();
|
|
};
|
|
}
|