当前位置: 首页>>代码示例>>C#>>正文


C# Runtime.GetSyscalls方法代码示例

本文整理汇总了C#中Runtime.GetSyscalls方法的典型用法代码示例。如果您正苦于以下问题:C# Runtime.GetSyscalls方法的具体用法?C# Runtime.GetSyscalls怎么用?C# Runtime.GetSyscalls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Runtime的用法示例。


在下文中一共展示了Runtime.GetSyscalls方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

 public void Init(Core core, Runtime runtime)
 {
     maSillyTest = delegate(int _str)
     {
         runtime.GetSyscalls().maSetColor(0x00ff00);
         runtime.GetSyscalls().maDrawText(5, 5, _str);
         runtime.GetSyscalls().maUpdateScreen();
         return 42;
     };
 }
开发者ID:jpsmaia,项目名称:MoSync,代码行数:10,代码来源:MoSyncExtension.cs

示例2: Init

        public void Init(Ioctls ioctls, Core core, Runtime runtime)
        {
            ioctls.maFrameBufferInit = delegate(int frameBufferPointer)
            {
                Syscalls syscalls = runtime.GetSyscalls();
                mOldUpdateScreenImplementation = syscalls.maUpdateScreen;

                syscalls.maUpdateScreen = delegate()
                {
                    int[] dst = mFrontBuffer.Pixels;
                    Memory mem = core.GetDataMemory();
                    for (int i = 0; i < dst.Length; i++)
                    {
                        dst[i] = (int)(0xff000000 | mem.ReadUInt32(frameBufferPointer + i * 4));
                    }

                    InvalidateWriteableBitmapOnMainThread(mFrontBuffer);
                };

                return 1;
            };

            ioctls.maFrameBufferClose = delegate()
            {
                Syscalls syscalls = runtime.GetSyscalls();
                syscalls.maUpdateScreen = mOldUpdateScreenImplementation;
                return 1;
            };

            ioctls.maFrameBufferGetInfo = delegate(int info)
            {
                const int MAFrameBufferInfo_sizeInBytes = 0;
                const int MAFrameBufferInfo_bytesPerPixel = 4;
                const int MAFrameBufferInfo_bitsPerPixel = 8;
                const int MAFrameBufferInfo_redMask = 12;
                const int MAFrameBufferInfo_redShift = 16;
                const int MAFrameBufferInfo_redBits = 20;
                const int MAFrameBufferInfo_greenMask = 24;
                const int MAFrameBufferInfo_greenShift = 28;
                const int MAFrameBufferInfo_greenBits = 32;
                const int MAFrameBufferInfo_blueMask = 36;
                const int MAFrameBufferInfo_blueShift = 40;
                const int MAFrameBufferInfo_blueBits = 44;
                const int MAFrameBufferInfo_width = 48;
                const int MAFrameBufferInfo_height = 52;
                const int MAFrameBufferInfo_pitch = 56;
                const int MAFrameBufferInfo_supportsGfxSyscalls = 60;

                Memory mem = core.GetDataMemory();
                mem.WriteInt32(info + MAFrameBufferInfo_sizeInBytes, mBackBuffer.PixelWidth * mBackBuffer.PixelHeight * 4);
                mem.WriteInt32(info + MAFrameBufferInfo_bytesPerPixel, 4);
                mem.WriteInt32(info + MAFrameBufferInfo_bitsPerPixel, 32);
                mem.WriteUInt32(info + MAFrameBufferInfo_redMask, 0x00ff0000);
                mem.WriteUInt32(info + MAFrameBufferInfo_redBits, 8);
                mem.WriteUInt32(info + MAFrameBufferInfo_redShift, 16);
                mem.WriteUInt32(info + MAFrameBufferInfo_greenMask, 0x0000ff00);
                mem.WriteUInt32(info + MAFrameBufferInfo_greenBits, 8);
                mem.WriteUInt32(info + MAFrameBufferInfo_greenShift, 8);
                mem.WriteUInt32(info + MAFrameBufferInfo_blueMask, 0x000000ff);
                mem.WriteUInt32(info + MAFrameBufferInfo_blueBits, 8);
                mem.WriteUInt32(info + MAFrameBufferInfo_blueShift, 0);
                mem.WriteInt32(info + MAFrameBufferInfo_width, mBackBuffer.PixelWidth);
                mem.WriteInt32(info + MAFrameBufferInfo_height, mBackBuffer.PixelHeight);
                mem.WriteInt32(info + MAFrameBufferInfo_pitch, mBackBuffer.PixelWidth * 4);
                mem.WriteUInt32(info + MAFrameBufferInfo_supportsGfxSyscalls, 0);
                return 1;
            };
        }
