Пример #1
0
        static void Main(string[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(512, 512), "LonelyMaze", Styles.Close);

            // init
            window.SetFramerateLimit(60);
            window.Closed += new EventHandler(OnClose);
            window.KeyPressed += new EventHandler<KeyEventArgs>(KeyPress);
            window.KeyReleased += new EventHandler<KeyEventArgs>(KeyUp);

            TestLevel.LoadFromFile(@"resources\testmap.png");

            while (window.IsOpened())
            {
                window.DispatchEvents();

                TestLevel.Update();

                Render(window);
            }
        }
Пример #2
0
        /// <summary>
        /// Fonction called when the post-effects are not supported ;
        /// Display an error message and wait until the user exits
        /// </summary>
        private static void DisplayError(RenderWindow window)
        {
            // Define a string for displaying the error message
            Text error = new Text("Sorry, your system doesn't support shaders");
            error.Position = new Vector2(100.0F, 250.0F);
            error.Color = new Color(200, 100, 150);

            // Start the game loop
            while (window.IsOpened())
            {
                // Process events
                window.DispatchEvents();

                // Clear the window
                window.Clear();

                // Draw the error message
                window.Draw(error);

                // Finally, display the rendered frame on screen
                window.Display();
            }
        }
Пример #3
0
        /// <summary>
        /// Fonction called when the post-effects are not supported ;
        /// Display an error message and wait until the user exits
        /// </summary>
        private static void DisplayError(RenderWindow App)
        {
            // Define a string for displaying the error message
            String2D ErrorStr = new String2D("Sorry, your system doesn't support post-effects");
            ErrorStr.Position = new Vector2(100.0F, 250.0F);
            ErrorStr.Color = new Color(200, 100, 150);

            // Start the game loop
            while (App.IsOpened())
            {
                // Process events
                App.DispatchEvents();

                // Clear the window
                App.Clear();

                // Draw the error message
                App.Draw(ErrorStr);

                // Finally, display the rendered frame on screen
                App.Display();
            }
        }
Пример #4
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // Create main window
            RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL");
            App.PreserveOpenGLStates(true);

            // Setup event handlers
            App.Closed     += new EventHandler(OnClosed);
            App.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
            App.Resized    += new EventHandler<SizeEventArgs>(OnResized);

            // Create a sprite for the background
            Image BackgroundImage = new Image("datas/opengl/background.jpg");
            Sprite Background = new Sprite(BackgroundImage);

            // Create a text to display
            String2D Text = new String2D("This is a rotating cube");
            Text.Position = new Vector2(250.0F, 300.0F);
            Text.Color = new Color(128, 0, 128);

            // Load an OpenGL texture.
            // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function),
            // but here we want more control on it (generate mipmaps, ...) so we create a new one
            int Texture = 0;
            using (Image TempImage = new Image("datas/opengl/texture.jpg"))
            {
                Gl.glGenTextures(1, out Texture);
                Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture);
                Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, (int)TempImage.Width, (int)TempImage.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, TempImage.Pixels);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR);
            }

            // Enable Z-buffer read and write
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glDepthMask(Gl.GL_TRUE);
            Gl.glClearDepth(1.0F);

            // Setup a perspective projection
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F);

            // Bind our texture
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture);
            Gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            float Time = 0.0F;

            // Start game loop
            while (App.IsOpened())
            {
                // Process events
                App.DispatchEvents();

                // Clear the window
                App.Clear();

                // Draw background
                App.Draw(Background);

                // Clear depth buffer
                Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);

                // Apply some transformations
                Time += App.GetFrameTime();
                Gl.glMatrixMode(Gl.GL_MODELVIEW);
                Gl.glLoadIdentity();
                Gl.glTranslatef(0.0F, 0.0F, -200.0F);
                Gl.glRotatef(Time * 50, 1.0F, 0.0F, 0.0F);
                Gl.glRotatef(Time * 30, 0.0F, 1.0F, 0.0F);
                Gl.glRotatef(Time * 90, 0.0F, 0.0F, 1.0F);

                // Draw a cube
                Gl.glBegin(Gl.GL_QUADS);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F,  50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F,  50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, -50.0F);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, 50.0F);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F,  50.0F, 50.0F);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F,  50.0F, 50.0F);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, 50.0F);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F,  50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f(-50.0F,  50.0F,  50.0F);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f(-50.0F, -50.0F,  50.0F);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(50.0F, -50.0F, -50.0F);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(50.0F,  50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f(50.0F,  50.0F,  50.0F);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f(50.0F, -50.0F,  50.0F);

                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, -50.0F,  50.0F);
                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, -50.0F,  50.0F);

                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F,  50.0F);
                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, 50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, 50.0F, -50.0F);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F,  50.0F);

                Gl.glEnd();

                // Draw some text on top of our OpenGL object
                App.Draw(Text);

                // Finally, display the rendered frame on screen
                App.Display();
            }

            // Don't forget to destroy our texture
            Gl.glDeleteTextures(1, ref Texture);
        }
