From 9f84ef2686feab6c82f7f523319fda65ff077962 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 30 Dec 2016 21:04:57 +0100 Subject: Have draw_text working with SFML --- library.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'library.cpp') diff --git a/library.cpp b/library.cpp index cee789e..eda5628 100644 --- a/library.cpp +++ b/library.cpp @@ -2,15 +2,30 @@ #include #include #include +#include #include "global.h" #include "library.h" -#include "main.h" using namespace std; +extern sf::RenderWindow window; + static void draw_text(int x,int y,const char *s,size_t len){ - fl_draw(s,len,x,y); + static sf::Font font; + static bool fontLoaded=false; + static sf::Text text; + + if(!fontLoaded){ + font.loadFromFile("/Library/Fonts/Arial.ttf"); + fontLoaded=true; + } + + text.setFont(font); + text.setFillColor(sf::Color::Black); + text.setString(string(s,len)); + text.setPosition(x,y); + window.draw(text); } void draw_text(int x,int y,const char *s){ -- cgit v1.2.3-70-g09d2