예제 #1
0
        public void Initialise(GameLoopEventHandler onUpdate, GameLoopEventHandler onRender, IEntityDataProvider graphicsDataProvider)
        {
            BLT.Open();

            _update = onUpdate;
            _render = onRender;

            var config = $"window: size={Configuration.InitialWidth * TILE_SPACING}x{Configuration.InitialHeight * TILE_SPACING}, cellsize=4x4, title='{Configuration.WindowTitle}'";

            BLT.Set(config);

            BLT.Set("input: precise-mouse=false, filter=[keyboard,mouse+];");

            BLT.Set("text font: Images/Tileset/Andux_sleipnir_8x12_tf.png, codepage=437, size=8x12, spacing=2x3;");
            BLT.Set("textLarge font: Images/Tileset/Andux_sleipnir_8x12_tf.png, codepage=437, size=8x12, resize=16x24, resize-filter=nearest, spacing=4x6;");
            BLT.Set("textXLarge font: Images/Tileset/Andux_sleipnir_8x12_tf.png, codepage=437, size=8x12, resize=32x48, resize-filter=nearest, spacing=8x12;");


            _spriteManager = SetUpSpriteManager(graphicsDataProvider);

            List <IDataRogueControlRenderer> controlRenderers = BLTControlRenderer.DefaultControlRenderers;

            controlRenderers.AddRange(Configuration.AdditionalControlRenderers);

            Renderer = new BLTTilesUnifiedRenderer(controlRenderers, _spriteManager, Configuration);

            BLT.Refresh();
        }
예제 #2
0
        private void LoadSpriteSheetFile(string imageFile, int spriteWidth, int spriteHeight, int scaling, int spacing)
        {
            string configString = $"0x{_offset.ToString("X")}: {imageFile}, size={spriteWidth}x{spriteHeight}, resize={spriteWidth * scaling}x{spriteHeight * scaling}, resize-filter=nearest, spacing={spacing}x{spacing};";
            var    ok           = BLT.Set(configString);

            if (!ok)
            {
                throw new Exception($"BLT wasn't OK with sprite loading (tried to load {imageFile}). Check that the sprite is set to 'Copy Always'.");
            }
        }