-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebugView.cpp
45 lines (37 loc) · 929 Bytes
/
DebugView.cpp
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
//
// DebugView.cpp
// TankGame
//
// Created by Jacob Gonzalez on 11/04/2015.
// Copyright (c) 2015 Jacob Gonzalez. All rights reserved.
//
#include "DebugView.h"
#include "ConsoleTools.h"
// : init static shared instance of debugview
DebugView *DebugView::_shared_view = 0;
typedef std::map<std::string, float>::iterator map_iter;
void DebugView::watch(std::string key, float value)
{
_deb_map[key] = value;
}
void DebugView::update(int t)
{
View::update(t);
}
void DebugView::draw()
{
// don't draw if not in debug mode
if (show == false)
{
return;
}
ConsoleTools::set_bcolor(ConsoleTools::magneta);
int i = 0;
for (map_iter it = _deb_map.begin(); it != _deb_map.end(); ++it)
{
ConsoleTools::set_cursor(_position.x, _position.y + i++);
printf("%s\t:\t%0.3f\n", it->first.c_str(), it->second);
}
ConsoleTools::end_color();
View::draw();
}