Ejemplo n.º 1
0
 public static void DrawRectangle(Vector2 pos, int width, int height, int thickness, Color color)
 {
     PRPGame.Draw(lineTexture, pos, color, new Vector2(width, thickness), 0.0f);
     PRPGame.Draw(lineTexture, pos, color, new Vector2(thickness, height), 0.0f);
     pos.Y += height;
     PRPGame.Draw(lineTexture, pos, color, new Vector2(width, thickness), 0.0f);
     pos.Y -= height;
     pos.X += width;
     PRPGame.Draw(lineTexture, pos, color, new Vector2(thickness, height), 0.0f);
 }
Ejemplo n.º 2
0
 public void Draw(Vector2 screenPos, float scale = 1.0f, bool onTop = false)
 {
     if (sprites != null)
     {
         Rectangle srcRectangle = sprites.walkingAnimation[facing, animIndex];
         float     depth        = 1.0f - (screenPos.Y + srcRectangle.Height) / PRPGame.windowHeight;
         if (onTop)
         {
             depth = 0.0f;
         }
         PRPGame.batch.Draw(sprites.baseSheet, screenPos, srcRectangle, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, depth + .000006f);
         PRPGame.batch.Draw(sprites.eyeSheet, screenPos, srcRectangle, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, depth + 0.000005f);
         PRPGame.batch.Draw(sprites.hairSheet, screenPos, srcRectangle, sprites.hairColor, 0, Vector2.Zero, scale, SpriteEffects.None, depth + .000004f);
         PRPGame.batch.Draw(sprites.shirtSheet, screenPos, srcRectangle, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, depth + .000003f);
         PRPGame.batch.Draw(sprites.pantSheet, screenPos, srcRectangle, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, depth + .000002f);
         PRPGame.batch.Draw(sprites.shoeSheet, screenPos, srcRectangle, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, depth + .000001f);
         if (hello && !onTop)
         {
             PRPGame.DrawString(PRPGame.mainFont, "Hello!", screenPos, Color.White, 0.02f);
         }
     }
 }
Ejemplo n.º 3
0
 static void Main()
 {
     using (var game = new PRPGame())
         game.Run();
 }
Ejemplo n.º 4
0
        public static void Draw()
        {
            int left   = mainRect.Left;
            int right  = mainRect.Right;
            int top    = mainRect.Top;
            int bottom = mainRect.Bottom;

            PRPGame.Draw(tradeBackground, mainRect, .005f);


            int strLen = (int)(PRPGame.mainFont.MeasureString(npc.fullName).X * 1.5f);
            var strPos = new Vector2(320 / 2 + (left + 5) - strLen / 2, top + 25);

            PRPGame.batch.DrawString(PRPGame.mainFont, npc.fullName, strPos, Color.Black, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0.0f);
            npc.Draw(new Vector2(left + 75, top + 25), 2.75f, true);

            left = mainRect.Right - portraitW - 75;

            strLen = (int)(PRPGame.mainFont.MeasureString(player.fullName).X * 1.5f);
            strPos = new Vector2(320 / 2 + (left + 5) - strLen / 2, top + 15);
            PRPGame.batch.DrawString(PRPGame.mainFont, player.fullName, strPos, Color.Black, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0.0f);
            player.facing = CharSprites.DOWN;
            player.Draw(new Vector2(left + 75, top + 25), 2.75f, true);

            left = mainRect.Left + 150;
            top += 215;


            if (column == 0)
            {
                DrawRectangle(new Vector2(left + 4.0f, top + 10.0f + row * 20.0f), 300, 25, 4, Color.SaddleBrown);
            }
            else
            {
                DrawRectangle(new Vector2(left + 4.0f + (w - 600), top + 10.0f + row * 20.0f), 300, 25, 4, Color.SaddleBrown);
            }
            for (int i = 0; i < playerItems.DistinctItemsCount; i++)
            {
                var item       = playerItems[i];
                var diff       = item.qty - PRPGame.player.inventory.ItemQty(item.name);
                var diffString = diff <= 0 ? "" : " +" + diff;
                PRPGame.DrawString(PRPGame.mainFont, item.qty + " " + item.name + diffString, new Vector2(left + 10.0f + (w - 600), top + 10.0f + i * 20.0f), Color.Black, 1.25f, 0.0f);
            }

            for (int i = 0; i < npcItems.DistinctItemsCount; i++)
            {
                var item       = npcItems[i];
                var diff       = item.qty - PRPGame.closestNPC.inventory.ItemQty(item.name);
                var diffString = diff <= 0 ? "" : " +" + diff;
                PRPGame.DrawString(PRPGame.mainFont, item.qty + " " + item.name + " " + diffString, new Vector2(left + 10.0f, top + 10.0f + i * 20.0f), Color.Black, 1.25f, 0.0f);
            }


            strLen = (int)(PRPGame.mainFont.MeasureString(currentNPCWords).X *1.25f);
            Color tradeColor = Color.Black;

            PRPGame.DrawString(PRPGame.mainFont, currentNPCWords, new Vector2(w / 2.0f + mainRect.Left - strLen / 2.0f, mainRect.Top + 75.0f), Color.Black, 1.25f, 0.0f);



#if DEBUG
            string likes = string.Empty;
            foreach (var desire in npc.desires)
            {
                likes += desire.item.name + "(" + desire.level + "," + desire.sufficient + "),";
            }
            PRPGame.batch.DrawString(PRPGame.mainFont, likes, new Vector2(left, bottom - 160), Color.Black);
            PRPGame.batch.DrawString(PRPGame.mainFont, "Before Utility:" + npc.Happiness(), new Vector2(left, bottom - 140), Color.Black);
            PRPGame.batch.DrawString(PRPGame.mainFont, "After Utility:" + npc.Happiness(npcItems), new Vector2(left, bottom - 120), Color.Black);
#endif
        }