开发者ID:asamuelsson,项目名称:MoSync,代码行数:68,代码来源:MoSyncGraphicsModule.cs

示例3: Init

        public void Init(Ioctls ioctls, Core core, Runtime runtime)
        {
            ioctls.maFontSetCurrent = delegate(int _font)
            {
                FontModule.FontInfo finfo = runtime.GetModule<FontModule>().GetFont(_font);
                MoSync.Util.RunActionOnMainThreadSync(() =>
                    {
                        textBlock.FontFamily = finfo.family;
                        textBlock.FontStyle = finfo.style;
                        textBlock.FontWeight = finfo.weight;
                    });

                return 0;
            };

            ioctls.maFrameBufferInit = delegate(int frameBufferPointer)
            {
                Syscalls syscalls = runtime.GetSyscalls();
                mOldUpdateScreenImplementation = syscalls.maUpdateScreen;

                syscalls.maUpdateScreen = delegate()
                {
                    Memory mem = core.GetDataMemory();
                    int[] dst = mFrontBuffer.Pixels;

                    //mFrontBuffer.FromByteArray(mem.GetData(), frameBufferPointer, dst.Length * 4);
                    System.Buffer.BlockCopy(mem.GetData(), frameBufferPointer, dst, 0, dst.Length * 4);
                    const int opaque = (int)(0xff<<24);
                    for (int i = 0; i < dst.Length; i++)
                    {
                        dst[i] |= opaque;
                    }

                    InvalidateWriteableBitmapBackBufferOnMainThread(mFrontBuffer);
                    WriteableBitmap temp = mFrontBuffer;
                    mFrontBuffer = mBackBuffer;
                    mBackBuffer = temp;
                };

                return 1;
            };

            ioctls.maFrameBufferClose = delegate()
            {
                Syscalls syscalls = runtime.GetSyscalls();
                syscalls.maUpdateScreen = mOldUpdateScreenImplementation;
                return 1;
            };

            ioctls.maFrameBufferGetInfo = delegate(int info)
            {
                Memory mem = core.GetDataMemory();
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.sizeInBytes, mBackBuffer.PixelWidth * mBackBuffer.PixelHeight * 4);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.bytesPerPixel, 4);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.bitsPerPixel, 32);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.redMask, 0x00ff0000);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.redBits, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.redShift, 16);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.greenMask, 0x0000ff00);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.greenBits, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.greenShift, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.blueMask, 0x000000ff);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.blueBits, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.blueShift, 0);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.width, mBackBuffer.PixelWidth);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.height, mBackBuffer.PixelHeight);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.pitch, mBackBuffer.PixelWidth * 4);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.supportsGfxSyscalls, 0);
                return 1;
            };
        }
开发者ID:patrickbroman,项目名称:MoSync,代码行数:71,代码来源:MoSyncGraphicsModule.cs

