示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            if (OnLoadContent != null)
                OnLoadContent();

            // Create a new SpriteBatch, which can be used to draw textures.
            //spriteBatch = new SpriteBatch(GraphicsDevice);

            GraphicsContext = new XNAGraphicsContext(this.GraphicsDeviceManager, this.Content);
            _gameWorld = new GameWorld(GraphicsContext);
            /*ITexture2D bitmap = GraphicsContext.LoadTexture2D("default");

            _asset = new Static2DRenderableAsset();
            _asset.Texture2D = bitmap;
            //GraphicsContext.SetSceneDimensions(1280, 720);
            _actor = new Actor()
            {
                RenderableAsset = _asset
            };

            Scene s = new Scene();
            s.AddWorldEntity(_actor);
            _gameWorld.AddScene(s);*/

            //rectangle = new Texture2D(GraphicsDevice, 2, 2);
            //rectangle.SetData(new[] { Color.White, Color.Red, Color.Green, Color.Blue });
            // TODO: use this.Content to load your game content here
        }
示例#2
0
 public XNARenderer(XNAGraphicsContext xnaGD)
 {
     _xnaGD = xnaGD;
     InitializeVertices();
 }
示例#3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            if (OnLoadContent != null)
                OnLoadContent();

            // Create a new SpriteBatch, which can be used to draw textures.
            //spriteBatch = new SpriteBatch(GraphicsDevice);
            Content.RootDirectory = "Content";

            GraphicsContext = new XNAGraphicsContext(this.Graphics, this.Content);
            var bitmap = GraphicsContext.LoadTexture2D("Bitmap1");

            _asset = new Static2DRenderableAsset();
            //_asset.SetBoundingBox(new StoryTimeCore.DataStructures.Rectanglef(0, 0.0f, 720, 1280));
            _asset.Texture2D = bitmap;

            var s = new Scene();

            GraphicsContext.SetCamera(s.Camera);

            s.PhysicalWorld = new FarseerPhysicalWorld(Vector2.Zero);
            _actor = s.AddWorldEntity<Actor>();
            _actor.RenderableAsset = _asset;
            _gameWorld = new GameWorld(GraphicsContext);
            _gameWorld.AddScene(s);
            //rectangle = new Texture2D(GraphicsDevice, 2, 2);
            //rectangle.SetData(new[] { Color.White, Color.Red, Color.Green, Color.Blue });
            // TODO: use this.Content to load your game content here
        }