Add **Web platform with Emscripten**

This commit is contained in:
Wojtek Figat
2026-02-14 00:07:21 +01:00
parent fd0584b406
commit f12ad5c874
80 changed files with 1529 additions and 61 deletions

View File

@@ -44,7 +44,7 @@ static_assert(sizeof(double) == 8, "Invalid double type size.");
// Check configuration
static_assert((PLATFORM_THREADS_LIMIT & (PLATFORM_THREADS_LIMIT - 1)) == 0, "Threads limit must be power of two.");
static_assert(PLATFORM_THREADS_LIMIT % 4 == 0, "Threads limit must be multiple of 4.");
static_assert(PLATFORM_THREADS_LIMIT % 4 == 0 || PLATFORM_THREADS_LIMIT == 1, "Threads limit must be multiple of 4.");
const Char* PlatformBase::ApplicationClassName = TEXT("FlaxWindow");
float PlatformBase::CustomDpiScale = 1.0f;
@@ -301,6 +301,15 @@ bool PlatformBase::Is64BitApp()
#endif
}
bool PlatformBase::Is64BitPlatform()
{
#if PLATFORM_64BITS
return true;
#else
return false;
#endif
}
int32 PlatformBase::GetCacheLineSize()
{
return (int32)Platform::GetCPUInfo().CacheLineSize;
@@ -820,6 +829,8 @@ const Char* ToString(PlatformType type)
return TEXT("Mac");
case PlatformType::iOS:
return TEXT("iOS");
case PlatformType::Web:
return TEXT("Web");
default:
return TEXT("");
}

View File

@@ -378,7 +378,7 @@ public:
/// Returns true if running on 64-bit computer
/// </summary>
/// <returns>True if running on 64-bit computer, otherwise false.</returns>
API_PROPERTY() static bool Is64BitPlatform() = delete;
API_PROPERTY() static bool Is64BitPlatform();
/// <summary>
/// Gets the name of the operating system.
@@ -470,7 +470,11 @@ public:
/// Gets the system clock frequency.
/// </summary>
/// <returns>The clock frequency.</returns>
API_PROPERTY() static uint64 GetClockFrequency() = delete;
API_PROPERTY() static uint64 GetClockFrequency()
{
// Dummy value
return 1000000;
}
/// <summary>
/// Gets current system time based on current computer settings.

View File

@@ -48,7 +48,7 @@ void ThreadBase::Kill(bool waitForJoin)
return;
}
ASSERT(GetID());
const auto thread = static_cast<Thread*>(this);
Thread* thread = (Thread*)this;
// Stop runnable object
if (_callAfterWork && _runnable)