Client builds & runs, can't test the gameplay without the server

SDL_ttf is now being initialized, and all usages of fonts are now checked for nullptr.
A bug where the renderer's logical size was not properly set has been fixed.
The FPS counter is disabled for now.
This commit is contained in:
2015-08-20 20:45:13 +10:00
parent dc5b09a9b4
commit 3d6509b5a5
15 changed files with 100 additions and 22 deletions
@@ -25,6 +25,7 @@
#include "config_utility.hpp"
#include "udp_network_utility.hpp"
#include <sstream>
#include <stdexcept>
//-------------------------
@@ -39,6 +40,13 @@ DisconnectedScreen::DisconnectedScreen() {
image.Load(GetRenderer(), config["dir.interface"] + "button.png");
font = TTF_OpenFont(config["client.font"].c_str(), 12);
//check that the font loaded
if (!font) {
std::ostringstream msg;
msg << "Failed to load a font file; " << SDL_GetError();
throw(std::runtime_error(msg.str()));
}
//setup the button
backButton.SetBackgroundTexture(GetRenderer(), image.GetTexture());
backButton.SetText(GetRenderer(), font, "Back", {255, 255, 255, 255});
@@ -105,6 +113,10 @@ void DisconnectedScreen::MouseButtonUp(SDL_MouseButtonEvent const& event) {
}
}
void DisconnectedScreen::MouseWheel(SDL_MouseWheelEvent const& event) {
//
}
void DisconnectedScreen::KeyDown(SDL_KeyboardEvent const& event) {
switch(event.keysym.sym) {
case SDLK_ESCAPE: