How do you reset back to the default font?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How do you reset back to the default font?
I have loaded up a font, and set it as the default with love.graphics.setFont. Now, I need to reset the font back to what the default is when you load up the game. How would I go about doing this? I thought love.graphics.reset would accomplish this, but it doesn't.
- slime
- Solid Snayke
- Posts: 3166
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: How do you reset back to the default font?
If you store the default font in a variable before setting a custom one (e.g. defaultfont = love.graphics.getFont()), then you can use that with love.graphics.setFont later.
- SneakySnake
- Citizen
- Posts: 94
- Joined: Fri May 31, 2013 2:01 pm
- Contact:
Re: How do you reset back to the default font?
love.graphics.newFont without any arguments returns the default font.
See http://www.love2d.org/wiki/love.graphic ... Function_4
Just don't call it in a tight loop or something, because it creates a new font every time.
Alternatively, you can save the font into a variable using love.graphics.getFont() and restore it at a later time.
See http://www.love2d.org/wiki/love.graphic ... Function_4
Just don't call it in a tight loop or something, because it creates a new font every time.
Alternatively, you can save the font into a variable using love.graphics.getFont() and restore it at a later time.
Re: How do you reset back to the default font?
Thanks guys! I really didn't want to have to store it in a variable because storing variables would clutter the API that I'm making. I ended up using "love.graphics.setFont(love.graphics.newFont(12))" for now. It's not enclosed in a tight loop, and what I'm making is supposed to be very lightweight, so I shouldn't have a problem using it. Thanks again
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: How do you reset back to the default font?
You shouldn't be calling that with any kind of frequency. Also, is it really that hard to store a variable? I doubt it.
Re: How do you reset back to the default font?
It's really not being called that often, it's not frequent at all. And, no, it's obviously not hard to store a variable. I need to make this as clean and efficient as possible though and not clutter up this table with variables I won't use besides on startup, if I don't have tobartbes wrote:You shouldn't be calling that with any kind of frequency. Also, is it really that hard to store a variable? I doubt it.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests