Esempio n. 1
0
 private int GetYOffset(GameContainer gc)
 {
     if (this.centeredOn != null)
     {
         return((gc.GetHeight() - this.centeredOn.GetHeight()) / 2 - this.centeredOn.GetY());
     }
     return(0);
 }
Esempio n. 2
0
 private int GetXOffset(GameContainer gc)
 {
     if (this.centeredOn != null)
     {
         return((gc.GetWidth() - this.centeredOn.GetWidth()) / 2 - this.centeredOn.GetX());
     }
     return(0);
 }
Esempio n. 3
0
        //public void setRenderOrder(Class<? extends Actor>...actorClasses)
        //{
        //    this.renderOrder = actorClasses;
        //}

        public void Render(GameContainer gc)
        {
            //graphics.drawString("Current game state: " + String.valueOf(ID), 10, 30);
            if (this.centeredOn != null)
            {
                throw new NotImplementedException();
                //graphics.translate(getXOffset(gc), getYOffset(gc));
            }
            RenderMap();
            if (this.debugGraphics)
            {
                //graphics.setColor(org.newdawn.slick.Color.green);

                int width  = this.tiledMap.Width;
                int height = this.tiledMap.Height;
                for (int x = 0; x < width; x++)
                {
                    for (int y = 0; y < height; y++)
                    {
                        if (IsWall(x, y))
                        {
                            throw new NotImplementedException();
                            //graphics.fillRect(x * this.tiledMap.getTileWidth(), y * this.tiledMap.getTileHeight(), this.tiledMap.getTileWidth(), this.tiledMap.getTileHeight());
                        }
                    }
                }
            }
            RenderActors(this.actors);
            RenderActors(this.triggers);
            if (this.centeredOn != null)
            {
                //graphics.translate(-GetXOffset(gc), -getYOffset(gc));
                throw new NotImplementedException();
            }
            RenderInventory(gc);

            RenderMessage();
        }
Esempio n. 4
0
        //    private void renderActorsOfType(Graphics graphics, Class<? extends Actor> type)
        //{
        //    for (Actor actor : this.actors) {
        //    if (type.isInstance(actor))
        //    {
        //        Animation animation = actor.getAnimation();
        //        if (animation != null)
        //        {
        //            animation.draw(actor.getX(), actor.getY());
        //        }
        //        else
        //        {
        //            throw new IllegalStateException("Animation missing for" + actor.getClass().getName());
        //        }
        //    }
        //}
        //    }

        private void RenderInventory(GameContainer gc)
        {
            int x;

            if (this.inventory != null)
            {
                x = 4;


                throw new NotImplementedException();
                //graphics.setColor(Color.BLACK);
                //graphics.fillRect(0.0F, gc.GetHeight() - 24, gc.GetWidth(), gc.GetHeight());
                foreach (Item item in this.inventory)
                {
                    item.GetAnimation().Draw(x, gc.GetHeight() - 20, 16, 16);
                    x += item.GetWidth() + 4;
                }

                //graphics.setColor(color);
                //        }
                //    }
            }
        }