Example #1
0
        static void Main()
        {
            Gd.InitGd();

            var doWork = Task.Run(() =>
            {
                try
                {
                    Thread.Sleep(Timeout.Infinite);
                }
                catch (ThreadInterruptedException)
                {
                }
                Application.Exit(); // Quick exit for demonstration only.
            });

            _hookID = SetHook(_proc);

            Application.Run();

            Win32Wrap.UnhookWindowsHookEx(_hookID);
        }
Example #2
0
        protected internal override void Draw(Matrix cameraMatrix)
        {
            // Setup various graphics device stuff.
            // TODO: See how SpriteBatch handles manually setting these!
            Emitter emitter = Emitter;
            Gd.BlendState = BlendState.Additive;
            Gd.DepthStencilState = DepthStencilState.None;
            Gd.SamplerStates[0] = SamplerState.PointClamp;
            Gd.RasterizerState = RasterizerState.CullCounterClockwise;

            // Update parameters. May only need to be set when one of these values actually changes, not every frame.
            effect.CurrentTechnique = effect.Techniques["ParticleInstancing"];
            effect.Parameters["World"].SetValue(cameraMatrix * projection);
            effect.Parameters["ParticleTexture"].SetValue(emitter.Texture);
            instanceBuffer.SetData(instanceData);

            // set buffer bindings to the device
            Gd.SetVertexBuffers(vertexBufferBinding, instanceBufferBinding);
            Gd.Indices = indexBuffer;

            // Set the shader technique pass and then Draw
            effect.CurrentTechnique.Passes[0].Apply();
            Gd.DrawInstancedPrimitives(PrimitiveType.TriangleList, 0, 0, 2, emitter.NumActive);
        }
 private void Gd_Click(object sender, EventArgs e)
 {
     Gd form2 = new Gd();
     form2.Show();
 }