当前位置: 首页>>代码示例>>C#>>正文


C# PloobsEngine.GetTexture2D方法代码示例

本文整理汇总了C#中PloobsEngine.GetTexture2D方法的典型用法代码示例。如果您正苦于以下问题:C# PloobsEngine.GetTexture2D方法的具体用法?C# PloobsEngine.GetTexture2D怎么用?C# PloobsEngine.GetTexture2D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PloobsEngine的用法示例。


在下文中一共展示了PloobsEngine.GetTexture2D方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadContent

        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");


            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///border
            border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red));

            ///from texture
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex, new Vector2(4));
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved);
                this.World.AddObject(o);
            }
            
            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);

            ///Create the Particle System
            DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null));
            this.World.ParticleManager.AddAndInitializeParticleSystem(ps);
            
            ///updateable
            JointUpdateable ju = new JointUpdateable(this, fworld, this.World.Camera2D);

            base.LoadContent(GraphicInfo, factory, contentManager);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:34,代码来源:Basic2DParticleScreen.cs

示例2: LoadContent

        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");
            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///Ground
            Vertices verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0, 250);
                this.World.AddObject(o);
            }         

            ///animated sprite
            {
                ///loading the texture
                Texture2D tex = factory.GetTexture2D("Textures//DudeSheet");
                ///scale the texture (this is not good specially with animated texture, cause the whole texture is being scalled)
                tex = factory.GetScaledTexture(tex, new Vector2(2));
                ///Loading the Sprite and extracting the frames 
                ///8 = Maximum number of frames in the horizontal
                ///2 = Number of animation
                ///See the texture DudeSheet to undertand
                SpriteAnimated sa = new SpriteAnimated(tex, 8, 2);
                ///Specify the first animation (First "line" of the texture) -- see the extra parameters in addAnimation
                sa.AddAnimation("ANIM1", 1, 8, 0);
                ///Specify the Second animation (Second "line" of the texture)
                sa.AddAnimation("ANIM2", 2, 4, 0);

                ///Create the Material
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                ///To create the physic object, we extract one frame from the image and use it to be our physic body =P
                Texture2D frame = factory.GetTexturePart(tex, sa.GetFrameRectangle("ANIM1", 0));
                FarseerObject fs = new FarseerObject(fworld, frame);                
                sheet = new I2DObject(fs, mat, sa);
                sheet.PhysicObject.Position = new Vector2(0,0);
                this.World.AddObject(sheet);
            }

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);
            base.LoadContent(GraphicInfo, factory, contentManager);
            
            ///when double tap, perform the following action
            this.BindInput(new SimpleConcreteGestureInputPlayable(Microsoft.Xna.Framework.Input.Touch.GestureType.DoubleTap,
                (a) =>
                {
                    animationIndex = (animationIndex + 1) % 2;
                    (sheet.Modelo as SpriteAnimated).ChangeAnimation(animations[animationIndex]);
                    ///you can play, pause, change ..... using the SpriteAnimated object.
                }
                ));
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:58,代码来源:Basic2DSpriteScreen.cs

示例3: LoadContent

        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");


            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///border
            border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red));

            ///from texture, scale usage sample
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex, new Vector2(3));
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, tex);
                fs.Position = new Vector2(0, 50);
                partobj = new I2DObject(fs, mat, model);
                partobj.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved);
                this.World.AddObject(partobj);
            }

            Vertices verts = PolygonTools.CreateRectangle(150, 150);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(100, 100);
                this.World.AddObject(o);
            }

            //circle
            verts = PolygonTools.CreateCircle(150, 150);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);                
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(-100, -100);
                this.World.AddObject(o);
            }

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);

            DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null));
            this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

            ///updateable
             ju = new JointUpdateable(this, fworld, this.World.Camera2D);
           
            base.LoadContent(GraphicInfo, factory, contentManager);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:57,代码来源:Basic2DScreen.cs

