예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ScreenContext.CameraMotionProvider = new BasicCameraControllerMotionProvider(this, this);
            BasicGrid grid = new BasicGrid();

            grid.Load(RenderContext);
            WorldSpace.AddResource(grid);
            bulletPhysics = new BulletPhysics(new Vector3(0, -9.8f, 0f));
            ground        = bulletPhysics.CreatePlane(0, Matrix.Identity);
            ball_Model    = MMDModel.OpenLoad("1.pmx", RenderContext);
            ball_Model2   = MMDModel.OpenLoad("1.pmx", RenderContext);
            RigidBodyData data = ball_Model.Model.RigidBodyList.RigidBodies[0];

            ball  = bulletPhysics.CreateSphere(data.Size.X, Matrix.Translation(-15, 12f, 0), 1f, 1f, 0f);
            ball2 = bulletPhysics.CreateSphere(data.Size.X, Matrix.Translation(15, 12f, 0), 1f, 1f, 0f);

            rigid2model = GetModelWorldFromRigid();

            WorldSpace.AddResource(ball_Model);
            WorldSpace.AddResource(ball_Model2);
            CreateWalls();
            ball.ApplyCentralImpulse(new Vector3(2, 0.01f, 0f));
            ball2.ApplyCentralImpulse(new Vector3(-2, 0, 0));
            brush  = SpriteBatch.CreateSolidColorBrush(Color.Brown);
            format = SpriteBatch.CreateTextformat("Meiriyo", 30);
            format.Format.ParagraphAlignment = ParagraphAlignment.Center;
            format.Format.TextAlignment      = TextAlignment.Center;
            timer1.Start();
        }
예제 #2
0
파일: Form1.cs 프로젝트: AmmRage/mmflex
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //②-A 描画に利用するリソースの初期化
            textFormat = SpriteBatch.CreateTextformat("Meiriyo", 30, FontWeight.Bold);
            //Specify the text format alignment do。
            textFormat.Format.ParagraphAlignment = ParagraphAlignment.Center; //Vertical alignment。Center:中央、Near:上、Far:下
            textFormat.Format.TextAlignment      = TextAlignment.Center;      //Horizontal alignment。Center:中央、Near:左、Far:右


            colorBrush = SpriteBatch.CreateSolidColorBrush(Color.OrangeRed);


            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "ビットマップファイル(*.bmp)|*.bmp|PNGファイル(*.png)|*.png|JPGファイル(*.jpg)|*.jpg|すべてのファイル(*.*)|*.*";
            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                bitmap = SpriteBatch.CreateBitmap(ofd.FileName);
            }
            else
            {
                Close();
            }



            /*
             * 画面がリサイズされた時などには、SpriteBatchが自動的にリサイズされる。
             * この時、リソースも作り直す必要性があるためSpriteBatch.Create~~として取得できるD2DSprite~~は自動的に
             * リサイズ時などに同じ設定で再作成される。
             * ただし、すべてのDirectWriteに利用するクラスについてこれは実装を完了していない。
             */
            OpenFileDialog ofd2 = new OpenFileDialog();

            ofd2.Filter = "PMXモデルファイル(*.pmx)|*.pmx";
            if (ofd2.ShowDialog(this) == DialogResult.OK)
            {
                WorldSpace.AddResource(PMXModelWithPhysics.OpenLoad(ofd2.FileName, RenderContext));
            }
        }
예제 #3
0
        public void OnLoad(MMF.Sprite.D2DSpriteBatch batch)
        {
            GameContext.InitializePlayerDescriptions(batch);
            _geometry = new PathGeometry(GameContext.RenderContext.D2DFactory);
            GeometrySink geometrySink = _geometry.Open();

            geometrySink.SetFillMode(FillMode.Winding);
            geometrySink.BeginFigure(new Point(50, 580), FigureBegin.Filled);
            geometrySink.AddLine(new Point(20, 600));
            geometrySink.AddLine(new Point(50, 620));
            geometrySink.EndFigure(FigureEnd.Closed);
            geometrySink.Close();

            _geometry_2 = new PathGeometry(GameContext.RenderContext.D2DFactory);
            GeometrySink geometrySink_2 = _geometry_2.Open();

            geometrySink_2.SetFillMode(FillMode.Winding);
            geometrySink_2.BeginFigure(new Point(520, 580), FigureBegin.Filled);
            geometrySink_2.AddLine(new Point(550, 600));
            geometrySink_2.AddLine(new Point(520, 620));
            geometrySink_2.EndFigure(FigureEnd.Closed);
            geometrySink_2.Close();



            col_1 = batch.CreateSolidColorBrush(Color.FromArgb(255, 255, 255, 255));
            col_2 = batch.CreateSolidColorBrush(Color.FromArgb(120, 255, 0, 0));
            col_3 = batch.CreateSolidColorBrush(Color.FromArgb(120, 0, 0, 255));
            col_4 = batch.CreateSolidColorBrush(Color.FromArgb(120, 0, 255, 0));
            col_5 = batch.CreateSolidColorBrush(Color.FromArgb(120, 0, 0, 0));

            //  bitmap = batch.CreateBitmap(@playerDescriptions[currentIndex].image);
            format_1      = batch.CreateTextformat("Meiryo UI", 60);
            format_2      = batch.CreateTextformat("Meiryo UI", 100);
            isInitialized = true;
        }
예제 #4
0
        public void OnLoad(MMF.Sprite.D2DSpriteBatch batch)
        {
            GameContext.InitializePlayerDescriptions(batch);
            _geometry = new PathGeometry(GameContext.RenderContext.D2DFactory);
            GeometrySink geometrySink = _geometry.Open();
            geometrySink.SetFillMode(FillMode.Winding);
            geometrySink.BeginFigure(new Point(50, 580), FigureBegin.Filled);
            geometrySink.AddLine(new Point(20, 600));
            geometrySink.AddLine(new Point(50, 620));
            geometrySink.EndFigure(FigureEnd.Closed);
            geometrySink.Close();

            _geometry_2 = new PathGeometry(GameContext.RenderContext.D2DFactory);
            GeometrySink geometrySink_2 = _geometry_2.Open();
            geometrySink_2.SetFillMode(FillMode.Winding);
            geometrySink_2.BeginFigure(new Point(520, 580), FigureBegin.Filled);
            geometrySink_2.AddLine(new Point(550, 600));
            geometrySink_2.AddLine(new Point(520, 620));
            geometrySink_2.EndFigure(FigureEnd.Closed);
            geometrySink_2.Close();

            col_1 = batch.CreateSolidColorBrush(Color.FromArgb(255, 255, 255, 255));
            col_2 = batch.CreateSolidColorBrush(Color.FromArgb(120, 255, 0, 0));
            col_3 = batch.CreateSolidColorBrush(Color.FromArgb(120, 0, 0, 255));
            col_4 = batch.CreateSolidColorBrush(Color.FromArgb(120, 0, 255, 0));
            col_5 = batch.CreateSolidColorBrush(Color.FromArgb(120, 0, 0, 0));

            //  bitmap = batch.CreateBitmap(@playerDescriptions[currentIndex].image);
            format_1 = batch.CreateTextformat("Meiryo UI", 60);
            format_2 = batch.CreateTextformat("Meiryo UI", 100);
            isInitialized = true;
        }