mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Add width and height to gpu.newBuffer
This commit is contained in:
parent
2a84bf8fec
commit
4385a9e2fc
1 changed files with 25 additions and 1 deletions
|
@ -409,10 +409,34 @@ public class GPU : IPlugin
|
||||||
{
|
{
|
||||||
var L = Lua.FromIntPtr(state);
|
var L = Lua.FromIntPtr(state);
|
||||||
|
|
||||||
var buffer = new uint[_game.Width * _game.Height];
|
var width = L.OptInteger(1, _game.Width);
|
||||||
|
var height = L.OptInteger(2, _game.Height);
|
||||||
|
|
||||||
|
var buffer = new uint[width * height];
|
||||||
|
|
||||||
GPUBuffer.Push(L, buffer);
|
GPUBuffer.Push(L, buffer);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WIP
|
||||||
|
private static int L_CopyBuffer(IntPtr state)
|
||||||
|
{
|
||||||
|
var L = Lua.FromIntPtr(state);
|
||||||
|
|
||||||
|
var x = L.CheckInteger(1);
|
||||||
|
var y = L.CheckInteger(2);
|
||||||
|
|
||||||
|
var from = L.CheckObject<uint[]>(3, GPUBuffer.ObjectType, false);
|
||||||
|
if (from is null)
|
||||||
|
{
|
||||||
|
L.ArgumentError(3, GPUBuffer.ObjectType + " expected, got " + L.TypeName(L.Type(3)));
|
||||||
|
}
|
||||||
|
|
||||||
|
var origin = new uint[_game.Width * _game.Height];
|
||||||
|
_game.Drawing.Canvas.GetData(origin);
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue