protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. SpriteBatch = new SpriteBatch(GraphicsDevice); // Load some default fonts. MediumFont = ContentManager.Load <GameFont>("Fonts/MediumFont"); MediumFont.Size = 24; // Load loading icon atlas. LoadingIconSprite = new AnimatedSprite(ContentManager.Load <Texture2D>("Textures/LoadingIconAtlas"), 128, 128, 60); LoadingIconSprite.Pivot = new Vector2(0.5f, 0.5f); // Create the main sprite atlas. SpriteAtlas = new SpriteAtlas(2048, 2048); // Loading missing texture sprite. MissingTextureSprite = SpriteAtlas.Add("Textures/MissingTexture"); MissingTextureSprite.Pivot = new Vector2(0.5f, 1f); // Bottom center. // Temporarily load tiles here. TreeTile = SpriteAtlas.Add("Textures/TileComps/Trees"); MountainTile = SpriteAtlas.Add("Textures/TileComps/Mountain"); TileShadowTopRight = SpriteAtlas.Add("Textures/TileShadowTopRight"); TileShadowTopLeft = SpriteAtlas.Add("Textures/TileShadowTopLeft"); TileShadowBottomRight = SpriteAtlas.Add("Textures/TileShadowBottomRight"); TileShadowBottomLeft = SpriteAtlas.Add("Textures/TileShadowBottomLeft"); HouseTile = SpriteAtlas.Add("Textures/TileComps/House"); // Load definitions. string defPath = Path.Combine(ContentDirectory, "Defs"); DefDatabase = new DefDatabase(); Debug.StartTimer("Load def files"); DefDatabase.AddAllFromDirectory(defPath); Debug.StopTimer(true); Debug.StartTimer("Parse & resolve defs"); DefDatabase.Load(); Debug.StopTimer(true); // Tile loading from defs. Debug.StartTimer("Tile def load"); DefFactory <Tile, TileDef> .Init("Tile"); Debug.StopTimer(true); Debug.StartTimer("Tile comp def load"); DefFactory <TileComponent, TileCompDef> .Init("TileComp"); Debug.StopTimer(true); Debug.StartTimer("Entity comp def load"); DefFactory <Entity, EntityDef> .Init("Entity"); Debug.StopTimer(true); SpriteAtlas.Pack(false); Loop.Start(); }
public override void Execute(App app) { DefFactory factory = new DefFactory(); Translator translator = new Translator(); Pdb pdb = app._pdb; string[] args = app._args; for (int i = 2; i < args.Length; i++) { string symName = PdbSymbol.InternName(args[i]); PdbSymbol symbol = pdb.Find(symName); if (symbol == null) { app.WriteError("can't find symbol: " + symName); continue; } Def def = factory.CreateMixedTypedef(symbol.TranslateBy(translator), symbol.Name); Console.WriteLine(def.Output("", " ")); } }
public static TileComponent Create(ushort defID) { return(DefFactory <TileComponent, TileCompDef> .Create(defID)); }
public static TileComponent Create(string defName) { return(DefFactory <TileComponent, TileCompDef> .Create(defName)); }
public static TileComponent Create(TileCompDef def) { return(DefFactory <TileComponent, TileCompDef> .Create(def)); }
public static Tile Create(string defName) { return(DefFactory <Tile, TileDef> .Create(defName)); }
public static Tile Create(ushort id) { return(DefFactory <Tile, TileDef> .Create(id)); }
public static Tile Create(TileDef def) { return(DefFactory <Tile, TileDef> .Create(def)); }
public static Entity Create(string defName) { return(DefFactory <Entity, EntityDef> .Create(defName)); }
public static Entity Create(ushort id) { return(DefFactory <Entity, EntityDef> .Create(id)); }
public static Entity Create(EntityDef def) { return(DefFactory <Entity, EntityDef> .Create(def)); }