Exemplo n.º 1
0
        private static void OnIntroRender(object sender, UpdateEventArgs e)
        {
            if (_renderRequired)
            {
                _rootConsole.Clear();

                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 7, (int)(_rootConsole.Height * 0.25) - 4,
                                   "\xDA\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xBF", IntroColor // Swatch.DbBlood
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 7, (int)(_rootConsole.Height * 0.25) - 3,
                                   "\xB3  RL GAME  \xB3", IntroColor
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 7, (int)(_rootConsole.Height * 0.25) - 2,
                                   "\xB3           \xB3", IntroColor
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 7, (int)(_rootConsole.Height * 0.25) - 1,
                                   "\xB3   ALPHA   \xB3", IntroColor
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 7, (int)(_rootConsole.Height * 0.25),
                                   "\xC0\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xD9", IntroColor
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 6, (int)(_rootConsole.Height * 0.5) + 2,
                                   "N - New Game", Swatch.DbSun
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 6, (int)(_rootConsole.Height * 0.5) + 4,
                                   "L - Lore", Swatch.DbSun
                                   );
                _rootConsole.Print((int)(_rootConsole.Width * 0.5) - 6, (int)(_rootConsole.Height * 0.5) + 6,
                                   "E - Exit Game", Swatch.DbBlood
                                   );
                _rootConsole.Draw();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     This is the render event handler which is where we handle the respective render methods,
        ///     that need to be running.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void rootConsole_Render(object sender, UpdateEventArgs e)
        {
            _rootConsole.Clear();
            switch (Menu.currMenu)
            {
            case "main":
                Menu.mainRender(_rootConsole);
                break;

            case "multi":
                Menu.multiRender(_rootConsole);
                break;

            case "enterDets":
                Menu.enterDetsRender(_rootConsole);
                break;

            case "game":
                _spEngine?.render();
                _mpEngine?.Render();
                _lobby?.Render();
                break;
            }


            _rootConsole.Draw();
        }
Exemplo n.º 3
0
        static void rootConsole_Render(object sender, UpdateEventArgs e)
        {
            RootConsole.Clear();
            // Test GoRogue
            Coord c = Coord.Get(1, 1);

            RootConsole.Print(c.X, c.Y, "Hello World!", RLColor.White);
            RootConsole.Draw();
        }
Exemplo n.º 4
0
 static void RootConsoleRender(object sender, EventArgs e)
 {
     if (MainGraphicDisplay.IsDirty)
     {
         rootConsole.Clear();
         rootConsole = MainGraphicDisplay.CopyDisplayToRootConsole(rootConsole);
         rootConsole.Draw();
     }
 }
Exemplo n.º 5
0
 private static void OnMenuRender(object sender, UpdateEventArgs e)
 {
     if (renderRequired == true)
     {
         rootConsole.Clear();
         RLConsole.Blit(menuConsole, 0, 0, menuConsole.Width, menuConsole.Height, rootConsole, 0, 0);
         rootConsole.Draw();
         renderRequired = false;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// The rendering engine for the splash screen.
 /// </summary>
 private void OnSplashRender(object sender, UpdateEventArgs e)
 {
     // Don't bother redrawing all of the consoles if nothing has changed.
     if (_renderRequired)
     {
         console.Clear();
         // Set up the splash by placing characters on (x, y) locations
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.25) - 4,
             "============",
             Colors.DbGrass
             );
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.25) - 3,
             "|          |",
             Colors.DbVegetation
             );
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.25) - 2,
             "| L.O.R.S. |",
             Colors.Text
             );
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.25) - 1,
             "|          |",
             Colors.DbVegetation
             );
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.25),
             "============",
             Colors.DbGrass
             );
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.5) + 2,
             "N - New Game",
             Colors.DbSun
             );
         console.Print(
             (int)(console.Width * 0.5) - 6,
             (int)(console.Height * 0.5) + 4,
             "E - Exit Game",
             Colors.DbBlood
             );
         // Tell RLNET to draw the console that we set
         console.Draw();
     }
 }
