Ejemplo n.º 1
0
    public void Play(clip clip)
    {
        switch (clip)
        {
        case clip.ButtonClick:
            source.PlayOneShot(buttonClick);
            break;

        case clip.PlayerHit:
            source.PlayOneShot(playerHit);
            break;

        case clip.enemyDeath:
            source.PlayOneShot(enemyDeath);
            break;

        case clip.bossHit:
            source.PlayOneShot(bossHit);
            break;

        case clip.pauseMenu:
            source.PlayOneShot(pauseMenu);
            break;

        case clip.upgrade:
            source.PlayOneShot(upgrade);
            break;
        }
    }
Ejemplo n.º 2
0
        public static void clip_set(clip c)
        {
            if (c == null)
            {
                return;
            }
            if (c.Count == 0)
            {
                return;
            }
            WinAPI.OpenClipboard(IntPtr.Zero);
            WinAPI.EmptyClipboard();
            for (int i = 0; i < c.Count; i++)
            {
                Logging.Log("[clip] Setting: " + c.f[i] + " format.");
//				IntPtr hglob = Marshal.AllocHGlobal(c.d[i].Length);
                IntPtr alloc = WinAPI.GlobalAlloc(WinAPI.GMEM_MOVEABLE | WinAPI.GMEM_DDESHARE, new UIntPtr(Convert.ToUInt32(c.d[i].GetLength(0))));
                IntPtr glock = WinAPI.GlobalLock(alloc);
                Marshal.Copy(c.d[i], 0, glock, c.d[i].Length);
                WinAPI.GlobalUnlock(glock);
                WinAPI.SetClipboardData(c.f[i], alloc);
                WinAPI.GlobalFree(alloc);
//				Marshal.FreeHGlobal(hglob);
            }
            WinAPI.CloseClipboard();
        }
Ejemplo n.º 3
0
        static int R_AliasClip(draw.finalvert_t[] @in, draw.finalvert_t[] @out, int flag, int count, clip delegate_clip)
        {
            int			i,j,k;
            int			flags, oldflags;

            j = count-1;
            k = 0;
            for (i=0 ; i<count ; j = i, i++)
            {
                oldflags = @in[j].flags & flag;
                flags = @in[i].flags & flag;

                if (flags != 0 && oldflags != 0)
                    continue;
                if ((oldflags ^ flags) != 0)
                {
                    av0 = j;
                    av1 = i;
                    delegate_clip (@in[j], @in[i], ref @out[k]);
                    @out[k].flags = 0;
                    if (@out[k].v[0] < r_refdef.aliasvrect.x)
                        @out[k].flags |= ALIAS_LEFT_CLIP;
                    if (@out[k].v[1] < r_refdef.aliasvrect.y)
                        @out[k].flags |= ALIAS_TOP_CLIP;
                    if (@out[k].v[0] > r_refdef.aliasvrectright)
                        @out[k].flags |= ALIAS_RIGHT_CLIP;
                    if (@out[k].v[1] > r_refdef.aliasvrectbottom)
                        @out[k].flags |= ALIAS_BOTTOM_CLIP;
                    k++;
                }
                if (flags == 0)
                {
                    draw.finalvert_t.Copy(@in[i], @out[k]);
            //                    @out[k] = @in[i];
                    k++;
                }
            }

            return k;
        }
Ejemplo n.º 4
0
        static int R_AliasClip(draw.finalvert_t[] @in, draw.finalvert_t[] @out, int flag, int count, clip delegate_clip)
        {
            int i, j, k;
            int flags, oldflags;

            j = count - 1;
            k = 0;
            for (i = 0; i < count; j = i, i++)
            {
                oldflags = @in[j].flags & flag;
                flags    = @in[i].flags & flag;

                if (flags != 0 && oldflags != 0)
                {
                    continue;
                }
                if ((oldflags ^ flags) != 0)
                {
                    av0 = j;
                    av1 = i;
                    delegate_clip(@in[j], @in[i], ref @out[k]);
                    @out[k].flags = 0;
                    if (@out[k].v[0] < r_refdef.aliasvrect.x)
                    {
                        @out[k].flags |= ALIAS_LEFT_CLIP;
                    }
                    if (@out[k].v[1] < r_refdef.aliasvrect.y)
                    {
                        @out[k].flags |= ALIAS_TOP_CLIP;
                    }
                    if (@out[k].v[0] > r_refdef.aliasvrectright)
                    {
                        @out[k].flags |= ALIAS_RIGHT_CLIP;
                    }
                    if (@out[k].v[1] > r_refdef.aliasvrectbottom)
                    {
                        @out[k].flags |= ALIAS_BOTTOM_CLIP;
                    }
                    k++;
                }
                if (flags == 0)
                {
                    draw.finalvert_t.Copy(@in[i], @out[k]);
//                    @out[k] = @in[i];
                    k++;
                }
            }

            return(k);
        }
