Print a stderr message with more information about why creating the window failed

This commit is contained in:
Josh Holtrop 2017-01-19 09:27:16 -05:00
parent 3dcc6b2350
commit a65a9fec41

View File

@ -2,6 +2,7 @@
#include "Window.h"
#include "Runtime.h"
#include "BufferPane.h"
#include <iostream>
#define INITIAL_WIDTH 800
#define INITIAL_HEIGHT 800
@ -77,6 +78,7 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
{
if (!Initialize_SDL())
{
std::cerr << "Error initializing SDL" << std::endl;
return false;
}
@ -89,6 +91,7 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
if (m_window == NULL)
{
std::cerr << "Error creating SDL window" << std::endl;
return false;
}
@ -96,6 +99,7 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
if (!Initialize_OpenGL())
{
std::cerr << "Error initializing OpenGL" << std::endl;
return false;
}
@ -105,12 +109,14 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
std::string font_path = Runtime::find(Runtime::FONT, "DejaVuSansMono");
if (font_path == "")
{
std::cerr << "Unable to locate font" << std::endl;
return false;
}
m_font = std::make_shared<Font>();
if (!m_font->load(font_path.c_str(), FONT_SIZE))
{
std::cerr << "Error loading font" << std::endl;
return false;
}