Example #1
0
 public HealthRenderer(UxContext uxContext)
     : base(uxContext)
 {
     Texture     = uxContext.GetTexture("player-health-bar.png");
     TextureSize = new Size(TEXTURE_WIDTH, TEXTURE_HEIGHT);
     TextureRect = new SDL_Rect()
     {
         x = 0, y = 0, w = TextureSize.Width, h = TextureSize.Height
     };
 }
        public PlayerAnimationProvider(UxContext uxContext, int playerRadius)
        {
            Texture = uxContext.GetTexture("player-texture.png");
            var playerDiameter = playerRadius * 2;

            MaskTexture = Masks.GetCircleMask(playerRadius);
            TextureRect = new SDL_Rect {
                x = 0, y = 0, w = playerDiameter, h = playerDiameter
            };
            OutputSize = new Size(TextureRect.w, TextureRect.h);
            NonRepeatingTextureSize = 64 - TextureRect.w;
        }
Example #3
0
        public RogueskivRenderer(
            UxContext uxContext,
            IGameContext gameContext,
            RogueskivGame game,
            IRogueskivUxConfig uxConfig,
            IRogueskivGameConfig gameConfig
            ) : base(uxContext, game)
        {
            RogueskivGame      = game;
            UxContext          = uxContext;
            UxConfig           = uxConfig;
            PlayerPositionComp = game.Entities.GetSingleComponent <PlayerComp, CurrentPositionComp>();

            var font = uxContext.GetFont(uxConfig.FontFile, FONT_SIZE);

            BoardTexture = uxContext.GetTexture("board.png");

            var bgrRenderer = new BgrRenderer(uxContext, new Size(1920, 1440));

            Renderers.Add(bgrRenderer);
            Renderers.Add(new BoardRenderer(uxContext, game, BoardTexture));

            CompRenderers[typeof(FoodComp)]        = new FoodRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(TorchComp)]       = new TorchRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(MapRevealerComp)] = new MapRevealerRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(AmuletComp)]      = new AmuletRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(EnemyComp)]       = new EnemyRenderer(uxContext, game);
            CompRenderers[typeof(FOVComp)]         = new FOVRenderer(uxContext);
            CompRenderers[typeof(PlayerComp)]      = new PlayerRenderer(uxContext, game, gameConfig.PlayerRadius);
            CompRenderers[typeof(HealthComp)]      = new HealthRenderer(uxContext);
            CompRenderers[typeof(TimerComp)]       = new GameInfoRenderer(
                uxContext,
                gameContext,
                font,
                game.Floor,
                inGameTimeVisible: gameConfig.InGameTimeVisible,
                realTimeVisible: gameConfig.RealTimeVisible
                );
            CompRenderers[typeof(PopUpComp)] = new PopUpRenderer(uxContext, game, font);

            PlayerMovementEffectPlayer = new PlayerMovementEffectPlayer(uxContext, game);
            EffectPlayers.Add(new BounceEffectPlayer(uxContext, game));
            EffectPlayers.Add(new TorchPickedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new MapRevealerPickedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new FoodPickedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new WinEffectPlayer(uxContext, game));
            EffectPlayers.Add(new EnemyCollidedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new StairsUpEffectPlayer(uxContext, game));
            EffectPlayers.Add(new StairsDownEffectPlayer(uxContext, game));
            EffectPlayers.Add(new DeathEffectPlayer(uxContext, game));
        }
Example #4
0
 public BgrRenderer(UxContext uxContext, Size textureSize)
 {
     UxContext   = uxContext;
     Texture     = uxContext.GetTexture("bgr.png");
     TextureSize = textureSize;
 }