示例4: Init

        public void Init(Ioctls ioctls, Core core, Runtime runtime)
        {
            mRuntime = runtime;

            ioctls.maOpenGLInitFullscreen = delegate(int _glApi)
            {
                if (_glApi != MoSync.Constants.MA_GL_API_GL1)
                    return MoSync.Constants.MA_GL_INIT_RES_ERROR;

                Syscalls syscalls = runtime.GetSyscalls();
                mOldUpdateScreenImplementation = syscalls.maUpdateScreen;

                syscalls.maUpdateScreen = delegate()
                {
                    if (maUpdateScreenAction != null)
                        maUpdateScreenAction();
                };

                MoSync.Util.RunActionOnMainThreadSync(() =>
                {
                    // GamePage must always exist for fullscreen apps to work.
                    if (((PhoneApplicationFrame)Application.Current.RootVisual).Navigate(new Uri("/GamePage.xaml", UriKind.Relative)))
                    {
                    }
                });

                return MoSync.Constants.MA_GL_INIT_RES_OK;
            };

            ioctls.maOpenGLCloseFullscreen = delegate()
            {

                return MoSync.Constants.MA_GL_INIT_RES_OK;
            };

            ioctls.maOpenGLTexImage2D = delegate(int _res)
            {
                Resource res = runtime.GetResource(MoSync.Constants.RT_IMAGE, _res);
                WriteableBitmap src = (WriteableBitmap)res.GetInternalObject();
                byte[] pixels = src.ToByteArray();
                mGL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, src.PixelWidth, src.PixelHeight, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, pixels, 0);
                return MoSync.Constants.MA_GL_TEX_IMAGE_2D_OK;
            };

            ioctls.maOpenGLTexSubImage2D = delegate(int _res)
            {
                Resource res = runtime.GetResource(MoSync.Constants.RT_IMAGE, _res);
                WriteableBitmap src = (WriteableBitmap)res.GetInternalObject();
                byte[] pixels = src.ToByteArray();
                mGL.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, src.PixelWidth, src.PixelHeight, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, pixels, 0);
                return MoSync.Constants.MA_GL_TEX_IMAGE_2D_OK;
            };

            ioctls.glViewport = delegate(int _x, int _y, int _w, int _h)
            {
                mGL.glViewport(_x, _y, _w, _h);
                return 0;
            };

            ioctls.glGetError = delegate()
            {
                int err = mGL.glGetError();
                if (err != GL.GL_NO_ERROR)
                {
                    int a = 2;
                    //err = GL.GL_NO_ERROR;
                }
                return err;
            };

            ioctls.glGetStringHandle = delegate(int _name)
            {

                String str = mGL.glGetString(_name);
                char[] data = str.ToCharArray();
                byte[] bytes = new byte[data.Length + 1];
                bytes[data.Length] = 0;
                for (int i = 0; i < data.Length; i++)
                {
                    bytes[i] = (byte)data[i];
                }

                return runtime.AddResource(new Resource(new System.IO.MemoryStream(bytes), MoSync.Constants.RT_BINARY, true));
            };

            ioctls.glMatrixMode = delegate(int mode)
            {
                mGL.glMatrixMode(mode);  return 0;
            };

            ioctls.glPushMatrix = delegate()
            {
                mGL.glPushMatrix(); return 0;
            };

            ioctls.glPopMatrix = delegate()
            {
                mGL.glPopMatrix(); return 0;
            };

//.........这里部分代码省略.........
开发者ID:ronald132,项目名称:MoSync,代码行数:101,代码来源:MoSyncOpenGLESModule.cs

示例5: Init

        public void Init(Ioctls ioctls, Core core, Runtime runtime)
        {
            ioctls.maFrameBufferInit = delegate(int frameBufferPointer)
            {
                Syscalls syscalls = runtime.GetSyscalls();
                mOldUpdateScreenImplementation = syscalls.maUpdateScreen;

                syscalls.maUpdateScreen = delegate()
                {
                    int[] dst = mFrontBuffer.Pixels;
                    Memory mem = core.GetDataMemory();
                    for (int i = 0; i < dst.Length; i++)
                    {
                        dst[i] = (int)(0xff000000 | mem.ReadUInt32(frameBufferPointer + i * 4));
                    }

                    InvalidateWriteableBitmapOnMainThread(mFrontBuffer);
                };

                return 1;
            };

            ioctls.maFrameBufferClose = delegate()
            {
                Syscalls syscalls = runtime.GetSyscalls();
                syscalls.maUpdateScreen = mOldUpdateScreenImplementation;
                return 1;
            };

            ioctls.maFrameBufferGetInfo = delegate(int info)
            {
                Memory mem = core.GetDataMemory();
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.sizeInBytes, mBackBuffer.PixelWidth * mBackBuffer.PixelHeight * 4);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.bytesPerPixel, 4);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.bitsPerPixel, 32);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.redMask, 0x00ff0000);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.redBits, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.redShift, 16);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.greenMask, 0x0000ff00);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.greenBits, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.greenShift, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.blueMask, 0x000000ff);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.blueBits, 8);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.blueShift, 0);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.width, mBackBuffer.PixelWidth);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.height, mBackBuffer.PixelHeight);
                mem.WriteInt32(info + MoSync.Struct.MAFrameBufferInfo.pitch, mBackBuffer.PixelWidth * 4);
                mem.WriteUInt32(info + MoSync.Struct.MAFrameBufferInfo.supportsGfxSyscalls, 0);
                return 1;
            };
        }
开发者ID:N00bKefka,项目名称:MoSync,代码行数:51,代码来源:MoSyncGraphicsModule.cs

示例6: Init

        public void Init(Core core, Runtime runtime)
        {
            Syscalls syscalls = runtime.GetSyscalls();

            mFunctions.maPlot = delegate(int _x, int _y)
            {
                syscalls.maPlot(_x, _y);
                return 0;
            };
        }
开发者ID:N00bKefka,项目名称:MoSync,代码行数:10,代码来源:MoSyncExtensionModule.cs


注:本文中的Runtime.GetSyscalls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。