コード例 #1
0
ファイル: World.cs プロジェクト: bobtwinkles/Defence
 public World(HeightMap Terrain, PlayerEntity pe)
 {
     _terrain = Terrain;
     _pe = pe;
     _ents = new LinkedList<IEntity>();
     _ents.AddFirst(pe);
     _buggersKilled = 0;
 }
コード例 #2
0
ファイル: PlayState.cs プロジェクト: bobtwinkles/Defence
 public void Init(MainClass Main)
 {
     //XXX:Make this better...
     _in = Main;
     //Game world setup.
     HeightMap map = new HeightMap("res/map.map");
     _pe = new PlayerEntity(new Vector3(0, map [0, 0] + 10, 0));
     _world = new World(map, _pe);
     //GFX setup
     _camOffset = new Vector3();
     _ren = new WorldRenderer(Main, _world, (float)Main.Width / Main.Height);
     GL.ClearColor(OpenTK.Graphics.Color4.SkyBlue);
     GL.Enable(EnableCap.DepthTest);
     GL.Enable(EnableCap.Fog);
     float[] fogColor = {
         OpenTK.Graphics.Color4.SkyBlue.R,
         OpenTK.Graphics.Color4.SkyBlue.G,
         OpenTK.Graphics.Color4.SkyBlue.B,
         OpenTK.Graphics.Color4.SkyBlue.A
     };
     GL.Fog(FogParameter.FogColor, fogColor);
     GL.Fog(FogParameter.FogEnd, WorldRenderer.MAX_DEPTH);
     GL.Fog(FogParameter.FogStart, 10f);
     //Input setup.
     System.Windows.Forms.Cursor.Hide();
     Main.Mouse.ButtonDown += ButtonDown;
     Main.Mouse.ButtonUp += ButtonUp;
     Main.Mouse.Move += MouseMove;
     //2D draw setup
     _rects = new LinkedList<Rect2D>();
     _healthbar = new Bitmap(100, 50);
     _healthbarRect = new Rect2D(_healthbar, 0, 0, 100, 50);
     _rects.AddFirst(_healthbarRect);
     //INput setup
     _in.MouseCaptureNeeded = true;
     _in.CaptureMouse = true;
 }