示例4: Init

 public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
 {
     Effect = factory.GetEffect("ssao",false,true);
     tex = factory.GetTexture2D("noisetex", true);
     sBlurPost = new SBlurPost(blurAmount, BlurRadiusSize);
     sBlurPost.Init(ginfo, factory);
     RenderTarget2D = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     RenderTarget2D2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:9,代码来源:SSAOPost.cs

示例5: LoadContent

 protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
 {
     tex = factory.GetTexture2D("Textures//loading_screen");
     base.LoadContent(GraphicInfo, factory, contentManager);
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:5,代码来源:LoadingScreen.cs

示例6: Init

            public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
            {
                shader = factory.GetEffect("HBAO\\HorizonBasedAmbientOcclusion");
                Texture randomNormalTexture = factory.GetTexture2D("HBAO\\RandomNormal");
                shader.Parameters["randomTexture"].SetValue(randomNormalTexture);
                
                epResolution = shader.Parameters["resolution"];
                epInverseResolution = shader.Parameters["invResolution"];
                epNumberSteps = shader.Parameters["numberSteps"];
                epNumberDirections = shader.Parameters["numberDirections"];
                epContrast = shader.Parameters["contrast"];
                epLineAttenuation = shader.Parameters["attenuation"];
                epRadius = shader.Parameters["radius"];
                epAngleBias = shader.Parameters["angleBias"];
                // Others
                epFocalLength = shader.Parameters["focalLength"];
                epInvFocalLength = shader.Parameters["invFocalLength"];
                epHalfPixel = shader.Parameters["halfPixel"];
                epSqrRadius = shader.Parameters["sqrRadius"];
                epInvRadius = shader.Parameters["invRadius"];
                epTanAngleBias = shader.Parameters["tanAngleBias"];

                RenderTarget2D = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
                RenderTarget2D2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
                depthrender = factory.CreateRenderTarget(ginfo.BackBufferWidth , ginfo.BackBufferHeight, SurfaceFormat.Single,true);

                g = new GaussianBlurPostEffect(false);
                g.Init(ginfo, factory);
                renderdepth = factory.GetEffect("HBAO\\generateDepth");
                ssaofinal = factory.GetEffect("ssaofinal", false, true);

            }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:32,代码来源:HBAOPostEffect.cs

示例7: Init

 public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
 {
     effect = factory.GetEffect("Effects/backgroundTexture");
     BackGroundTexture = factory.GetTexture2D(BackTextureName);
     
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:6,代码来源:BackgroundTexture.cs

示例8: Initialize

        public override void  Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj)
        {
 	        base.Initialize(ginfo, factory, obj);
            this._shader = factory.GetEffect("WaterComplete",true,true);         
            refractionRT = factory.CreateRenderTarget(WIDTH,HEIGHT);
            reflectionRT = factory.CreateRenderTarget(WIDTH, HEIGHT);
            normal0 = factory.GetTexture2D("wave0", true);
            normal1 = factory.GetTexture2D("wave1", true);                                    
        }        
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:9,代码来源:DeferredWaterCompleteShader.cs

示例9: LoadContent

        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");
            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            //ground
            {
                Vertices Vertices = new Vertices(3);
                Vertices.Add(new Vector2(-200, 0));
                Vertices.Add(new Vector2(0, 200));
                Vertices.Add(new Vector2(200, 0));

                SpriteFarseer SpriteFarseer = new SpriteFarseer(factory, Vertices, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, SpriteFarseer, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, SpriteFarseer);
                this.World.AddObject(o);

            }

            ///from texture
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, tex);
                I2DObject o = new I2DObject(fs, mat, model);
                this.World.AddObject(o);
            }

            ///rectangle
            Vertices verts = PolygonTools.CreateRectangle(50, 50);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                model.LayerDepth = 0;
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                this.World.AddObject(o);
            }

            //rectangle
            //cria em Display
            verts = PolygonTools.CreateRectangle(50, 50);

            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                model.LayerDepth = 1;
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
            
                o.PhysicObject.Position = new Vector2(50, 50);
                this.World.AddObject(o);
            }


            ///rectangle
            verts = PolygonTools.CreateRectangle(50, 50);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Orange);
                model.LayerDepth = 0;
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(-GraphicInfo.BackBufferWidth / 2, 0);
                this.World.AddObject(o);
            }

            ///circle
            CircleShape circle = new CircleShape(50, 1);
            {
                IModelo2D model = new SpriteFarseer(factory, circle, Color.Yellow);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(0, -GraphicInfo.BackBufferHeight / 2);
                this.World.AddObject(o);
            }

            ///animated sprite
            {
                Texture2D tex = factory.GetTexture2D("Textures//DudeSheet");
                SpriteAnimated sa = new SpriteAnimated(tex, 8, 2);
                sa.AddAnimation("ANIM1", 1, 8, 0);
                sa.AddAnimation("ANIM2", 2, 4, MathHelper.PiOver2);

                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                Texture2D frame = factory.GetTexturePart(tex, sa.GetFrameRectangle("ANIM1", 0));
                FarseerObject fs = new FarseerObject(fworld, frame);

                I2DObject sheet = new I2DObject(fs, mat, sa);
                sheet.PhysicObject.Position = new Vector2(100, 100);
                this.World.AddObject(sheet);
            }
                        
            Primitive2DDraw.Add2DPrimitive(lines);

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:Primitive2D.cs

