-
Notifications
You must be signed in to change notification settings - Fork 0
/
Frame_Game.cs
49 lines (47 loc) · 1.58 KB
/
Frame_Game.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using LessThanOk.GameData.GameObjects;
using LessThanOk.GameData.GameWorld;
using LessThanOk.GameData.GameObjects.Tiles;
using LessThanOk.GameData.GameObjects.Units;
using LessThanOk.BufferedCommunication;
namespace LessThanOk.UI
{
class Frame_Game : Frame
{
private TileMap _map;
private Rectangle _view;
public Frame_Game(int width, int height)
{
_width = width;
_height = height;
_view = new Rectangle(0, 0, 800, 400);
_elements = new Dictionary<Vector2, UIElement>();
}
public override void draw(SpriteBatch spriteBatch)
{
Boolean success = BlackBoard.getTileMap(out _map);
foreach (UIElement e in Elements.Values)
e.draw(spriteBatch);
foreach (Tile t in _map.getTilesInRect(_view))
t.draw(spriteBatch);
foreach (Tile t in _map.getTilesInRect(_view))
foreach (Unit u in t.InternalUnits)
u.draw(spriteBatch);
}
public override void update(GameTime gameTime)
{
bool success;
//success = BlackBoard.getTileMap(out _map);
}
public ActiveGameObject getObjectAt(Vector2 pos)
{
Boolean success = BlackBoard.getTileMap(out _map);
return _map.getObjectAtPoint(pos);
}
}
}