~brandontschaefer/+junk/sdl-bouncy-ball

« back to all changes in this revision

Viewing changes to src/sdl_backend/StringTextureCreator.cpp

  • Committer: Brandon Schaefer
  • Date: 2014-04-25 20:44:47 UTC
  • Revision ID: brandontschaefer@gmail.com-20140425204447-zhdk6gbcy2hsc1m4
* Use try/catch over main loop to catch any errors, and report them
* Add new font

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Authored by: Brandon Schaefer <brandontschaefer@gmail.com>
18
18
 */
19
19
 
 
20
#include "config.h"
20
21
#include "StringTextureCreator.h"
21
22
 
 
23
#include <stdexcept>
 
24
 
22
25
namespace sdl_backend
23
26
{
24
27
 
25
28
// FIXME Make this easier to change...
26
 
std::string const FONT_PATH = "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf";
 
29
std::string const FONT_PATH = RESDIR"/8bitoperator.ttf";
27
30
 
28
31
StringTextureCreator::StringTextureCreator(int font_size)
29
32
  : font_(TTF_OpenFont(FONT_PATH.c_str(), font_size))
30
33
{
 
34
  if (!font_)
 
35
    throw std::runtime_error("Failed to load font: " + FONT_PATH);
31
36
}
32
37
 
33
38
StringTextureCreator::~StringTextureCreator()
34
39
{
35
 
  //TTF_CloseFont(font_);
 
40
  TTF_CloseFont(font_);
36
41
}
37
42
 
38
43
void StringTextureCreator::SetFontSize(int size)