示例10: LoadContent

        /// <summary>
        /// Called once to load content
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            ///load background texture
            tile = factory.GetTexture2D("Textures/tile");

            ///recover the physic world reference
            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///from vertices
            {
                ////creating objects from vertices
                Vertices Vertices = new Vertices(3);                
                Vertices.Add(new Vector2(0,0));
                Vertices.Add(new Vector2(100,0));
                Vertices.Add(new Vector2(0, -100));

                
                ///creating the IModelo (graphic representation)
                SpriteFarseer SpriteFarseer = new SpriteFarseer(factory, Vertices, Color.Green);
                ///The material (how to draw)
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                ///the physic object (physic representation)
                FarseerObject fs = new FarseerObject(fworld, SpriteFarseer, 1, BodyType.Static);
                ///the iobject (that comprises all)
                I2DObject o = new I2DObject(fs, mat, SpriteFarseer);
                ///adding to the world
                this.World.AddObject(o);

            }
            
            ///Creating from factory helper            
            Vertices verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0,250);
                this.World.AddObject(o);
            }

            ///Creating from factory helper            
            verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth, 450);
                this.World.AddObject(o);
            }
                       
            ///creating a circle =P
            CircleShape circle = new CircleShape(50, 1);
            {
                IModelo2D model = new SpriteFarseer(factory, circle, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                Tracked = new I2DObject(fs, mat, model);
                Tracked.PhysicObject.Position = new Vector2(0, -250); /// a middle of the screen + 250 pixels up
                this.World.AddObject(Tracked);
            }
            
            ///when space is pressed, perform the following action
            this.BindInput(new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS,Keys.Space,
                (a) =>
            {
                if (tracking == false)
                {
                    ///enable camera tracking
                    (this.World.Camera2D as Camera2D).TrackingBody = Tracked;
                    (this.World.Camera2D as Camera2D).EnablePositionTracking = true;
                }
                else
                {
                    ///reset the camera (recreating =P)
                    this.World.Camera2D = new Camera2D(GraphicInfo);
                }
                tracking = !tracking;
            }                
                ));

            ///the basic ortographic 2D camera
            this.World.Camera2D = new Camera2D(GraphicInfo);
            base.LoadContent(GraphicInfo, factory, contentManager);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:96,代码来源:Basic2DCameraScreen.cs