Пример #5
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // Create the main window
            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net Shader");

            // Setup event handlers
            window.Closed     += new EventHandler(OnClosed);
            window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);

            // Check that the system can use shaders
            if (Shader.IsAvailable == false)
            {
                DisplayError(window);
                return;
            }

            // Create the render image
            RenderImage image = new RenderImage(window.Width, window.Height);

            // Load a background image to display
            Sprite background = new Sprite(new Image("resources/background.jpg"));
            background.Image.Smooth = false;

            // Load a sprite which we'll move into the scene
            Sprite entity = new Sprite(new Image("resources/sprite.png"));

            // Load the text font
            Font font = new Font("resources/arial.ttf");

            // Load the image needed for the wave effect
            Image waveImage = new Image("resources/wave.jpg");

            // Load all effects
            shaders = new Dictionary<string, Shader>();
            shaders["nothing"]  = new Shader("resources/nothing.sfx");
            shaders["blur"]     = new Shader("resources/blur.sfx");
            shaders["colorize"] = new Shader("resources/colorize.sfx");
            shaders["fisheye"]  = new Shader("resources/fisheye.sfx");
            shaders["wave"]     = new Shader("resources/wave.sfx");
            shaders["pixelate"] = new Shader("resources/pixelate.sfx");
            backgroundShader = new ShaderSelector(shaders);
            entityShader     = new ShaderSelector(shaders);
            globalShader     = new ShaderSelector(shaders);

            // Do specific initializations
            shaders["nothing"].SetTexture("texture", Shader.CurrentTexture);
            shaders["blur"].SetTexture("texture", Shader.CurrentTexture);
            shaders["blur"].SetParameter("offset", 0.0F);
            shaders["colorize"].SetTexture("texture", Shader.CurrentTexture);
            shaders["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F);
            shaders["fisheye"].SetTexture("texture", Shader.CurrentTexture);
            shaders["wave"].SetTexture("texture", Shader.CurrentTexture);
            shaders["wave"].SetTexture("wave", waveImage);
            shaders["pixelate"].SetTexture("texture", Shader.CurrentTexture);

            // Define a string for displaying current effect description
            shaderText = new Text();
            shaderText.Font = font;
            shaderText.Size = 20;
            shaderText.Position = new Vector2(5.0F, 0.0F);
            shaderText.Color = new Color(250, 100, 30);
            shaderText.DisplayedString = "Background shader: \"" + backgroundShader.Name + "\"\n" +
                                         "Flower shader: \"" + entityShader.Name + "\"\n" +
                                         "Global shader: \"" + globalShader.Name + "\"\n";

            // Define a string for displaying help
            Text infoText = new Text();
            infoText.Font = font;
            infoText.Size = 20;
            infoText.Position = new Vector2(5.0F, 500.0F);
            infoText.Color = new Color(250, 100, 30);
            infoText.DisplayedString = "Move your mouse to change the shaders' parameters\n" +
                                       "Press numpad 1 to change the background shader\n" +
                                       "Press numpad 2 to change the flower shader\n" +
                                       "Press numpad 3 to change the global shader";

            // Start the game loop
            float time = 0.0F;
            while (window.IsOpened())
            {
                // Process events
                window.DispatchEvents();

                // TOFIX -- using window.Input together with image.Draw apparently causes a memory corruption
                // Get the mouse position in the range [0, 1]
                //float x = window.Input.GetMouseX() / (float)window.Width;
                //float y = window.Input.GetMouseY() / (float)window.Height;
                float x = (float)(Math.Cos(time * 1.3) + 1) * 0.5F;
                float y = (float)(Math.Sin(time * 0.8) + 1) * 0.5F;

                // Update the shaders
                backgroundShader.Update(x, y);
                entityShader.Update(x, y);
                globalShader.Update(x, y);

                // Animate the sprite
                time += window.GetFrameTime();
                float entityX = (float)(Math.Cos(time * 1.3) + 1.2) * 300;
                float entityY = (float)(Math.Cos(time * 0.8) + 1.2) * 200;
                entity.Position = new Vector2(entityX, entityY);
                entity.Rotation = time * 100;

                // Draw the background and the moving entity to the render image
                image.Draw(background, backgroundShader.Shader);
                image.Draw(entity, entityShader.Shader);
                image.Display();

                // Draw the contents of the render image to the window
                window.Draw(new Sprite(image.Image), globalShader.Shader);

                // Draw interface texts
                window.Draw(shaderText);
                window.Draw(infoText);

                // Finally, display the rendered frame on screen
                window.Display();
            }
        }