Exemplo n.º 7
0
 public void RenderDirtyCells(RLRootConsole console)
 {
     console.Clear();
     foreach (VisibleCell cell in _visibleCells)
     {
         if (VisibleLayers.Contains(cell.Layer))
         {
             console.Set(cell.X, cell.Y, cell.Color, cell.BackColor, cell.Character.Code);
         }
     }
     console.Draw();
 }
Exemplo n.º 8
0
        private static void rootConsole_Render(object sender, UpdateEventArgs e)
        {
            rootConsole.Clear();
            Point p = new Point(0, 0);

            for (p.Y = 0; p.Y < problem.Map.Height; p.Y++)
            {
                for (p.X = 0; p.X < problem.Map.Width; p.X++)
                {
                    var value = problem.Map.CellAt(p);
                    if (value != Map.CellType.Wrapped)
                    {
                        rootConsole.SetChar(p, (char)value);
                        if (value == Map.CellType.Wall)
                        {
                            rootConsole.SetColor(p, RLColor.LightGray);
                        }
                    }
                    else
                    {
                        rootConsole.SetChar(p, ' ');
                        rootConsole.SetBackColor(p, RLColor.Yellow);
                    }
                }
            }

            foreach (var r in problem.Robots)
            {
                rootConsole.SetChar(r.Position, 'R');
                rootConsole.SetColor(r.Position, RLColor.Cyan);

                if (r.Targets != null)
                {
                    foreach (var t in r.Targets)
                    {
                        rootConsole.SetBackColor(t, RLColor.Red);
                    }
                }

                if (r.Target.HasValue)
                {
                    rootConsole.SetBackColor(r.Target.Value, RLColor.Blue);
                }

                foreach (var arm in r.Arms)
                {
                    rootConsole.SetBackColor(r.Position.Translate(arm), RLColor.LightGreen);
                }
            }

            rootConsole.Draw();
        }
