-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScreen.cpp
120 lines (102 loc) · 2.74 KB
/
Screen.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include"Screen.h"
namespace screen {
Screen::Screen() {
this->iScreen = new MainScreen();
}
Screen::~Screen() {
delete this->iScreen;
}
void Screen::setScreen(IScreen* screen) {
this->iScreen = screen;
}
void IScreen::exit() {
}
void Screen::updateScreen() {
this->iScreen->update();
}
void Screen::renderScreen(sf::RenderWindow* renderWindow) {
this->iScreen->render(renderWindow);
}
// ////////////////////////////////////////////////////
// MainScreen
// ////////////////////////////////////////////////////
MainScreen::MainScreen() {
}
void MainScreen::update() {
}
void MainScreen::render(sf::RenderWindow* renderWindow) {
this->img = img::ImageFile(this->imgLink + this->fileName, img::FileExtension::PNG, 0.0f, 0.0f, renderWindow);
}
// ////////////////////////////////////////////////////
// Company
// ////////////////////////////////////////////////////
CompanyScreen::CompanyScreen() {
}
// ////////////////////////////////////////////////////
// Stock & Stock Center
// ////////////////////////////////////////////////////
Stock::Stock() {
this->name = "test";
this->currentPrice = 0;
this->openPrice = 0;
this->closePrice = 0;
this->highPrice = 0;
this->lowPrice = 0;
}
Stock::Stock(std::string name, int current, int open, int close, int high, int low) {
this->name = name;
this->currentPrice = current;
this->openPrice = open;
this->closePrice = close;
this->highPrice = high;
this->lowPrice = low;
}
void Stock::setStock(std::string name, int current, int open, int close, int high, int low) {
this->name = name;
this->currentPrice = current;
this->openPrice = open;
this->closePrice = close;
this->highPrice = high;
this->lowPrice = low;
}
std::string Stock::getName() {
return this->name;
}
int Stock::getCurrentPrice() {
return this->currentPrice;
}
int Stock::getOpenPrice() {
return this->openPrice;
}
int Stock::getClosePrice() {
return this->closePrice;
}
int Stock::getHighPrice() {
return this->highPrice;
}
int Stock::getLowPrice() {
return this->lowPrice;
}
StockCenterScreen::StockCenterScreen() {
}
StockCenterScreen::~StockCenterScreen() {
}
void StockCenterScreen::addStock(Stock stock) {
this->stockList.push_back(stock);
}
void StockCenterScreen::deleteStock(std::string name) {
for (std::list<Stock>::iterator itr = this->stockList.begin(); itr != this->stockList.end(); ++itr) {
if ((*itr).getName() == name) {
this->stockList.erase(itr);
itr--;
}
}
}
void StockCenterScreen::exit() {
}
void StockCenterScreen::update() {
}
void StockCenterScreen::render(sf::RenderWindow* renderWindow) {
this->img = img::ImageFile(this->imgLink + this->fileName, img::FileExtension::PNG, 0.0f, 0.0f, renderWindow);
}
}