コード例 #1
0
ファイル: MainForm.cs プロジェクト: MilanLoveless/RayTracer
        void _InitializeSystem()
        {
            //////////////////////////////////////////////////////////////////////////
            // Load resources
            //GameCore.ResourceLoader._LoadResources();
            //////////////////////////////////////////////////////////////////////////

            _bmpPrimarySurface = new Bitmap(
                _pictureBox.Width, _pictureBox.Height,
                System.Drawing.Imaging.PixelFormat.Format32bppArgb
                );

            _GameClass = new GameCore.GameClass();

            //////////////////////////////////////////////////////////////////////////
            // Background Drawing Thread: We will begin drawing stuff in the background
            ThreadStart ts = new ThreadStart(_OnBeginBackgroundDrawing);

            _thread = new System.Threading.Thread(ts);
            _thread.Start();

            //////////////////////////////////////////////////////////////////////////
            // Frame timer: We will periodically draw what is currently rendered
            _Timer1          = new System.Windows.Forms.Timer();
            _Timer1.Tick    += new EventHandler(_OnFrameTimer);
            _Timer1.Interval = 100;
            _Timer1.Start();
            // Call it once so we don't have to wait 1 second
            //_OnFrame(_bmpPrimarySurface);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: MilanLoveless/RayTracer
        void _InitializeSystem()
        {
            //////////////////////////////////////////////////////////////////////////
            // Load resources
            //GameCore.ResourceLoader._LoadResources();
            //////////////////////////////////////////////////////////////////////////

            _bmpPrimarySurface = new Bitmap(
                _pictureBox.Width, _pictureBox.Height,
                System.Drawing.Imaging.PixelFormat.Format32bppArgb
            );

            _GameClass = new GameCore.GameClass();

            //////////////////////////////////////////////////////////////////////////
            // Background Drawing Thread: We will begin drawing stuff in the background
            ThreadStart ts = new ThreadStart(_OnBeginBackgroundDrawing);
            _thread = new System.Threading.Thread(ts);
            _thread.Start();

            //////////////////////////////////////////////////////////////////////////
            // Frame timer: We will periodically draw what is currently rendered
            _Timer1 = new System.Windows.Forms.Timer();
            _Timer1.Tick += new EventHandler(_OnFrameTimer);
            _Timer1.Interval = 100;
            _Timer1.Start();
            // Call it once so we don't have to wait 1 second
            //_OnFrame(_bmpPrimarySurface);
        }
コード例 #3
0
        void _InitializeSystem()
        {
            /////////////////////////////////////////////////
            // Load game resources (commented out for now)
            GameCore.ResourceLoader._LoadResources();
            /////////////////////////////////////////////////

            _bmpPrimarySurface = new Bitmap(_pictureBox.Width, _pictureBox.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            _GameClass         = new GameCore.GameClass();
            _GameClass._OnInitialize(_pictureBox.Width, _pictureBox.Height);
            _Timer1          = new Timer();
            _Timer1.Tick    += new EventHandler(_OnDrawTimer);
            _Timer1.Interval = 25;
            _Timer1.Start();
            _Timer2          = new Timer();
            _Timer2.Tick    += new EventHandler(_OnRunAITimer);
            _Timer2.Interval = 35;
            _Timer2.Start();
        }