Convert color in GPUBuffer

This commit is contained in:
Alessandro Proto 2023-03-06 14:23:01 +01:00
parent e941a481ea
commit 2f604f3b42

View file

@ -14,6 +14,7 @@
// limitations under the License. // limitations under the License.
using Capy64.API; using Capy64.API;
using Capy64.Core;
using KeraLua; using KeraLua;
using System; using System;
@ -59,11 +60,24 @@ public class GPUBuffer : IComponent
new(), new(),
}; };
private static IGame _game;
public GPUBuffer(IGame game) {
_game = game;
}
public void LuaInit(Lua L) public void LuaInit(Lua L)
{ {
CreateMeta(L); CreateMeta(L);
} }
public static uint GetColor(uint color)
{
if(_game.EngineMode == EngineMode.Classic)
return ColorPalette.GetColor(color);
return color;
}
public static void CreateMeta(Lua L) public static void CreateMeta(Lua L)
{ {
L.NewMetaTable(ObjectType); L.NewMetaTable(ObjectType);
@ -142,6 +156,7 @@ public class GPUBuffer : IComponent
} }
var value = (uint)L.ToInteger(3); var value = (uint)L.ToInteger(3);
value = GetColor(value);
// RGB to ABGR // RGB to ABGR
value = value =