简体   繁体   中英

Script# Wrap WebGL?

How would one go about wrapping WebGL in Script#.

I tried to add stuff to the source code but get compile errors I don't understand.

[ScriptIgnoreNamespace]
    [ScriptImport]
    [ScriptName("webGL")]
    public sealed class WebGL
    {
        [ScriptName("fooGL")]
        public void Foo(string test)
        {

        }
    }

Error 1 The base class or interface 'System.FormatException' in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.UriFormatException' could not be resolved c:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\System.dll Web

Or is there a way better way to add WebGL support as a lib rather then adding it directly to the main source?

EDIT: Looks like that compiler error was coming from VS from auto adding System.dll to the project and it shouldn't be. After removing it now compiles. So now the question is what is the best way to wrap a javaScript API in Script# ??

You should look at the S# source on github for how wrappers are written. They're simply classes tagged with ScriptImport attribute and the internal methods/properties have empty values/bodies.

Look at the source here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM