2014年2月9日
摘要: EASY PAK的源代码(在Code Plex上)Easy Pak on CodePlex如果要载入很大数量的文件的时候,使用Easy Pak打包成.pak文件可以通过减少查找时间而显著加快读取速度。但是我发现这个Easy Pak现在有几个bug在PakContentManager下,有几个去扩展名的方法不对string[] GetAssetNames() /// /// Gets an array of the asset names of the content inside the pak file. /// /// An ar... 阅读全文
posted @ 2014-02-09 01:31 The_Fake 阅读(1780) 评论(0) 推荐(0)
  2013年8月3日
摘要: public static Vector2 Perpendicular(Vector2 original) { //To create a perpendicular vector switch X and Y, then make Y negative float x = original.X; float y = original.Y; y = -y; // 或者 x = -x,分别是+pi/2和-pi/2的效果 return new Vector2(... 阅读全文
posted @ 2013-08-03 22:55 The_Fake 阅读(787) 评论(0) 推荐(0)
  2013年7月25日
摘要: #region File Description//-----------------------------------------------------------------------------// CollisionMath.cs//// Microsoft XNA Community Game Platform// Copyright (C) Microsoft Corporation. All rights reserved.//-------------------------------------------------------------------------- 阅读全文
posted @ 2013-07-25 10:10 The_Fake 阅读(276) 评论(0) 推荐(0)
  2013年6月18日
摘要: DotNetZip on CodePlex:http://dotnetzip.codeplex.com/详细的可以看源代码……总之感觉比SharpZipLib好用。而且DotNetZip支持VB,C#以及任何.NET语言。加压:(从CodePlex上偷过来的) using (ZipFile zip = new ZipFile()) { // add this map file into the "images" directory in the zip archive 把这个PNG文件添加到zip档案的"images"目录下 zip.AddFile(&q 阅读全文
posted @ 2013-06-18 23:46 The_Fake 阅读(8997) 评论(2) 推荐(2)
  2013年1月5日
摘要: public class Camera2D { protected float _zoom; // Camera Zoom protected Matrix _transform; // Matrix Transform protected Vector2 _pos; // Camera Position protected float _rotation; // Camera Rotation private const float minZoom = 0.05f; public Camera2D()... 阅读全文
posted @ 2013-01-05 07:09 The_Fake 阅读(421) 评论(0) 推荐(0)
  2012年7月3日
摘要: /// /// This is a game component that implements IUpdateable. /// public class FrameRateCounter : Microsoft.Xna.Framework.DrawableGameComponent { ContentManager content; SpriteBatch spriteBatch; SpriteFont spriteFont; int frameRate = 0; int frameC... 阅读全文
posted @ 2012-07-03 17:57 The_Fake 阅读(870) 评论(0) 推荐(0)
  2012年4月24日
摘要: public static class RectangleExtensions { /// <summary> /// Calculates the signed depth of intersection between two rectangles. /// </summary> /// <returns> /// The amount of overlap between two intersecting rectangles. These /// depth values can be n... 阅读全文
posted @ 2012-04-24 21:51 The_Fake 阅读(171) 评论(0) 推荐(0)
  2012年4月23日
摘要: /// /// Represents a 2D circle. 表示一个2D圆形 /// struct Circle { /// /// Center position of the circle. 圆心 /// public Vector2 Center; /// /// Radius of the circle. 半径 /// public float Radius; /// /// Constructs a n... 阅读全文
posted @ 2012-04-23 22:32 The_Fake 阅读(678) 评论(3) 推荐(0)
  2012年4月22日
摘要: 1 // 先声明一个SoundEffect和一个SoundEffectInstance 2 SoundEffect bgm; 3 SoundEffectInstance bgmInstance; 4 5 6 // 然后在LoadContent中载入背景音乐。在这里用bgm.wav举例 7 protected override void LoadContent() 8 { 9 bgm = Content.Load<SoundEffect>(@"Sounds\bgm");10 bgmInstance = bgm.CreateInstance();11 }12 13 阅读全文
posted @ 2012-04-22 11:12 The_Fake 阅读(544) 评论(0) 推荐(0)