-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpriteController.cpp
More file actions
67 lines (47 loc) · 1.37 KB
/
SpriteController.cpp
File metadata and controls
67 lines (47 loc) · 1.37 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* SpriteController.cpp
Robert Kirk DeLisle
28 August 2006
Purpose: Controller to serve as an interface between SpriteModel, SpriteView, and other classes
Modification History:
*/
#if !defined(SpriteController_RKD_28Aug06)
#define SpriteController_RKD_28Aug06
#include "SpriteController.h"
#include <fstream>
SpriteController::SpriteController()
{
/* Purpose: Really just makes the connections
Parameters: none
Return: none
Exceptions:
*/
m_pBrain = 0; //set the brain to null for error checking later
m_View.Connect(&m_Model);
return;
}
void SpriteController::UpdateSpeed(bool loggit)
{
/* Purpose: What direction are we being told to go?? Set speed and state appropriately.
Parameters: none
Return: none
Exceptions:
*/
long state;
long XSpeed, YSpeed;
if ( m_pBrain->GetNextDirection(state, XSpeed, YSpeed, loggit) == 1 )
{
m_Model.SetState(state);
m_Model.SetSpeed(XSpeed, YSpeed);
}
//this block is used to monitor details during different runs for each call to this function
//I commented it out to eliminate an extra comparison every time
// if (loggit)
// {
// fstream lf;
// lf.open("InOut.csv", ios::out|ios::app);
// lf << state << "," << XSpeed << "," << YSpeed << endl;
// lf.close();
// }
return;
}
#endif