Exemplo n.º 9
0
        private void Render(object sender, UpdateEventArgs e)
        {
            _rootConsole.Clear();

            foreach (var tile in _map.GetAllCells())
            {
                if (InRenderDistance(tile))
                {
                    _rootConsole.Set(tile.X, tile.Y, RLColor.LightGray, null, (tile.IsWalkable ? '.' : '#'));
                }
            }

            _rootConsole.Set(_player.X, _player.Y, _player.Color, null, Player.Icon);

            _rootConsole.Draw();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Render game to console
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Render(object sender, UpdateEventArgs e)
        {
            rootConsole.Clear();

            foreach (var tile in game.Map.Tiles)
            {
                tile.Draw(rootConsole);
            }

            foreach (var obj in game.Objects)
            {
                obj.Draw(rootConsole);
            }

            rootConsole.Draw();
        }
Exemplo n.º 11
0
        static void rootConsole_Render(object sender, UpdateEventArgs e)
        {
            rootConsole.Clear();

            rootConsole.Print(1, 1, "Hello World!", RLColor.White);

            rootConsole.SetChar(playerX, playerY, '@');

            int color = 1;

            if (rootConsole.Mouse.LeftPressed)
            {
                color = 4;
            }
            rootConsole.SetBackColor(rootConsole.Mouse.X, rootConsole.Mouse.Y, RLColor.CGA[color]);

            rootConsole.Draw();
        }
Exemplo n.º 12
0
        // Event handler for RLNET's Render event
        private static void OnRootConsoleRender(object sender, UpdateEventArgs e)
        {
            _rootConsole.Clear();

            // Use RogueSharp to calculate the current field-of-view for the player
            _map.ComputeFov(_playerX, _playerY, 50, true);

            foreach (var cell in _map.GetAllCells())
            {
                // When a Cell is in the field-of-view set it to a brighter color
                if (cell.IsInFov)
                {
                    _map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                    if (cell.IsWalkable)
                    {
                        _rootConsole.Set(cell.X, cell.Y, RLColor.Gray, null, '.');
                    }
                    else
                    {
                        _rootConsole.Set(cell.X, cell.Y, RLColor.LightGray, null, '#');
                    }
                }
                // If the Cell is not in the field-of-view but has been explored set it darker
                else if (cell.IsExplored)
                {
                    if (cell.IsWalkable)
                    {
                        _rootConsole.Set(cell.X, cell.Y, new RLColor(30, 30, 30), null, '.');
                    }
                    else
                    {
                        _rootConsole.Set(cell.X, cell.Y, RLColor.Gray, null, '#');
                    }
                }
            }

            // Set the player's symbol after the map symbol to make sure it is draw
            _rootConsole.Set(_playerX, _playerY, RLColor.LightGreen, null, '@');

            // Tell RLNET to draw the console that we set
            _rootConsole.Draw();
        }
Exemplo n.º 13
0
        private static void rootConsole_Render(object sender, UpdateEventArgs e)
        {
            rootConsole.Clear();
            map.ComputeFov(_playerX, _playerY, 50, true);

            foreach (var cell in map.GetAllCells())
            {
                if (!cell.IsInFov)
                {
                    map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                    switch (_map[cell.X, cell.Y])
                    {
                    case Tile.Floor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.Gray); break;

                    case Tile.RoomFloor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.White); break;

                    case Tile.Wall: rootConsole.Print(cell.X, cell.Y, "#", RLColor.LightGray); break;

                    case Tile.Door: rootConsole.Print(cell.X, cell.Y, "+", RLColor.Brown); break;
                    }
                }
                else if (cell.IsExplored)
                {
                    switch (_map[cell.X, cell.Y])
                    {
                    case Tile.Floor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.Blend(RLColor.Gray, RLColor.Black)); break;

                    case Tile.RoomFloor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.Blend(RLColor.White, RLColor.Black)); break;

                    case Tile.Wall: rootConsole.Print(cell.X, cell.Y, "#", RLColor.Blend(RLColor.LightGray, RLColor.Black)); break;

                    case Tile.Door: rootConsole.Print(cell.X, cell.Y, "+", RLColor.Blend(RLColor.Brown, RLColor.Black)); break;
                    }
                }
            }
            rootConsole.Print(_playerX, _playerY, "@", RLColor.LightGreen);
            rootConsole.Draw();
        }
Exemplo n.º 14
0
 public SPEngine(RLRootConsole rootConsole)
 {
     player           = new Player(new Vector2(0, 0), '@', 100, "Tom", this);
     this.rootConsole = rootConsole;
     MapGenerate();
     do
     {
         rootConsole.Clear();
         MapConsole.Clear();
         MapConsole.Print(0, 0, "Loading Map", RLColor.White);
         RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10);
         rootConsole.Draw();
         Thread.Sleep(200);
         MapConsole.Print(0, 0, "Loading Map.", RLColor.White);
         RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10);
         rootConsole.Draw();
         Thread.Sleep(200);
         MapConsole.Print(0, 0, "Loading Map..", RLColor.White);
         RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10);
         rootConsole.Draw();
         Thread.Sleep(200);
         MapConsole.Print(0, 0, "Loading Map...", RLColor.White);
         RLConsole.Blit(MapConsole, 0, 0, 70, 50, rootConsole, 0, 10);
         rootConsole.Draw();
     } while(mapLoadDone == false);
     inv  = new Inventory(InvConsole);
     side = new SidePanel(SideConsole, player, 21, 96, this);
     TickTimer.Elapsed += new ElapsedEventHandler(OnTick);
     TickTimer.Interval = 200;
     TickTimer.Enabled  = true;
     AddMonsters();
     player.pos = map.findPPos();
     entityList.Add(player);
     ConstructGrid();
     ShadowCast.ComputeVisibility(map.grid, player.pos, 7.5f, player.name);
     inv.items.Add(new Weapon((char)234, 300, 4));
 }