Пример #6
0
        private static void Main(string[] args)
        {
            var form = new SettingsDialog();
            Application.EnableVisualStyles();
            Application.Run(form);
            videoMode = VideoMode.DesktopMode;
            RenderWindow window = new RenderWindow(videoMode, "Maze Crap", Styles.Fullscreen);
            window.EnableVerticalSync(Settings.Default.VerticalSync);
            window.ShowMouseCursor(false);
            window.Closed += (sender, e) => Application.Exit();
            window.KeyPressed += (sender, e) => ((RenderWindow) sender).Close();
            SetUpMaze();
            target = new Image(VideoMode.DesktopMode.Width/10, VideoMode.DesktopMode.Height/10) {Smooth = false};
            float accumulator = 0;
            float WaitTime = 0;
            var fps = (float) Settings.Default.Framerate;
            window.Show(true);
            bool hasrun = false;
            while (window.IsOpened())
            {
                accumulator += window.GetFrameTime();
                while (accumulator > fps)
                {
                    if (FinishedGenerating && !Solving)
                    {
                        if (WaitTime < Settings.Default.WaitTime && hasrun)
                        {
                            WaitTime += window.GetFrameTime();
                        }
                        else
                        {
                            WaitTime = 0;
                            CurrentCell = StartCell*2;
                            VisitedWalls[CurrentCell.X, CurrentCell.Y] = true;
                            CellStack.Clear();
                            Solving = true;
                            hasrun = true;
                        }
                        accumulator -= fps;
                        continue;
                    }
                    if (Solving && FinishedSolving)
                    {
                        if (WaitTime < Settings.Default.WaitTime)
                            WaitTime += window.GetFrameTime();
                        else
                        {
                            Solving = false;
                            FinishedGenerating = false;
                            FinishedSolving = false;
                            SetUpMaze();
                            continue;
                        }
                        continue;
                    }
                    if (Solving && !FinishedSolving)
                    {
                        if (Settings.Default.ShowSolving)
                            FinishedSolving = !SolveIterate(CellStack, Cells, Walls, StartCell, EndCell);
                        else
                        {
                            while (SolveIterate(CellStack, Cells, Walls, StartCell, EndCell)) ;
                            FinishedSolving = true;
                        }
                        accumulator -= fps;
                        continue;
                    }

                    if (Settings.Default.ShowGeneration)
                    {
                        FinishedGenerating = !GenerateIterate(CellStack, Cells, Walls);
                        hasrun = true;
                    }
                    else
                    {
                        while (GenerateIterate(CellStack, Cells, Walls)) ;
                        FinishedGenerating = true;
                    }
                    accumulator -= fps;
                    NeedsRedraw = true;
                }
                Render(window);
                window.Display();
                window.DispatchEvents();
            }
        }
Пример #7
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // Create main window
            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL", Styles.Default, new ContextSettings(32, 0));

            // Setup event handlers
            window.Closed     += new EventHandler(OnClosed);
            window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
            window.Resized    += new EventHandler<SizeEventArgs>(OnResized);

            // Create a sprite for the background
            Image backgroundImage = new Image("resources/background.jpg");
            Sprite background = new Sprite(backgroundImage);

            // Create a text to display
            Text text = new Text("SFML / OpenGL demo");
            text.Position = new Vector2(250.0F, 450.0F);
            text.Color = new Color(255, 255, 255, 170);

            // Load an OpenGL texture.
            // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function),
            // but here we want more control on it (generate mipmaps, ...) so we create a new one
            int texture = 0;
            using (Image image = new Image("resources/texture.jpg"))
            {
                Gl.glGenTextures(1, out texture);
                Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture);
                Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, (int)image.Width, (int)image.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, image.Pixels);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
                Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR);
            }

            // Enable Z-buffer read and write
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glDepthMask(Gl.GL_TRUE);
            Gl.glClearDepth(1.0F);

            // Setup a perspective projection
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F);

            // Bind our texture
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture);
            Gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            float time = 0.0F;

            // Start game loop
            while (window.IsOpened())
            {
                // Process events
                window.DispatchEvents();

                // Clear the window
                window.Clear();

                // Draw background
                window.SaveGLStates();
                window.Draw(background);
                window.RestoreGLStates();

                // Activate the window before using OpenGL commands.
                // This is useless here because we have only one window which is
                // always the active one, but don't forget it if you use multiple windows
                window.SetActive();

                // Clear depth buffer
                Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);

                // We get the position of the mouse cursor, so that we can move the box accordingly
                float x =  window.Input.GetMouseX() * 200.0F / window.Width  - 100.0F;
                float y = -window.Input.GetMouseY() * 200.0F / window.Height + 100.0F;

                // Apply some transformations
                time += window.GetFrameTime();
                Gl.glMatrixMode(Gl.GL_MODELVIEW);
                Gl.glLoadIdentity();
                Gl.glTranslatef(x, y, -100.0F);
                Gl.glRotatef(time * 50, 1.0F, 0.0F, 0.0F);
                Gl.glRotatef(time * 30, 0.0F, 1.0F, 0.0F);
                Gl.glRotatef(time * 90, 0.0F, 0.0F, 1.0F);

                // Draw a cube
                float size = 20.0F;
                Gl.glBegin(Gl.GL_QUADS);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, -size);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size,  size, -size);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size,  size, -size);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, -size, -size);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, size);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size,  size, size);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size,  size, size);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, -size, size);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, -size);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size,  size, -size);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f(-size,  size,  size);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f(-size, -size,  size);

                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(size, -size, -size);
                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(size,  size, -size);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f(size,  size,  size);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f(size, -size,  size);

                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, -size,  size);
                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, -size);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, -size, -size);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size, -size,  size);

                    Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, size,  size);
                    Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, size, -size);
                    Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, size, -size);
                    Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size, size,  size);

                Gl.glEnd();

                // Draw some text on top of our OpenGL object
                window.SaveGLStates();
                window.Draw(text);
                window.RestoreGLStates();

                // Finally, display the rendered frame on screen
                window.Display();
            }

            // Don't forget to destroy our texture
            Gl.glDeleteTextures(1, ref texture);
        }
