build and link with FreeType
This commit is contained in:
parent
d4440ade7f
commit
6138fd233f
@ -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
|
||||
|
@ -1,5 +1,10 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include "gl3w.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <iostream>
|
||||
#include <ft2build.h>
|
||||
#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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user