-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
219 lines (139 loc) · 3.56 KB
/
Copy pathMain.cpp
File metadata and controls
219 lines (139 loc) · 3.56 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// basic
#include "BaseHeader.h"
#include "connection.cpp"
#include "temp_functions.h"
#include "graphical_functions.h"
#include "Listen.h"
#include "Scenes.h"
#include "Entity_Manager.h"
#include "Systems.h"
using namespace sf;
RenderWindow window(VideoMode(1200, 800, 32), "Sech0");
Event event;
sf::TcpListener listener;
sf::Font my_font;
Text test;
text_manager Text_manager;
Entity_manager E_Manager;
Sys_mouse MOUSE;
int GLOBAL_FOCUS = 1;
communication_struct send_recieve;
int main()
{
std::string *WORDS = new std::string;
std::string* inbound = new std::string;
int * messaged = new int;
*inbound = " ";
sf::Font* font_pointer = &my_font;
my_font.loadFromFile("PerfectDOSVGA437.ttf");
test.setFont(my_font);
test.setString("ASCII will ALways Be CooL");
/*
if (inputers == 1)
{
if (listener.listen(53000) != sf::Socket::Done)
{
std::cout << "ERROR FOR CONNECTION" << std::endl;
};
if (listener.accept(client) != sf::Socket::Done)
{
std::cout << "Connection rejected" << std::endl;
}
else
{
if (sent == 0)
{
if (client.send(data, 100) != sf::Socket::Done)
{
// error...
}
else
{
sent = 1;
};
};
};
if (client.receive(data, 100, received) != sf::Socket::Done)
{
// error...
}
std::cout << "\n\n " << data << " \n End Message" << std::endl;
}
if (inputers != 1)
{
// try to connect to the other guy
sf::TcpSocket socket;
sf::Socket::Status status = socket.connect("192.168.1.176", 53000);
if (status != sf::Socket::Done)
{
// error...
}
else
{
//std::cout << "CONNECTION AQUIRED SIDE 1" << std::endl;
if (sent == 0)
{
if (socket.send(data, 100) != sf::Socket::Done)
{
// error...
}
else
{
sent = 1;
};
};
};
if (socket.receive(data, 100, received) != sf::Socket::Done)
{
// error...
}
std::cout << "\n\n " << data << " \n End Message" << std::endl;
};
*/
std::cout << "AFTER" << std::endl;
positioner kewl;
kewl.x = 0;
kewl.y = 750;
positioner sugma;
sugma.x = 450;
sugma.y = 450;
std::string wr = " ";
Text_manager.add_text(kewl,sf::Color::Red, wr, my_font);
Text_manager.add_text(sugma, sf::Color::Green, wr, my_font);
/// ABOVE IS TEST STUFFS
char recent = NULL;
// main program starts here
// communicate, inputers, client, sent, data[100], received, listener
/// start here
std::thread thread_obj(communicate , WORDS, messaged, inbound);
while (window.isOpen())
{
// get the user's input
// if they have hit enter
// set sending to 0
while (window.pollEvent(event))
{
user_input(event, *Text_manager.Text_list[0], recent, WORDS);
// catch_recent(event, recent);
// "close requested" event: we close the window
if (event.type == sf::Event::Closed) {
window.close();
};
catch_recent(event, Text_manager, WORDS, messaged);
}
// here send the data
window.clear(Color::Black);
Text_manager.Text_list[1]->setString(*inbound);
Text_manager.Text_list[0]->setString(*WORDS);
// stuff below you must turn into a function that users complete on luanch and make the
// message sending a funct
// communicate();
display_text(Text_manager,window);
// rainbow_power(Text_manager, window);
window.display();
// graphics update
// input update
// System update
};
return 0;
};