Ask coding questions

← Back to all posts
on-screen text?
CullenDAvello (18)

hey @SPQR can you help me with on screen text the SFML website says the code i have on lines 87-91 is right but it says "font" is undeclared even though its an sf::font, can you help? here's the repl thanks!!

Answered by abc3354 (128) [earned 5 cycles]
View Answer
Commentshotnewtop
abc3354 (128)

Hi !
This question was answered but I drop a tutorial link for anyone else ;)
https://www.sfml-dev.org/tutorials/2.5/graphics-text.php

SPQR (477)

So, you have to use the built-in fonts that come with xterm, change times new roman to one of the fonts in the x font directory. I used "/usr/share/fonts/X11/misc/ter-u16b_iso-8859-1.pcf.gz"

CullenDAvello (18)

@SPQR thank you, have you tried out the game?

SPQR (477)

@CullenDAvello Looks pretty cool, excited to see where you go with it :)

CullenDAvello (18)

@SPQR hey how do you do that??

CullenDAvello (18)

@SPQR never mind, figured it out. but i later tried loading in a font from a file but i keep getting a "failed to create the font face" issue, i have had trouble with all types of files including textures (that's why i have all the rectangles instead of textures) and i need some help. is there a #include i need that i don't have or is it something with the working file directory, sorry to bother you again. thank you again, for all your help, and of course... the link

P.S. no i have no clue on how to find or use a working file directory

SPQR (477)

@CullenDAvello https://repl.it/@SPQR/heed-the-dungeon-2 fixed it for you, I'll explain it in depth for u tomorrow but im kinda busy rn, sorry

CullenDAvello (18)

@SPQR oh ok, sorry i didn't mean bother you thanks again

SPQR (477)

@CullenDAvello nah it's fine, you're not bothering me I just had something to do. I can explain what I did now if you need me to

CullenDAvello (18)

@SPQR yes please, also...are we friends? or do you just answer because i @ you

CullenDAvello (18)

@CullenDAvello hey one more thing, if you run the program you'll see the character (white rectangle) has a gun (orange rectangle) i have already got the gun rotating with the mouse(as wanted) how could i also get the gun to follow the player(as if he's holding the gun) without interfering with the collision boundaries (invisible rectangles around the room, they are labeled in the r1, r2, ... r20 section) i am very confuse thanks!

SPQR (477)

@CullenDAvello Ok gimme a bit i'm in class

SPQR (477)

@CullenDAvello u seem cool we can be friends :)

CullenDAvello (18)

@SPQR oh $#!+ sorry, cool thx