diff --git a/Rakefile.rb b/Rakefile.rb index ed01bdf..b146e78 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -9,7 +9,9 @@ NAME = "freetype2gl3" task :default do Rscons::Environment.new do |env| env.build_root = "build" - env["LIBS"] += ["SDL2", "GL", "dl"] + env["LIBS"] += ["SDL2", "GL", "dl", "freetype"] + env["CXXFLAGS"] += `freetype-config --cflags`.split(" ") + env["LDFLAGS"] += `freetype-config --libs`.split(" ") env.Program("^/#{NAME}", Dir["*.{cc,c}"]) end end diff --git a/freetype2gl3.cc b/freetype2gl3.cc index fe77a0a..aa1a027 100644 --- a/freetype2gl3.cc +++ b/freetype2gl3.cc @@ -1,5 +1,10 @@ -#include #include "gl3w.h" +#include +#include +#include +#include FT_FREETYPE_H + +using namespace std; #define WIDTH 500 #define HEIGHT 500 @@ -19,7 +24,7 @@ int main(int argc, char *argv[]) { if (SDL_Init(SDL_INIT_VIDEO)) { - printf("Failed to initialize SDL!\n"); + cerr << "Failed to initialize SDL!" << endl; return 1; } @@ -33,7 +38,7 @@ int main(int argc, char *argv[]) SDL_WINDOW_OPENGL); if (!window) { - printf("Failed to create window!\n"); + cerr << "Failed to create window!" << endl; SDL_Quit(); return 2; } @@ -42,18 +47,24 @@ int main(int argc, char *argv[]) if (gl3wInit() != 0) { - printf("Failed to gl3wInit()\n"); + cerr << "Failed to gl3wInit()" << endl; SDL_Quit(); return 2; } if (!gl3wIsSupported(3, 0)) { - printf("OpenGL 3.0 is not supported!\n"); + cerr << "OpenGL 3.0 is not supported!" << endl; SDL_Quit(); return 2; } + FT_Library ft; + if (FT_Init_FreeType(&ft) != 0) + { + cerr << "Could not FT_Init_FreeType()" << endl; + } + init(); display(window); SDL_Event event;