[Vala] SDL TTF Bindings can't find font



Hello there, first of all here's the relevant part of my code:

using SDLTTF;

(...)

public void draw_string (string text, int x, int y, Color color) {
    Rect destination = {};
    Font pixel_font = new Font ("font.ttf", 20);
    if (pixel_font == null) print ("Font not found\n");

    (...)
}

Basically, pixel_font is always null and I am sure font.ttf is on the
same directory as the binary executable:

~/src/thegame $ ls
thegame Game.vala Cube.Vala font.ttf Makefile PlayState.vala State.vala
~/src/thegame $ ls

I also tried renaming the file, or putting the font in a special
folder. Oh, and I'm calling the executable on the same directory as
the font and the binary.

Here's my compile line on my Makefile:

valac --pkg gl --pkg sdl --pkg sdl-gfx --pkg gio-2.0 --pkg sdl-image
--pkg sdl-ttf -X -lSDL_gfx -X lSDL_image -X lSDL_ttf
--Xcc=-I/usr/include/SDL -o thegame Game.vala State.vala State.vala
PlayState.vala

It compiles with 0 warnings and 0 errors too by the way.

-- 
David Gomes



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]