Search found 13 matches

by YounYokel
Sat Oct 19, 2019 4:57 pm
Forum: Support and Development
Topic: [SOLVED] Is there a way to get the string width and height?
Replies: 4
Views: 557

Re: Is there a way to get the string width and height?

You don't need to create a new font, you can get the default font by just calling love.graphics.getFont . My point was that that's still a font, because strings are abstract in the sense that without a font, they don't have width or height, just count (codepoint count if we're talking utf-8 or simi...
by YounYokel
Sat Oct 19, 2019 1:44 pm
Forum: Support and Development
Topic: [SOLVED] Is there a way to get the string width and height?
Replies: 4
Views: 557

Re: Is there a way to get the string width and height?

Font:getWidth gets the width of a given text string in a specific font; Font:getHeight gives you the height of one line in that specific font. Not sure what else you might mean, unless you're asking for the number of characters (or codepoints) in a string, because that doesn't really have a width n...
by YounYokel
Sat Oct 19, 2019 10:23 am
Forum: Support and Development
Topic: [SOLVED] Is there a way to get the string width and height?
Replies: 4
Views: 557

[SOLVED] Is there a way to get the string width and height?

Hey is there a way I can get the string width or height instead of font width and height only?
by YounYokel
Sun Oct 13, 2019 4:35 pm
Forum: Games and Creations
Topic: Floppy Box
Replies: 3
Views: 1712

Re: Floppy Box

This game is unfair because the wall spawns at random point so it's possible that you may not fall and collide it if the wall is lower than the player.
by YounYokel
Thu Oct 10, 2019 4:36 pm
Forum: Support and Development
Topic: [SOLVED] How do I import files from specific folder in the game directory?
Replies: 2
Views: 1090

Re: How do I import files from specific folder in the game directory?

pgimeno wrote:
Wed Oct 09, 2019 6:23 pm
Use / instead of \
Oops. That was silly :P
by YounYokel
Wed Oct 09, 2019 3:45 pm
Forum: Support and Development
Topic: [SOLVED] How do I import files from specific folder in the game directory?
Replies: 2
Views: 1090

[SOLVED] How do I import files from specific folder in the game directory?

Hello! It's quite weird for me, but when I'm setting the new font but I cannot import the font from a folder, I need to type the name only. If that file doesn't exists in the project folder, game will crash. local myFont = love.graphics.newFont( "fonts\opensans.ttf", 14 ) What should I do to allow t...
by YounYokel
Sun Oct 06, 2019 1:59 pm
Forum: Libraries and Tools
Topic: [Notepad++] Launch Project From Any File
Replies: 2
Views: 4228

Re: [Notepad++] Launch Project From Any File

I don't think it's a problem, but I'm gonna mention that when you use a function — love.filesystem.getWorkingDirectory() — it shows the Notepad++ path. And it doesn't work with running the console One thing you can add in "Execute" option is this at the begging: NPP_SAVE It will save the current fil...
by YounYokel
Sun Oct 06, 2019 12:12 pm
Forum: Support and Development
Topic: [SOLVED] How to get the string length?
Replies: 5
Views: 1478

Re: How to get the string length?

MrFariator wrote:
Sun Oct 06, 2019 11:25 am
Any of these methods work.

Code: Select all

-- all print 4
local str = "asdf"
print(#str)
print(string.len(str))
print(str:len())
This page lists the available string methods.
Thank you! Didn't know about the hashtag.
by YounYokel
Sun Oct 06, 2019 11:21 am
Forum: Support and Development
Topic: [SOLVED] How to make a linebreak?
Replies: 6
Views: 1511

Re: How to make a linebreak?

local myText = [[this is where my text goes and it will handle linebreaks]] function love.draw () love.graphics.print(myText, 10, 10) end One thing to keep in mind is that all contents between [[]] will be caught, so it will also take the indentation into account if present. Example: function love....
by YounYokel
Sun Oct 06, 2019 11:19 am
Forum: Support and Development
Topic: [SOLVED] How to get the string length?
Replies: 5
Views: 1478

[SOLVED] How to get the string length?

Hey, is there a way to get a string length?
Like this:

Code: Select all

local textStr = "Hello World"
local textLen = textStr:getLength

function love.draw( dt )
    love.graphics.print( tostring( textLen ) ) -- Returns 11
end