Ejemplo n.º 5
0
 directory.OffsetCenterRatio = new ImmutablePoint(
     clip(directory.OffsetCenterRatio.X + shiftVector.X),
Ejemplo n.º 6
0
        public static clip clip_get()
        {
            clip c;
            var  open = WinAPI.OpenClipboard(IntPtr.Zero);

            if (!open)
            {
                WinAPI.CloseClipboard();
                Logging.Log("[clip] Error can't open clipboard.");
                return(null);
            }
            int size = 0, all_size = 0;

            c = new clip();
            IntPtr hglob = IntPtr.Zero;            //, all;
            IntPtr glock = IntPtr.Zero;
            uint   format, dib_skip = 0;

//			all = new IntPtr((uint)Marshal.SizeOf(typeof(uint)));
            for (format = 0; (format = WinAPI.EnumClipboardFormats(format)) != 0;)
            {
                switch (format)
                {
                case WinAPI.CF_BITMAP:
                case WinAPI.CF_ENHMETAFILE:
                case WinAPI.CF_DSPENHMETAFILE:
                    continue;                             // unsafe formats for GlobalSize
                }
                if (format == WinAPI.CF_TEXT || format == WinAPI.CF_OEMTEXT ||              // calculate only CF_UNICODETEXT instead
                    format == dib_skip)                        // also only one of dib/dibv5 formats should be calculated
                {
                    continue;
                }
                hglob = WinAPI.GetClipboardData(format);
                if (hglob == IntPtr.Zero)
                {
                    Logging.Log("[clip] hglob Fail: " + format); continue;
                }                                                                                                   // GetClipboardData() failed: skip this format.
//				if (format == WinAPI.CF_HDROP) {
//					System.Diagnostics.Debug.WriteLine("HGLOGADDR:" +hglob.ToInt32());
//					glock = WinAPI.GlobalLock(hglob);
//					if (glock != IntPtr.Zero) {
////						System.Diagnostics.Debug.WriteLine("HGLOGADDR:" +glock.ToInt32() + " " +Marshal.GetLastWin32Error());
////						int fc = WinAPI.DragQueryFile(glock, 0xFFFFFFFF, null, 0);
////						System.Diagnostics.Debug.WriteLine("[clip] FC:" + fc);
////						if (fc != 0) {
////							size = ((fc - 1) * 2);  // Init; -1 if don't want a newline after last file.
////							for (uint i = 0; i < fc; ++i) {
////								var tsize = WinAPI.DragQueryFile(glock, i, null, 0);
////								Logging.Log("[clip] File:" + i+ ", size:" +tsize);
////								size+=tsize;
////							}
////						}
////						else
////							size = 0;
//						size = WinAPI.GlobalSize(glock).ToInt32();
//						if (size != 0) {
//							byte[] bin = new byte[size];
//							System.Diagnostics.Debug.WriteLine("[clip] CF_HDROP Marshal copy: size:" + size +", bin-len: " + bin.Length + " glock:" + glock);
//							Marshal.Copy(glock, bin, 0, Convert.ToInt32(size));
//							c[format] = bin;
//						}
////						fc = WinAPI.DragQueryFile(glock, 0xFFFFFFFF, new System.Text.StringBuilder(""), 0);
////						System.Diagnostics.Debug.WriteLine("[clip] FC:" + fc);
////						if (fc != 0) {
////							size = ((fc - 1) * 2);  // Init; -1 if don't want a newline after last file.
////							var fnb = new System.Text.StringBuilder(999);
////							for (uint i = 0; i < fc; ++i) {
////								var tsize = WinAPI.DragQueryFile(glock, i, fnb, 999);
////							System.Diagnostics.Debug.WriteLine("[clip] File:" + i+ ", size:" +tsize);
////								size+=tsize;
////							}
////							System.Diagnostics.Debug.WriteLine("[clip] Fnb:" +fnb);
////						}
////					}
//					WinAPI.GlobalUnlock(glock);
//					continue;
//				}
                glock = WinAPI.GlobalLock(hglob);
                if (glock != IntPtr.Zero)
                {
                    size      = WinAPI.GlobalSize(glock).ToInt32();
                    all_size += size;
                    byte[] bin = new byte[size];
                    Logging.Log("[clip] Marshal copy: size:" + size + ", bin-len: " + bin.Length + " glock:" + glock);
                    Marshal.Copy(glock, bin, 0, (int)size);
                    c[format] = bin;
                }
                else
                {
                    Logging.Log("[clip] glock Fail: " + format);
                }
                WinAPI.GlobalUnlock(glock);
                Logging.Log("[clip] hglob:" + hglob + " x fmt: " + format);
                if (dib_skip == 0)
                {
                    if (format == WinAPI.CF_DIB)
                    {
                        dib_skip = WinAPI.CF_DIBV5;
                    }
                    else if (format == WinAPI.CF_DIBV5)
                    {
                        dib_skip = WinAPI.CF_DIB;
                    }
                }
            }
            Logging.Log("[clip] formats_count:," + c.Count);
            WinAPI.CloseClipboard();
            return(c);
        }