Exemplo n.º 15
0
 // Event handler for RLNET's Render event
 // TODO: Have a "Should re-render" - in theory, unsure if drawing every time actually hurts perf
 private static void OnRootConsoleRender(object sender, UpdateEventArgs e)
 {
     _rootConsole.Clear();
     _currentDisplay.Blit(_rootConsole);
     _rootConsole.Draw();
 }
Exemplo n.º 16
0
        // Event handler for RLNET's Render event
        private static void OnRootConsoleRender(object sender, UpdateEventArgs e)
        {
            DateTime _currentTime = DateTime.Now;

            if (!_gameOver && _time.AddMilliseconds(160) < _currentTime)
            {
                _renderRequired = true;
                _nextAnimation  = true;
                _time           = _currentTime;
            }
            if (_renderRequired && !_gameOver)
            {
                _rootConsole.Clear();
                _mapConsole.Clear();
                _statConsole.Clear();
                _messageConsole.Clear();
                _inventoryConsole.Clear();

                Point mapBlitOrigin = GetMapBlitOrigin();

                _statConsole.SetBackColor(0, 0, _statWidth, _statHeight, Colors.Alternate);
                _messageConsole.SetBackColor(0, 0, _messageWidth, _messageHeight, Colors.Secondary);
                if (_mapLevel == 1)
                {
                    _mapConsole.SetBackColor(mapBlitOrigin.X, mapBlitOrigin.Y, _onConsoleMapWidth, _onConsoleMapHeight, RLColor.Black);
                }
                else
                {
                    for (int i = 0; i < _onConsoleMapHeight; i++)
                    {
                        _mapConsole.SetBackColor(mapBlitOrigin.X, mapBlitOrigin.Y + i, _onConsoleMapWidth, 1, RLColor.Blend(Colors.gradient1, Colors.gradient2, 1f - i / (_onConsoleMapHeight - 1f)));
                    }
                }
                _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Colors.Compliment);
                _inventoryConsole.Print(1, 1, "Inventaire", RLColor.White);

                Map.Draw(_mapConsole, _statConsole, _nextAnimation);
                Player.Draw(_mapConsole, Map, _nextAnimation);
                MessageLog.Draw(_messageConsole);
                Player.DrawStats(_statConsole);
                Inventory.DrawWithEffect(_inventoryConsole, _mapConsole);

                ICell cell = Map.GetCell(Player.X, Player.Y);

                Point mousePos = GetMousePosOnMap();
                if (Map.IsInFov(mousePos.X, mousePos.Y) && Map.GetMonsterAt(mousePos.X, mousePos.Y) != null)
                {
                    CellSelection.DrawPath(Player.Coord, mousePos, _mapConsole);
                    _mapConsole.SetBackColor(mousePos.X, mousePos.Y, Colors.AlternateDarker);
                }

                _renderRequired = CellSelection.ShockWaveEffect(_mapConsole);
                _nextAnimation  = false;

                if (Map is InvertedMap invertedMap)
                {
                    _mapConsole   = invertedMap.InvertMap(_mapConsole);
                    mapBlitOrigin = new Point(_mapWidth - mapBlitOrigin.X - _onConsoleMapWidth, _mapHeight - mapBlitOrigin.Y - _onConsoleMapHeight);
                }

                // Blit the sub consoles to the root console in the correct locations
                RLConsole.Blit(_mapConsole, mapBlitOrigin.X, mapBlitOrigin.Y, _onConsoleMapWidth, _onConsoleMapHeight, _rootConsole, 0, _inventoryHeight);
                RLConsole.Blit(_statConsole, 0, 0, _statWidth, _statHeight, _rootConsole, _onConsoleMapWidth, 0);
                RLConsole.Blit(_messageConsole, 0, 0, _messageWidth, _messageHeight, _rootConsole, 0, _screenHeight - _messageHeight);
                RLConsole.Blit(_inventoryConsole, 0, 0, _inventoryWidth, _inventoryHeight, _rootConsole, 0, 0);

                // Tell RLNET to draw the console that we set
                _rootConsole.Draw();
            }
            else if (_gameOver)
            {
                _UIConsole.Clear();
                _UIConsole.SetBackColor(0, 0, _screenWidth, _screenHeight, Colors.ComplimentLighter);
                menu.Draw(_UIConsole, GetMousePos());
                RLConsole.Blit(_UIConsole, 0, 0, _UIWidth, _UIHeight, _rootConsole, 0, 0);
                _rootConsole.Draw();
            }
        }
