mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Merge branch 'master' into mac
# Conflicts: # GpApp/Main.cpp
This commit is contained in:
@@ -4,6 +4,6 @@
|
||||
#define GP_BUILD_VERSION_MINOR 1
|
||||
#define GP_BUILD_VERSION_UPDATE 0
|
||||
|
||||
#define GP_APPLICATION_VERSION_STRING "1.1.0"
|
||||
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2021 Eric Lasota"
|
||||
#define GP_APPLICATION_VERSION_STRING "1.1.0 rc1"
|
||||
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2021 Gale Force Games LLC"
|
||||
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"
|
||||
|
@@ -37,8 +37,12 @@ public:
|
||||
const T &operator[](size_t index) const;
|
||||
|
||||
bool Resize(size_t newSize);
|
||||
bool Reserve(size_t newSize);
|
||||
bool ResizeNoConstruct(size_t newSize);
|
||||
|
||||
bool Append(const T &item);
|
||||
bool Append(T &&item);
|
||||
|
||||
T *Buffer();
|
||||
const T *Buffer() const;
|
||||
|
||||
@@ -148,7 +152,6 @@ const T &GpVector<T, TStaticSize>::operator[](size_t index) const
|
||||
return m_elements[index];
|
||||
}
|
||||
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Resize(size_t newSize)
|
||||
{
|
||||
@@ -163,6 +166,21 @@ bool GpVector<T, TStaticSize>::Resize(size_t newSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Reserve(size_t newSize)
|
||||
{
|
||||
const size_t oldCount = m_count;
|
||||
|
||||
if (!ResizeNoConstruct(newSize))
|
||||
return false;
|
||||
|
||||
m_count = oldCount;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::ResizeNoConstruct(size_t newSize)
|
||||
{
|
||||
@@ -211,6 +229,53 @@ bool GpVector<T, TStaticSize>::ResizeNoConstruct(size_t newSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Append(const T &item)
|
||||
{
|
||||
const size_t oldCount = m_count;
|
||||
|
||||
if (m_count == m_capacity)
|
||||
{
|
||||
size_t newCapacity = m_capacity * 2;
|
||||
if (newCapacity < 8)
|
||||
newCapacity = 8;
|
||||
|
||||
if (!Reserve(newCapacity))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ResizeNoConstruct(oldCount + 1))
|
||||
return false;
|
||||
|
||||
new (m_elements + oldCount) T(item);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Append(T &&item)
|
||||
{
|
||||
const size_t oldCount = m_count;
|
||||
|
||||
if (m_count == m_capacity)
|
||||
{
|
||||
size_t newCapacity = m_capacity * 2;
|
||||
if (newCapacity < 8)
|
||||
newCapacity = 8;
|
||||
|
||||
if (!Reserve(newCapacity))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ResizeNoConstruct(oldCount + 1))
|
||||
return false;
|
||||
|
||||
new (m_elements + oldCount) T(static_cast<T&&>(item));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
const size_t GpVector<T, TStaticSize>::Count() const
|
||||
{
|
||||
|
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct IGpAllocator
|
||||
{
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct IGpAllocator
|
||||
{
|
||||
virtual void *Realloc(void *buf, size_t newSize) = 0;
|
||||
|
||||
inline void *Alloc(size_t size) { return this->Realloc(nullptr, size); }
|
||||
inline void Release(void *ptr) { this->Realloc(ptr, 0); }
|
||||
};
|
||||
inline void *Alloc(size_t size) { return this->Realloc(nullptr, size); }
|
||||
inline void Release(void *ptr) { this->Realloc(ptr, 0); }
|
||||
};
|
||||
|
@@ -14,6 +14,34 @@ struct IGpMutex;
|
||||
struct IGpThreadEvent;
|
||||
struct IGpClipboardContents;
|
||||
|
||||
namespace GpOperatingSystems
|
||||
{
|
||||
enum GpOperatingSystem
|
||||
{
|
||||
kUnknown,
|
||||
|
||||
kWindows,
|
||||
kAndroid,
|
||||
kWeb,
|
||||
kLinux,
|
||||
kMacOS,
|
||||
kIOS,
|
||||
};
|
||||
}
|
||||
|
||||
typedef GpOperatingSystems::GpOperatingSystem GpOperatingSystem_t;
|
||||
|
||||
namespace GpOperatingSystemFlavors
|
||||
{
|
||||
enum GpOperatingSystemFlavor
|
||||
{
|
||||
kGeneric,
|
||||
};
|
||||
}
|
||||
|
||||
typedef GpOperatingSystemFlavors::GpOperatingSystemFlavor GpOperatingSystemFlavor_t;
|
||||
|
||||
|
||||
struct IGpSystemServices
|
||||
{
|
||||
public:
|
||||
@@ -26,12 +54,15 @@ public:
|
||||
virtual void *CreateThread(ThreadFunc_t threadFunc, void *context) = 0;
|
||||
virtual IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) = 0;
|
||||
virtual uint64_t GetFreeMemoryCosmetic() const = 0; // Returns free memory in bytes, does not have to be accurate
|
||||
virtual void Beep() const = 0;
|
||||
virtual bool Beep() const = 0;
|
||||
virtual bool IsTouchscreen() const = 0;
|
||||
virtual bool IsUsingMouseAsTouch() const = 0;
|
||||
virtual bool IsFullscreenPreferred() const = 0;
|
||||
virtual bool IsFullscreenOnStartup() const = 0;
|
||||
virtual bool IsTextInputObstructive() const = 0;
|
||||
virtual bool HasNativeFileManager() const = 0;
|
||||
virtual GpOperatingSystem_t GetOperatingSystem() const = 0;
|
||||
virtual GpOperatingSystemFlavor_t GetOperatingSystemFlavor() const = 0;
|
||||
virtual unsigned int GetCPUCount() const = 0;
|
||||
virtual void SetTextInputEnabled(bool isEnabled) = 0;
|
||||
virtual bool IsTextInputEnabled() const = 0;
|
||||
|
Reference in New Issue
Block a user