|
@@ -2,22 +2,23 @@
|
|
#include "common/network/Packets.h"
|
|
#include "common/network/Packets.h"
|
|
#include "gaming-core/utils/Utils.h"
|
|
#include "gaming-core/utils/Utils.h"
|
|
|
|
|
|
-Game::Game(TextInput& textInput, const Controller& controller, const Clock& fps,
|
|
|
|
- const Clock& tps, RenderSettings& settings, const Size& size,
|
|
|
|
- Client& client)
|
|
|
|
- : textInput(textInput), controller(controller), fps(fps), tps(tps),
|
|
|
|
- renderSettings(settings), size(size), client(client), state(State::START),
|
|
|
|
|
|
+Game::Game(TextInput*& textInput, const Controller& controller,
|
|
|
|
+ const Clock& fps, const Clock& tps, RenderSettings& settings,
|
|
|
|
+ const Size& size, Client& client)
|
|
|
|
+ : controller(controller), fps(fps), tps(tps), renderSettings(settings),
|
|
|
|
+ size(size), client(client), state(State::START),
|
|
baseGUI(size, textInput, controller), startGUI(baseGUI),
|
|
baseGUI(size, textInput, controller), startGUI(baseGUI),
|
|
world(blockRegistry), worldRenderer(world), connected(false) {
|
|
world(blockRegistry), worldRenderer(world), connected(false) {
|
|
pos = Vector3(16.0f, 30.0f, -10.0f);
|
|
pos = Vector3(16.0f, 30.0f, -10.0f);
|
|
rotation = Quaternion(Vector3(1.0f, 0.0f, 0.0f), 30) * rotation;
|
|
rotation = Quaternion(Vector3(1.0f, 0.0f, 0.0f), 30) * rotation;
|
|
rotation = Quaternion(Vector3(0.0f, 1.0f, 0.0f), 30) * rotation;
|
|
rotation = Quaternion(Vector3(0.0f, 1.0f, 0.0f), 30) * rotation;
|
|
-
|
|
|
|
- textInput.setActive(true);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void Game::tick() {
|
|
void Game::tick() {
|
|
- if(!connected && controller.down.wasReleased()) {
|
|
|
|
|
|
+ switch(state) {
|
|
|
|
+ case State::START: startGUI.tick(); break;
|
|
|
|
+ }
|
|
|
|
+ /*if(!connected && controller.down.wasReleased()) {
|
|
if(client.connect("127.0.0.1", 11196, 3000)) {
|
|
if(client.connect("127.0.0.1", 11196, 3000)) {
|
|
std::cout << client.getError() << '\n';
|
|
std::cout << client.getError() << '\n';
|
|
} else {
|
|
} else {
|
|
@@ -25,7 +26,7 @@ void Game::tick() {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
client.consumeEvents(*this);
|
|
client.consumeEvents(*this);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
lastRotation = rotation;
|
|
lastRotation = rotation;
|
|
lastPos = pos;
|
|
lastPos = pos;
|
|
@@ -87,9 +88,6 @@ void Game::renderOverlay(float lag, ShaderMatrix& sm, Renderer& r) {
|
|
.append(" &999TPS: &722")
|
|
.append(" &999TPS: &722")
|
|
.append(tps.getUpdatesPerSecond());
|
|
.append(tps.getUpdatesPerSecond());
|
|
r.drawString(10, 10, s);
|
|
r.drawString(10, 10, s);
|
|
- s.clear();
|
|
|
|
- textInput.getInput(s);
|
|
|
|
- r.drawString(10, 30, s);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
bool Game::isRunning() const {
|
|
bool Game::isRunning() const {
|