示例11: LoadContent

        /// <summary>
        /// Called once to load content
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            ///load background texture
            tile = factory.GetTexture2D("Textures/tile");

            ///recover the physic world reference
            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///from vertices
            {
                ////creating objects from vertices
                Vertices Vertices = new Vertices(3);                
                Vertices.Add(new Vector2(0,0));
                Vertices.Add(new Vector2(100,0));
                Vertices.Add(new Vector2(0, -100));

                
                ///creating the IModelo (graphic representation)
                SpriteFarseer SpriteFarseer = new SpriteFarseer(factory, Vertices, Color.Green);
                ///The material (how to draw)
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                ///the physic object (physic representation)
                FarseerObject fs = new FarseerObject(fworld, SpriteFarseer, 1, BodyType.Static);
                ///the iobject (that comprises all)
                I2DObject o = new I2DObject(fs, mat, SpriteFarseer);
                ///adding to the world
                this.World.AddObject(o);

            }
            
            ///Creating from factory helper            
            Vertices verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(100,450);
                this.World.AddObject(o);
            }

            ///Creating from factory helper            
            verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0, 250);
                this.World.AddObject(o);
            }
                       
            ///creating a circle =P
            CircleShape circle = new CircleShape(50, 1);
            {
                IModelo2D model = new SpriteFarseer(factory, circle, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                goo = new I2DObject(fs, mat, model);
                goo.PhysicObject.Position = new Vector2(0, -150); /// a middle of the screen + 150 pixels up
                this.World.AddObject(goo);
            }

            ///the basic ortographic 2D camera
            this.World.Camera2D = new Camera2D(GraphicInfo);
            base.LoadContent(GraphicInfo, factory, contentManager);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:77,代码来源:Basic2DPositioningScreen.cs

示例12: LoadContent

        //
        //load content for the screen
        //
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            //
            //Setup Statics
            //
            EngineSettings.factory = factory;
            EngineSettings.graphicInfo = GraphicInfo;
            EngineSettings.freeMouse = false;

            Controls.forward = Keys.W;
            Controls.backward = Keys.S;
            Controls.strafeLeft = Keys.A;
            Controls.strafeRight = Keys.D;
            Controls.jump = Keys.Space;
            Controls.crouch = Keys.LeftControl;

            InputStates.omstate = Mouse.GetState ();
            InputStates.okstate = Keyboard.GetState ();

            base.LoadContent (GraphicInfo, factory, contentManager);

            //
            //Create player and player camera
            //
            Player player = new Player (this, new Vector3 (675, 100, 1566), Matrix.Identity,
                new SimpleModel (factory, "Models//objects//people//baseMan", "Models//objects//people//baseManT"), 1.0F, 5.0F, true);
            World.AddObject (player.GetObject ());
            World.CameraManager.AddCamera (player.GetCamera (), "player cam");
            World.CameraManager.SetActiveCamera ("player cam");

            //
            //Setup other graphics
            //
            mouseCursor = factory.GetTexture2D ("Images//mouse//defualt");

            //
            //Create world
            //
            localWorld = new Area (new Vector2 (5));
            //localWorld.SetUpChunkArray (factory, new Vector2 (5, 5));
            //temp = localWorld.GetLoadedChunks ();//localWorld.localWorld;

            //
            //Setup Lights
            //
            #region lights
            DirectionalLightPE ld1 = new DirectionalLightPE (Vector3.Left, Color.White);
            DirectionalLightPE ld2 = new DirectionalLightPE (Vector3.Right, Color.White);
            DirectionalLightPE ld3 = new DirectionalLightPE (Vector3.Backward, Color.White);
            DirectionalLightPE ld4 = new DirectionalLightPE (Vector3.Forward, Color.White);
            DirectionalLightPE ld5 = new DirectionalLightPE (Vector3.Down, Color.White);

            float li = 1F;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;

            this.World.AddLight (ld1);
            this.World.AddLight (ld2);
            this.World.AddLight (ld3);
            this.World.AddLight (ld4);
            this.World.AddLight (ld5);
            #endregion
        }
开发者ID:tubitos,项目名称:1,代码行数:69,代码来源:Level.cs

示例13: LoadContent

        /// <summary>
        /// Called once to load content
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            ///load background texture
            tile = factory.GetTexture2D("Textures/tile");

            //add the 2d primitive draw component
            lines = new Lines();
            Primitive2DDraw.Add2DPrimitive(lines);

            ///recover the physic world reference
            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;
            
            ///Ground 1
            Vertices verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0, 250);
                this.World.AddObject(o);
            }

            ///Ground 2
            verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth, 250);
                this.World.AddObject(o);
            }

            ///Ground 3
            verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Yellow);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 2, 250);
                this.World.AddObject(o);
            }

            ///Support 
            verts = PolygonTools.CreateRectangle(50, 200);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Yellow);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0, 100);
                this.World.AddObject(o);
            }

            ///plataform  1
            verts = PolygonTools.CreateRectangle(50, 200);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.5f, 100);
                this.World.AddObject(o);
            }

            ///plataform  2
            verts = PolygonTools.CreateRectangle(50, 200);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.6f, 100);
                this.World.AddObject(o);
            }

            ///plataform  3
            verts = PolygonTools.CreateRectangle(200, 50);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:Basic2DPhysicScreen.cs

