コード例 #1
0
 public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
 {
     base.load(gameScreen, ref cache, layer);
     if (gameScreen.LoadRectangleItem(this))
     {
         _body = BodyFactory.CreateRectangle(gameScreen.World, ConvertUnits.ToSimUnits(Width), ConvertUnits.ToSimUnits(Height), 1f);
         _body.Position = ConvertUnits.ToSimUnits(Position) + new Vector2(ConvertUnits.ToSimUnits(Width) / 2, ConvertUnits.ToSimUnits(Height) / 2);
         _body.UserData = this;
     }
 }
コード例 #2
0
ファイル: CircleItem.cs プロジェクト: nadams810/axiosengine
 public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
 {
     base.load(gameScreen, ref cache, layer);
     if (gameScreen.LoadCircleItem(this))
     {
         _body = BodyFactory.CreateCircle(gameScreen.World, Radius, 1f);
         _body.Position = ConvertUnits.ToSimUnits(Position);
         _body.UserData = this;
     }
 }
コード例 #3
0
ファイル: PathItem.cs プロジェクト: nadams810/axiosengine
        public override void load(AxiosGameScreen gameScreen)
        {
            base.load(gameScreen);

            Vertices v = new Vertices(LayerItem.LocalPoints.Count);
            foreach (Vector2 vec in LayerItem.LocalPoints)
                v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));

            _body = BodyFactory.CreateLoopShape(gameScreen.World, v);
            _body.Position = ConvertUnits.ToSimUnits(this.LayerItem.Position);
            _body.UserData = this;
        }
コード例 #4
0
ファイル: TextureItem.cs プロジェクト: nadams810/axiosengine
        /// <summary>
        /// Called by Level.FromFile(filename) on each Item after the deserialization process.
        /// Loads all assets needed by the TextureItem, especially the Texture2D.
        /// You must provide your own implementation. However, you can rely on all public fields being
        /// filled by the level deserialization process.
        /// </summary>
        public override void load(AxiosGameScreen gameScreen)
        {
            base.load(gameScreen);
            //throw new NotImplementedException();

            //TODO: provide your own implementation of how a TextureItem loads its assets
            //for example:
            //this.texture = Texture2D.FromFile(<GraphicsDevice>, texture_filename);
            //or by using the Content Pipeline:
            /*if (!cache.ContainsKey(LayerItem.AssetName))
            {
                cache[LayerItem.AssetName] = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(LayerItem.AssetName);
            }*/
            this.texture = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(LayerItem.AssetName);
            //Visible = gameScreen.LoadTextureItem(this);

            //this.texture = cm.Load<Texture2D>(asset_name);
        }
コード例 #5
0
ファイル: Level.cs プロジェクト: nadams810/axiosengine
        public static Level FromFile(string filename, AxiosGameScreen gameScreen)
        {
            Dictionary<string, Texture2D> cache = new Dictionary<string, Texture2D>();
            FileStream stream = System.IO.File.Open(filename, FileMode.Open);
            XmlSerializer serializer = new XmlSerializer(typeof(Level));
            Level level = (Level)serializer.Deserialize(stream);
            stream.Close();

            foreach (Layer layer in level.Layers)
            {
                foreach (Item item in layer.Items)
                {
                    item.CustomProperties.RestoreItemAssociations(level);
                    item.load(gameScreen, ref cache, layer);
                }
            }

            return level;
        }
コード例 #6
0
ファイル: AxiosButton.cs プロジェクト: nadams810/axiosengine
        public override void OnMouseUp(AxiosGameScreen gameScreen, InputState input)
        {
            base.OnMouseUp(gameScreen, input);

            this.Texture = _hovertexture;
        }
コード例 #7
0
ファイル: AxiosButton.cs プロジェクト: nadams810/axiosengine
        public override void OnMouseLeave(AxiosGameScreen gameScreen, InputState input)
        {
            base.OnMouseLeave(gameScreen, input);

            this.Texture = _normaltexture;
        }
コード例 #8
0
ファイル: AxiosButton.cs プロジェクト: nadams810/axiosengine
        public override void OnMouseDown(AxiosGameScreen gameScreen, InputState input)
        {
            base.OnMouseDown(gameScreen, input);

            this.Texture = _clicktexture;
        }
コード例 #9
0
ファイル: AxiosButton.cs プロジェクト: nadams810/axiosengine
 public override void LoadContent(AxiosGameScreen gameScreen)
 {
     base.LoadContent(gameScreen);
 }
コード例 #10
0
ファイル: AxiosButton.cs プロジェクト: nadams810/axiosengine
 public override void HandleCursor(AxiosGameScreen gameScreen, InputState input)
 {
     base.HandleCursor(gameScreen, input);
 }
コード例 #11
0
ファイル: Item.cs プロジェクト: nadams810/axiosengine
 /// <summary>
 /// Called by Level.FromFile(filename) on each Item after the deserialization process.
 /// Should be overriden and can be used to load anything needed by the Item (e.g. a texture).
 /// </summary>
 public virtual void load(AxiosGameScreen gameScreen)
 {
 }