Esempio n. 1
0
        /// <summary>
        /// Parameterless constructor.
        /// Initializes references and identifies the run mode.
        /// </summary>
        public Core()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Application.ThreadException        += new ThreadExceptionEventHandler(UIThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException);
            ctorParams = new object[] { this };

#if DEBUG
            runMode = RunMode.Debug;
#else
            runMode = RunMode.Release;
#endif

            Atmosphere        = new TVAtmosphere();
            CameraFactory     = new TVCameraFactory();
            Globals           = new TVGlobals();
            InputEngine       = new TVInputEngine();
            InternalObjects   = new TVInternalObjects();
            LightEngine       = new TVLightEngine();
            MathLibrary       = new TVMathLibrary();
            Physics           = new TVPhysics();
            Scene             = new TVScene();
            Screen2DImmediate = new TVScreen2DImmediate();
            Screen2DText      = new TVScreen2DText();
            TextureFactory    = new TVTextureFactory();
            MaterialFactory   = new TVMaterialFactory();
            GameControllers   = new TVGameControllers();
            DeviceInfo        = new TVDeviceInfo();
            GraphicEffect     = new TVGraphicEffect();
        }
Esempio n. 2
0
        public GameManager()
        {
            TotalTimeElapsed = 0;

            TvEngine = new TVEngine();
            TvEngine.DisplayFPS(true);

            if (windowed)
            {
                Form1 form = new Form1(this);
                form.Show();
                TvEngine.Init3DWindowed(form.Handle);
            }
            else
            {
                TvEngine.Init3DFullscreen(ScreenWidth, ScreenHeight);
            }

            TvInputEngine = new TVInputEngine();
            TvInputEngine.Initialize(true, true);

            TvScene  = new TVScene();
            TvCamera = TvScene.GetCamera();

            TvPhysics = new TVPhysics();
            TvPhysics.Initialize();
            TvPhysics.SetSolverModel(CONST_TV_PHYSICS_SOLVER.TV_SOLVER_LINEAR_10_PASSES);
            TvPhysics.SetFrictionModel(CONST_TV_PHYSICS_FRICTION.TV_FRICTION_EXACT);
            TvPhysics.SetGlobalGravity(new TV_3DVECTOR(0F, -980F, 0F));

            TvPhysics.SetMaterialInteractionContinuousCollision(0, 0, true);
            TvPhysics.SetMaterialInteractionFriction(0, 0, 0.000001f, 0.000001f);
            TvPhysics.SetMaterialInteractionBounciness(0, 0, 0.5f);

            TvMaths = new TVMathLibrary();

            TvScreen2DText = new TVScreen2DText();

            TvLights    = new TVLightEngine();
            TvMaterials = new TVMaterialFactory();
            TvGlobals   = new TVGlobals();

            Message = new MessageManager(this);
        }
Esempio n. 3
0
        //3D MODEL
        //////////
        public void Init3D()
        {
            lights = new TVLightEngine();
            globals = new TVGlobals();
            atmosphere = new TVAtmosphere();
            maths = new TVMathLibrary();
            materialfactory = new TVMaterialFactory();
            texturefactory = new TVTextureFactory();
            tv = new TVEngine();
            physics = new TVPhysics();

            //Setup TV
            ////tv.SetDebugMode(true, true);
            ////tv.SetDebugFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\debugfile.txt");
            tv.SetAntialiasing(true, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES);

            //Enter Your Beta Username And Password Here
            //tv.SetBetaKey("", "");

            tv.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);
            //tv.Init3DWindowed(this.Handle, true);
        }
Esempio n. 4
0
        private void Robot_Load(object sender, EventArgs e)
        {
            //Tracking
            //pictureBox27.Load(Application.StartupPath + "\\Resources\\image1.jpg");
            /////3D
            lights = new TVLightEngine();
            globals = new TVGlobals();
            atmosphere = new TVAtmosphere();
            maths = new TVMathLibrary();
            materialfactory = new TVMaterialFactory();
            texturefactory = new TVTextureFactory();
            tv = new TVEngine();
            physics = new TVPhysics();

            //Setup TV
            tv.SetDebugMode(true, true);
            tv.SetDebugFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\debugfile.txt");
            tv.SetAntialiasing(true, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES);

            //Enter Your Beta Username And Password Here
            //tv.SetBetaKey("", "");

            tv.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);
            //tv.Init3DWindowed(this.Handle, true);
            tv.Init3DWindowed(this.pictureBox3D.Handle, true);
            tv.GetViewport().SetAutoResize(true);
            tv.DisplayFPS(true);
            tv.SetVSync(true);

            scene = new TVScene();

            input = new TVInputEngine();
            input.Initialize(true, true);

            camera = new TVCamera();
            camera = scene.GetCamera();
            camera.SetViewFrustum(45, 1000, 0.1f);
            camera.SetPosition(0, 5, -20);
            camera.SetLookAt(0, 3, 0);

            viewport = new TVViewport();
            viewport = tv.CreateViewport(this.Handle, "viewport");
            viewport.SetCamera(camera);
            viewport.SetBackgroundColor(Color.Blue.ToArgb());
            bDoLoop = true;

            InitSound();
            InitMaterials();
            InitTextures();
            InitFonts();
            InitShaders();
            InitEnvironment();
            InitPhysics();
            InitLandscape();
            InitObjects();
            InitLights();
            InitPhysicsMaterials();
            Init2DText();

            this.Show();
            this.Focus();

            GameLoop();

            tv = null;

            this.Close();
            //// /3D

            groupComPortDefault.Enabled             = false;
            groupComPortSettings.Enabled            = false;
            groupTcpClientServerSettings.Enabled    = false;
            groupTcpClientServerDefault.Enabled     = false;
            groupDirectionAndMotion.Enabled         = false;
            groupCameraRotation.Enabled             = false;
            groupCameraRot2.Enabled                 = false;
            groupAdvencedSuppDevices.Enabled        = false;
            groupJoystickInit.Enabled               = false;
            labelCommunicationType.Text             = null;
            labelConnectingStatus.Text              = null;
            labelJoystickName.Text                  = null;
            SetMap();
            Maps.SelectedItem = "TUKE";

            //Full Screen
            Options op = new Options();
            op = op.ReadOptionsFromFile();
            this.combo_method.SelectedIndex = op.Scale;
            this.combo_streams.SelectedIndex = op.Streams;
            this.textBox1.Text = op.Text;
            //this.lbl_foreColor.BackColor = ColorTranslator.FromHtml(op.ForeColor);
        }