示例14: LoadContent

        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");


            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///border
            border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red));

            ///from texture
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, tex);
                I2DObject o = new I2DObject(fs, mat, model);
                o.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved);
                this.World.AddObject(o);
            }

            ///from texture, scale usage sample
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex, new Vector2(2));
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, tex);
                I2DObject o = new I2DObject(fs, mat, model);
                this.World.AddObject(o);
            }

            ///rectangle
            Vertices verts = PolygonTools.CreateRectangle(5, 5);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, verts);
                I2DObject o = new I2DObject(fs, mat, model);
                this.World.AddObject(o);
            }

            ///circle
            CircleShape circle = new CircleShape(5, 1);
            {
                IModelo2D model = new SpriteFarseer(factory, circle, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();                
                FarseerObject fs = new FarseerObject(fworld, circle);
                I2DObject o = new I2DObject(fs, mat, model);
                this.World.AddObject(o);
            }

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);

            DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null));
            this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

            ///add a post effect =P
            //this.RenderTechnic.AddPostEffect(new WigglePostEffect());

            ///updateable
            JointUpdateable ju = new JointUpdateable(this, fworld, this.World.Camera2D);

            base.LoadContent(GraphicInfo, factory, contentManager);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:66,代码来源:Basic2D.cs

示例15: LoadContent

        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");

            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///border
            border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red));

            ///from texture
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(200, 0);
                this.World.AddObject(o);
            }

            ///from texture, scale usage sample
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex, new Vector2(2));
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved);
                this.World.AddObject(o);
            }

            ///rectangle
            Vertices verts = PolygonTools.CreateRectangle(50, 50);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(-200, 0);
                this.World.AddObject(o);
            }

            ///circle
            CircleShape circle = new CircleShape(50, 1);
            {
                IModelo2D model = new SpriteFarseer(factory, circle , Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(200, -100);
                this.World.AddObject(o);
            }

            ///animated sprite
            {
                Texture2D tex = factory.GetTexture2D("Textures//DudeSheet");
                SpriteAnimated sa = new SpriteAnimated(tex, 8, 2);                
                sa.AddAnimation("ANIM1", 1, 8,0);
                sa.AddAnimation("ANIM2", 2, 4, MathHelper.PiOver2);
                
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                Texture2D frame = factory.GetTexturePart(tex,sa.GetFrameRectangle("ANIM1",0));
                FarseerObject fs = new FarseerObject(fworld, frame);                

                //GhostObject fs = new GhostObject(Vector2.Zero);
                sheet = new I2DObject(fs, mat, sa);
                sheet.PhysicObject.Position = new Vector2(500, 0);
                this.World.AddObject(sheet);
            }

            {
                PointLight2D l = new PointLight2D(new Vector2(-GraphicInfo.BackBufferWidth / 4, -GraphicInfo.BackBufferWidth / 4), Color.Red, 1);
                this.World.AddLight(l);
            }

            {
                SpotLight2D l = new SpotLight2D(new Vector2(+GraphicInfo.BackBufferWidth / 4, -GraphicInfo.BackBufferWidth / 4), Color.Blue, new Vector2(0, 1), MathHelper.ToRadians(45));
                this.World.AddLight(l);
            }
            
            {
            SimpleConcreteKeyboardInputPlayable sc = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS,Keys.Space);
            sc.KeyStateChange+=new KeyStateChange(sc_KeyStateChange);
            this.BindInput(sc);
            }

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);

            DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null));
            this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

            ///add a post effect =P
            //this.RenderTechnic.AddPostEffect(new WigglePostEffect());

            ///updateable
            JointUpdateable ju = new JointUpdateable(this, fworld, this.World.Camera2D);

            base.LoadContent(GraphicInfo, factory, contentManager);
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:Basic2D.cs


注:本文中的PloobsEngine.GetTexture2D方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。