mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
c# bindings: bring back bool as params, only replace by byte in structs. (#1813)
* fix some c# bindings gen: support arrays, move chars to bytes, marshal char* return correctly * bring back bool as parameters only
This commit is contained in:
committed by
Бранимир Караџић
parent
a6fc055d03
commit
e938ddf88c
@@ -15,7 +15,6 @@ local csharp_template = [[
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace Bgfx
|
||||
{
|
||||
@@ -60,8 +59,6 @@ local function convert_type_0(arg)
|
||||
return arg.ctype:gsub("bgfx_view_id_t", "ushort")
|
||||
elseif hasPrefix(arg.ctype, "uint8_t") then
|
||||
return arg.ctype:gsub("uint8_t", "byte")
|
||||
elseif hasPrefix(arg.ctype, "bool") then
|
||||
return arg.ctype:gsub("bool", "byte")
|
||||
elseif hasPrefix(arg.ctype, "uintptr_t") then
|
||||
return arg.ctype:gsub("uintptr_t", "UIntPtr")
|
||||
elseif arg.ctype == "bgfx_caps_gpu_t" then
|
||||
@@ -87,8 +84,7 @@ local function convert_type_0(arg)
|
||||
end
|
||||
|
||||
local function convert_type(arg)
|
||||
local ctype;
|
||||
ctype = convert_type_0(arg)
|
||||
local ctype = convert_type_0(arg)
|
||||
ctype = ctype:gsub("::Enum", "")
|
||||
ctype = ctype:gsub("const ", "")
|
||||
ctype = ctype:gsub(" &", "*")
|
||||
@@ -96,12 +92,19 @@ local function convert_type(arg)
|
||||
return ctype
|
||||
end
|
||||
|
||||
local function convert_struct_type(arg)
|
||||
local ctype = convert_type(arg)
|
||||
if hasPrefix(arg.ctype, "bool") then
|
||||
ctype = ctype:gsub("bool", "byte")
|
||||
end
|
||||
return ctype
|
||||
end
|
||||
|
||||
local function convert_ret_type(arg)
|
||||
local ctype = convert_type(arg)
|
||||
if hasPrefix(ctype, "[MarshalAs(UnmanagedType.LPStr)]") then
|
||||
return "IntPtr"
|
||||
end
|
||||
|
||||
return ctype
|
||||
end
|
||||
|
||||
@@ -214,9 +217,9 @@ end
|
||||
|
||||
local function convert_struct_member(member)
|
||||
if member.array then
|
||||
return "fixed " .. convert_type(member) .. " " .. member.name .. convert_array(member)
|
||||
return "fixed " .. convert_struct_type(member) .. " " .. member.name .. convert_array(member)
|
||||
else
|
||||
return convert_type(member) .. " " .. member.name
|
||||
return convert_struct_type(member) .. " " .. member.name
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user