Esempio n. 1
0
        public RootView(Game.Game game, InputResolver inputResolver, MapView mapView, SidebarView sidebarView, TargetingView targetingView)
        {
            Game          = game;
            InputResolver = inputResolver;
            MapView       = mapView;
            SidebarView   = sidebarView;
            TargetingView = targetingView;

            var cellSizeX = 4;
            var cellSizeY = 4;

            var cellWidth  = 128 * cellSizeX;
            var cellHeight = 64 * cellSizeY;

            var mapFontId       = "map";
            var mapFontSizeX    = 24;
            var mapFontSizeY    = 24;
            var mapFontSpacingX = mapFontSizeX / cellSizeX;
            var mapFontSpacingY = mapFontSizeY / cellSizeY;

            var textFontId       = "";
            var textFontSizeX    = 12;
            var textFontSizeY    = 24;
            var textFontSpacingX = textFontSizeX / cellSizeX;
            var textFontSpacingY = textFontSizeY / cellSizeY;

            Terminal.Open();
            Terminal.Set($"window: title='road trip', resizeable=true, size={cellWidth}x{cellHeight}, cellsize={cellSizeX}x{cellSizeY};");
            Terminal.Set($"font: ./Cascadia.ttf, size={textFontSizeX}x{textFontSizeY}, spacing={textFontSpacingX}x{textFontSpacingY}");
            Terminal.Set($"{mapFontId} font: ./Cascadia.ttf, size={mapFontSizeX}x{mapFontSizeY}, spacing={mapFontSpacingX}x{mapFontSpacingY}");
            //Terminal.Set("font: ./Topaz-8.ttf, size=16x16");
            //Terminal.Set("font: ./square.ttf, size=16x16");
            //Terminal.Set("font: ./whitrabt.ttf, size=16");
            Terminal.Set("output: vsync=false;");

            MapView.Font     = mapFontId;
            MapView.SpacingX = mapFontSpacingX;
            MapView.SpacingY = mapFontSpacingY;

            SidebarView.SpacingX = textFontSpacingX;
            SidebarView.SpacingY = textFontSpacingY;

            TargetingView.SpacingX = textFontSpacingX;
            TargetingView.SpacingY = textFontSpacingY;

            Resize();

            Game.Setup();
            Game.Tick();

            RunStateStack.Push(RunState.AwaitingInput);
        }