mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Merge branch 'main' into SDL3
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+18
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -20,10 +20,27 @@
|
||||
|
||||
// LOVE
|
||||
#include "Data.h"
|
||||
#include "thread/threads.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
love::Type Data::type("Data", &Object::type);
|
||||
|
||||
Data::~Data()
|
||||
{
|
||||
delete mutex;
|
||||
}
|
||||
|
||||
static void createMutex(love::thread::Mutex **mutexAddress)
|
||||
{
|
||||
*mutexAddress = love::thread::newMutex();
|
||||
}
|
||||
|
||||
love::thread::Mutex *Data::getMutex()
|
||||
{
|
||||
std::call_once(mutexCreated, createMutex, &mutex);
|
||||
return mutex;
|
||||
}
|
||||
|
||||
} // love
|
||||
|
||||
+20
-6
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -22,15 +22,20 @@
|
||||
#define LOVE_DATA_H
|
||||
|
||||
// LOVE
|
||||
#include "config.h"
|
||||
#include "Object.h"
|
||||
|
||||
// C
|
||||
#include <stddef.h>
|
||||
#include <mutex>
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
namespace thread
|
||||
{
|
||||
class Mutex;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is a simple abstraction over all objects which contain data.
|
||||
**/
|
||||
@@ -40,10 +45,8 @@ public:
|
||||
|
||||
static love::Type type;
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
virtual ~Data() {}
|
||||
Data() {};
|
||||
virtual ~Data();
|
||||
|
||||
/**
|
||||
* Creates a duplicate of Data derived class instance.
|
||||
@@ -60,6 +63,17 @@ public:
|
||||
**/
|
||||
virtual size_t getSize() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the Mutex associated with this Data object. Creates it in a thread-
|
||||
* safe manner if necessary.
|
||||
**/
|
||||
love::thread::Mutex *getMutex();
|
||||
|
||||
private:
|
||||
|
||||
love::thread::Mutex *mutex = nullptr;
|
||||
std::once_flag mutexCreated;
|
||||
|
||||
}; // Data
|
||||
|
||||
} // love
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -62,9 +62,12 @@ namespace love
|
||||
love::Type Module::type("Module", &Object::type);
|
||||
Module *Module::instances[] = {};
|
||||
|
||||
Module::Module()
|
||||
Module::Module(Module::ModuleType moduleType, const char *name)
|
||||
: moduleType(moduleType)
|
||||
, name(name)
|
||||
{
|
||||
initDeprecation();
|
||||
registerInstance(this);
|
||||
}
|
||||
|
||||
Module::~Module()
|
||||
|
||||
+9
-11
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -62,13 +62,13 @@ public:
|
||||
M_MAX_ENUM
|
||||
};
|
||||
|
||||
Module();
|
||||
Module(ModuleType moduleType, const char *name);
|
||||
virtual ~Module();
|
||||
|
||||
/**
|
||||
* Gets the base type of the module.
|
||||
**/
|
||||
virtual ModuleType getModuleType() const = 0;
|
||||
ModuleType getModuleType() const { return moduleType; }
|
||||
|
||||
/**
|
||||
* Gets the name of the module. This is used in case of errors
|
||||
@@ -76,14 +76,7 @@ public:
|
||||
*
|
||||
* @return The full name of the module, eg. love.graphics.opengl.
|
||||
**/
|
||||
virtual const char *getName() const = 0;
|
||||
|
||||
/**
|
||||
* Add module to internal registry. To be used /only/ in
|
||||
* runtime.cpp:luax_register_module()
|
||||
* @param instance The module instance.
|
||||
*/
|
||||
static void registerInstance(Module *instance);
|
||||
const char *getName() const { return name.c_str(); }
|
||||
|
||||
/**
|
||||
* Retrieve module instance from internal registry. May return NULL
|
||||
@@ -106,6 +99,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
static void registerInstance(Module *instance);
|
||||
|
||||
ModuleType moduleType;
|
||||
std::string name;
|
||||
|
||||
static Module *instances[M_MAX_ENUM];
|
||||
|
||||
}; // Module
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -61,7 +61,7 @@ struct Range
|
||||
return first <= other.first && last >= other.last;
|
||||
}
|
||||
|
||||
bool intersects(const Range &other)
|
||||
bool intersects(const Range &other) const
|
||||
{
|
||||
return !(first > other.last || last < other.first);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -385,18 +385,20 @@ struct AssetInfo: public love::filesystem::physfs::PhysfsIo<AssetInfo>
|
||||
return 1;
|
||||
}
|
||||
|
||||
AssetInfo *duplicate() const
|
||||
AssetInfo(const AssetInfo &other)
|
||||
: assetManager(other.assetManager)
|
||||
, size(strlen(other.filename) + 1)
|
||||
{
|
||||
AAsset *newAsset = AAssetManager_open(assetManager, filename, AASSET_MODE_RANDOM);
|
||||
asset = AAssetManager_open(assetManager, other.filename, AASSET_MODE_RANDOM);
|
||||
|
||||
if (newAsset == nullptr)
|
||||
if (asset == nullptr)
|
||||
{
|
||||
PHYSFS_setErrorCode(PHYSFS_ERR_OS_ERROR);
|
||||
return nullptr;
|
||||
throw new love::Exception("Unable to duplicate AssetInfo");
|
||||
}
|
||||
|
||||
AAsset_seek64(asset, tell(), SEEK_SET);
|
||||
return fromAAsset(assetManager, filename, asset);
|
||||
filename = new (std::nothrow) char[size];
|
||||
memcpy(filename, other.filename, size);
|
||||
}
|
||||
|
||||
~AssetInfo() override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -342,6 +342,10 @@ PixelFormat getSRGBPixelFormat(PixelFormat format)
|
||||
{
|
||||
case PIXELFORMAT_RGBA8_UNORM: return PIXELFORMAT_RGBA8_sRGB;
|
||||
case PIXELFORMAT_BGRA8_UNORM: return PIXELFORMAT_BGRA8_sRGB;
|
||||
case PIXELFORMAT_DXT1_UNORM: return PIXELFORMAT_DXT1_sRGB;
|
||||
case PIXELFORMAT_DXT3_UNORM: return PIXELFORMAT_DXT3_sRGB;
|
||||
case PIXELFORMAT_DXT5_UNORM: return PIXELFORMAT_DXT5_sRGB;
|
||||
case PIXELFORMAT_BC7_UNORM: return PIXELFORMAT_BC7_sRGB;
|
||||
case PIXELFORMAT_PVR1_RGB2_UNORM: return PIXELFORMAT_PVR1_RGB2_sRGB;
|
||||
case PIXELFORMAT_PVR1_RGB4_UNORM: return PIXELFORMAT_PVR1_RGB4_sRGB;
|
||||
case PIXELFORMAT_PVR1_RGBA2_UNORM: return PIXELFORMAT_PVR1_RGBA2_sRGB;
|
||||
@@ -374,6 +378,10 @@ PixelFormat getLinearPixelFormat(PixelFormat format)
|
||||
{
|
||||
case PIXELFORMAT_RGBA8_sRGB: return PIXELFORMAT_RGBA8_UNORM;
|
||||
case PIXELFORMAT_BGRA8_sRGB: return PIXELFORMAT_BGRA8_UNORM;
|
||||
case PIXELFORMAT_DXT1_sRGB: return PIXELFORMAT_DXT1_UNORM;
|
||||
case PIXELFORMAT_DXT3_sRGB: return PIXELFORMAT_DXT3_UNORM;
|
||||
case PIXELFORMAT_DXT5_sRGB: return PIXELFORMAT_DXT5_UNORM;
|
||||
case PIXELFORMAT_BC7_sRGB: return PIXELFORMAT_BC7_UNORM;
|
||||
case PIXELFORMAT_PVR1_RGB2_sRGB: return PIXELFORMAT_PVR1_RGB2_UNORM;
|
||||
case PIXELFORMAT_PVR1_RGB4_sRGB: return PIXELFORMAT_PVR1_RGB4_UNORM;
|
||||
case PIXELFORMAT_PVR1_RGBA2_sRGB: return PIXELFORMAT_PVR1_RGBA2_UNORM;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -473,9 +473,6 @@ int luax_register_module(lua_State *L, const WrappedModule &m)
|
||||
lua_setfield(L, -3, m.name); // love.graphics = table
|
||||
lua_remove(L, -2); // love
|
||||
|
||||
// Register module instance
|
||||
Module::registerInstance(m.module);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+16
-9
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -629,22 +629,29 @@ T *luax_optmodule(lua_State *L)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the value at idx to the specified type without checking that
|
||||
* this conversion is valid. If the type has been previously verified with
|
||||
* luax_istype, then this can be safely used. Otherwise, use luax_checktype.
|
||||
* Converts the value at idx to the specified type. Returns null if the type
|
||||
* doesn't match.
|
||||
* @param L The Lua state.
|
||||
* @param idx The index on the stack.
|
||||
* @param type The type of the object.
|
||||
**/
|
||||
template <typename T>
|
||||
T *luax_totype(lua_State *L, int idx, const love::Type& /*type*/)
|
||||
T *luax_totype(lua_State *L, int idx, const love::Type &type)
|
||||
{
|
||||
T *o = (T *)(((Proxy *)lua_touserdata(L, idx))->object);
|
||||
if (lua_type(L, idx) != LUA_TUSERDATA)
|
||||
return nullptr;
|
||||
|
||||
if (o == nullptr)
|
||||
luaL_error(L, "Cannot use object after it has been released.");
|
||||
Proxy *p = (Proxy *) lua_touserdata(L, idx);
|
||||
|
||||
return o;
|
||||
if (p->type != nullptr && p->type->isa(type))
|
||||
{
|
||||
if (p->object == nullptr)
|
||||
luaL_error(L, "Cannot use object after it has been released.");
|
||||
|
||||
return (T *) p->object;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2023 LOVE Development Team
|
||||
* Copyright (c) 2006-2024 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
Reference in New Issue
Block a user