Merge branch 'master' into project_setup_refactor
# Conflicts: # 3rdParty/CMakeLists.txt # 3rdParty/libarchive/CMakeLists.txt # CMakeLists.txt
This commit is contained in:
@@ -227,12 +227,30 @@ namespace OpenVulkano
|
||||
{}
|
||||
|
||||
void Notify(Arguments... args) const override
|
||||
{
|
||||
NotifyImpl(std::forward<Arguments>(args)...);
|
||||
}
|
||||
|
||||
void NotifyImpl(Arguments... args) const
|
||||
{
|
||||
if (INamedEventProcessor::HasProcessor())
|
||||
{
|
||||
std::vector<INamedEventProcessor::Parameters> attributes;
|
||||
attributes.reserve(sizeof...(Arguments));
|
||||
(attributes.emplace_back(args), ...);
|
||||
if constexpr (!std::conjunction_v<std::is_enum<std::remove_reference_t<Arguments>>...>)
|
||||
{
|
||||
(attributes.emplace_back(args), ...);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto fill = [&](auto&& arg) {
|
||||
if constexpr (std::is_enum_v<std::remove_reference_t<decltype(arg)>>)
|
||||
attributes.emplace_back(static_cast<int>(arg));
|
||||
else
|
||||
attributes.emplace_back(std::forward<decltype(arg)>(arg));
|
||||
};
|
||||
(fill(std::forward<Arguments>(args)), ...);
|
||||
}
|
||||
INamedEventProcessor::NotifyAll(m_name, attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace OpenVulkano
|
||||
{}
|
||||
|
||||
Observable(T&& initValue, const std::string& observableName)
|
||||
: object(std::forward(initValue)), OnChange(observableName)
|
||||
: object(initValue), OnChange(observableName)
|
||||
{}
|
||||
|
||||
template<typename = std::enable_if_t<std::is_copy_assignable_v<T>>>
|
||||
auto& operator = (const T& val) { object = val; Notify(); return *this; }
|
||||
|
||||
template<typename = std::enable_if_t<std::is_move_assignable_v<T>>>
|
||||
auto& operator = (T&& val) { object = std::forward(val); Notify(); return *this; }
|
||||
auto& operator = (T&& val) { object = val; Notify(); return *this; }
|
||||
|
||||
template<typename = std::enable_if_t<std::is_copy_assignable_v<T>>>
|
||||
operator T() const { return object; }
|
||||
@@ -54,7 +54,9 @@ namespace OpenVulkano
|
||||
bool operator >=(const T& other) const { return object >= other; }
|
||||
bool operator !() const { return !object; }
|
||||
|
||||
operator bool() const { return object.operator bool(); }
|
||||
template<std::enable_if<std::is_convertible_v<T, bool>>>
|
||||
operator bool() const { return static_cast<bool>(object); }
|
||||
|
||||
auto& operator ++() { ++object; Notify(); return *this; }
|
||||
auto& operator --() { --object; Notify(); return *this; }
|
||||
auto& operator ++(int) { object++; Notify(); return *this; }
|
||||
|
||||
@@ -35,5 +35,8 @@ namespace OpenVulkano
|
||||
virtual Scene::UI::Ui* GetActiveUi() = 0;
|
||||
|
||||
virtual IResourceManager* GetIResourceManager() = 0;
|
||||
|
||||
virtual float GetLastQueriedDepthValue() = 0;
|
||||
virtual void SetQueryDepthValue(const Math::Vector2f& depthCoordinates) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +84,9 @@ namespace OpenVulkano
|
||||
[[nodiscard]] virtual uint32_t GetWindowId() const = 0;
|
||||
|
||||
virtual void* GetNativeWindowHandle() = 0;
|
||||
|
||||
virtual float GetContentScale() const { return 1; }
|
||||
virtual float GetInterfaceOrientation() const { return 0; }
|
||||
protected:
|
||||
static uint32_t CreateWindowId()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,12 @@ namespace OpenVulkano
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T, typename... N>
|
||||
static auto MakeStdArray(N&&... args) -> std::array<T, sizeof...(args)>
|
||||
{
|
||||
return { std::forward<N>(args)... };
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
static bool GetFlag(T var, U flag)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user