Esempio n. 1
0
 private void game_RenderFrame(object sender, FrameEventArgs e)
 {
     demo.UpdateBuffer(0, 0, 0, bufferWidth, bufferHeight);
     demo.Draw(gameWindow.Width, gameWindow.Height);
     demo.SaveBuffer(saveDirectory + fileNumber.ToString("00000") + ".png");
     gameWindow.SwapBuffers();
     ++fileNumber;
     demo.TimeSource.Position += 1.0f / frameRate;             //step 1/25 of a second
 }
Esempio n. 2
0
        public FormMain()
        {
            InitializeComponent();

            string demoFilter = DefaultFiles.GetDemoExtension() + " (*" + DefaultFiles.GetDemoExtension() + ")|*" + DefaultFiles.GetDemoExtension();

            menuSizeSetting.SelectedIndexChanged += (sender, e) => glControl.Invalidate();
            multiGraph.ChangedPosition           += (pos) => soundPlayerBar1.Position = pos;
            multiGraph.KeyDown += FormMain_KeyDown;
            camera.Redraw      += (position) => glControl.Invalidate();
            cameraWindowToolStripMenuItem.Click      += (s, e) => camera.Show();
            addCameraUniformsToolStripMenuItem.Click += (s, e) => camera.AddKeyFrames(demo.TimeSource.Position, demo.Uniforms);

            logToolStripMenuItem.Click      += (s, e) => log.Show();
            soundPlayerBar1.PositionChanged += (position) => glControl.Invalidate();
            soundPlayerBar1.PositionChanged += (position) => multiGraph.UpdatePosition(position);
            soundPlayerBar1.PositionChanged += (position) => camera.UpdateFromUniforms(demo.Uniforms, position);

            menuOnTop.CheckedChanged += (s, e) => TopMost = menuOnTop.Checked;
            menuHelp.Click           += (sender, e) => Dialogs.Help();
            menuLoad.Click           += (sender, e) => Dialogs.OpenFile(demoFilter
                                                                        , (fileName) => LoadDemo(fileName));
            menuSound.Click      += (sender, e) => Dialogs.OpenFile("sound (*.*)|*.*", (fileName) => demo.TimeSource.Load(DemoTimeSource.FromMediaFile(fileName), fileName));
            MenuShaderAdd.Click  += (sender, e) => Dialogs.OpenFile("glsl (*.glsl)|*.glsl", (fileName) => AddShader(fileName));
            MenuTextureAdd.Click += (sender, e) => Dialogs.OpenFile("texture (*.*)|*.*", (fileName) => demo.Textures.AddUpdate(fileName));
            menuSave.Click       += (sender, e) => Dialogs.SaveFile(demoFilter, (fileName) =>
            {
                try
                {
                    DemoLoader.SaveToFile(demo, fileName);
                }
                catch (Exception ex)
                {
                    log.Append(ex.Message);
                }
            });
            menuScreenshot.Click += (sender, e) => Dialogs.SaveFile("png (*.png)|*.png", (fileName) => { glControl.Invalidate(); demo.SaveBuffer(fileName); });

            KeyDown += (sender, e) => { camera.KeyChange(e.KeyCode, true); };
            KeyUp   += (sender, e) => { camera.KeyChange(e.KeyCode, false); };
        }