Пример #8
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // Create the main window
            RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net PostFX");

            // Setup event handlers
            App.Closed     += new EventHandler(OnClosed);
            App.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);

            // Check that the system can use post effects
            if (PostFx.CanUsePostFX == false)
            {
                DisplayError(App);
                return;
            }

            // Load a cute background image to display :)
            Sprite Background = new Sprite(new Image("datas/post-fx/background.jpg"));

            // Load the text font
            Font Cheeseburger = new Font("datas/post-fx/cheeseburger.ttf");

            // Load the image needed for the wave effect
            Image WaveImage = new Image("datas/post-fx/wave.jpg");

            // Load all effects
            Effects = new Dictionary<string, PostFx>();
            Effects["nothing"]  = new PostFx("datas/post-fx/nothing.sfx");
            Effects["blur"]     = new PostFx("datas/post-fx/blur.sfx");
            Effects["colorize"] = new PostFx("datas/post-fx/colorize.sfx");
            Effects["fisheye"]  = new PostFx("datas/post-fx/fisheye.sfx");
            Effects["wave"]     = new PostFx("datas/post-fx/wave.sfx");
            CurrentEffect = Effects.GetEnumerator();
            CurrentEffect.MoveNext();

            // Do specific initializations
            Effects["nothing"].SetTexture("framebuffer", null);
            Effects["blur"].SetTexture("framebuffer", null);
            Effects["blur"].SetParameter("offset", 0.0F);
            Effects["colorize"].SetTexture("framebuffer", null);
            Effects["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F);
            Effects["fisheye"].SetTexture("framebuffer", null);
            Effects["wave"].SetTexture("framebuffer", null);
            Effects["wave"].SetTexture("wave", WaveImage);

            // Define a string for displaying current effect description
            CurFXStr = new String2D();
            CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\"";
            CurFXStr.Font = Cheeseburger;
            CurFXStr.Position = new Vector2(20.0F, 0.0F);

            // Define a string for displaying help
            String2D InfoStr = new String2D();
            InfoStr.Text = "Move your mouse to change the effect parameters\nPress numpad + to change effect\nWarning : some effects may not work\ndepending on your graphics card";
            InfoStr.Font = Cheeseburger;
            InfoStr.Position = new Vector2(20.0F, 460.0F);
            InfoStr.Color = new Color(200, 100, 150);

            // Start the game loop
            while (App.IsOpened())
            {
                // Process events
                App.DispatchEvents();

                // Get the mouse position in the range [0, 1]
                float X = App.Input.GetMouseX() / (float)App.Width;
                float Y = App.Input.GetMouseY() / (float)App.Height;

                // Update the current effect
                if      (CurrentEffect.Current.Key == "blur")     CurrentEffect.Current.Value.SetParameter("offset", X * Y * 0.1f);
                else if (CurrentEffect.Current.Key == "colorize") CurrentEffect.Current.Value.SetParameter("color", 0.3f, X, Y);
                else if (CurrentEffect.Current.Key == "fisheye")  CurrentEffect.Current.Value.SetParameter("mouse", X, 1.0F - Y);
                else if (CurrentEffect.Current.Key == "wave")     CurrentEffect.Current.Value.SetParameter("offset", X, Y);

                // Clear the window
                App.Clear();

                // Draw background and apply the post-fx
                App.Draw(Background);
                App.Draw(CurrentEffect.Current.Value);

                // Draw interface strings
                App.Draw(CurFXStr);
                App.Draw(InfoStr);

                // Finally, display the rendered frame on screen
                App.Display();
            }
        }