Exemplo n.º 17
0
        private static void OnRootConsoleRender(object sender, UpdateEventArgs e)
        {
            _rootConsole.Clear();

            foreach (ICelestialObject ce in _currentSectorMap.CelestialObjects)
            {
                Cell cell = _currentSectorMap.SectorMap.GetCell(ce.X, ce.Y);
                _currentSectorMap.SectorMap.SetCellProperties(ce.X, ce.Y, false, false, cell.IsExplored);
            }

            _currentSectorMap.SectorMap.ComputeFov(Player.X, Player.Y, Player.SensorRange, true);

            foreach (var cell in _currentSectorMap.SectorMap.GetAllCells())
            {
                if (cell.IsInFov)
                {
                    _currentSectorMap.SectorMap.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                    if (cell.IsWalkable)
                    {
                        _rootConsole.Set(cell.X, cell.Y, RLColor.Gray, null, '.');
                    }
                    else
                    {
                        _rootConsole.Set(cell.X, cell.Y, RLColor.LightGray, null, ' ');
                        foreach (ICelestialObject ce in _currentSectorMap.CelestialObjects)
                        {
                            if (ce.X == cell.X && ce.Y == cell.Y)
                            {
                                _rootConsole.Set(ce.X, ce.Y, ce.Color, null, ce.Symbol);
                            }
                        }
                    }
                }
                else if (cell.IsExplored)
                {
                    if (cell.IsWalkable)
                    {
                        _rootConsole.Set(cell.X, cell.Y, new RLColor(30, 30, 30), null, '.');
                    }
                    else
                    {
                        _rootConsole.Set(cell.X, cell.Y, RLColor.Gray, null, ' ');
                        foreach (ICelestialObject ce in _currentSectorMap.CelestialObjects)
                        {
                            if (ce.X == cell.X && ce.Y == cell.Y)
                            {
                                _rootConsole.Set(ce.X, ce.Y, new RLColor(30, 30, 30), null, ce.Symbol);
                            }
                        }
                    }
                }
            }

            // Set the player's symbol after the map symbol to make sure it is draw
            _rootConsole.Set(Player.X, Player.Y, RLColor.LightGreen, null, '@');

            _rootConsole.Print(77, 1, "SpaceRL", RLColor.White);
            _rootConsole.Print(77, 3, "ShipName:", RLColor.White);
            _rootConsole.Print(78, 4, "Location : " + _currentSectorMap.Name, RLColor.White);
            _rootConsole.Print(78, 5, "Sensor Strength : " + Player.SensorRange, RLColor.White);
            _rootConsole.Print(78, 6, "Fuel : " + Player.Fuel + " / " + Player.MaxFuel, RLColor.White);
            _rootConsole.Print(78, 7, "Fuel Probes : " + Player.FuelProbes, RLColor.White);
            _rootConsole.Print(78, 8, "Cargo : " + Player.CargoHold + " / " + Player.CargoHoldMax, RLColor.White);
            _rootConsole.Print(78, 9, "Credits : " + Player.Credits, RLColor.White);
            _rootConsole.Print(78, 12, "Score : " + Player.Score, RLColor.Green);

            _rootConsole.Print(77, 40, _statusText, RLColor.Red);

            //Á : bottom-T
            //Â : top-T
            //Ã : left-T
            //Å : +

            //¿ : topright
            //Ù : bottomright

            //Ú : topleft
            //À : bottomleft

            //Ä : horizontal
            //³ : vertical

            DrawViewscreen();
            DrawShipLog();

            if (ActiveMenu)
            {
                PopupMenu.DrawMenu(_rootConsole);
            }

            _rootConsole.Draw();
        }