"Questions that don't deserve their own thread" thread

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Locked
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Beelz »

Pyuu wrote:
zorg wrote:-snip-
Telling them to get font 'xyz' themselves isn't something you should bank on either. :monocle:
The reason I'm curious about this is for common fonts that you can almost bet on existing on most end-user's PCs, such as Arial or Tahoma. Also, detection of those fonts existence and using reasonable alternative fonts based on OS and prepackaged fonts when they don't exist would be a good way to go about not having fonts. (It may cause the experience to differ slightly, but it still avoids the need to go about distribution licenses and potential copyright infringement when packaging the game.)
For the most part, trying to figure out the licencing on system fonts is a hassle... You're better off finding a font to distribute with your game. I've used 1001 Free Fonts a ton and they usually come with a readme for distribution details. Then just keep your font library organized and its smooth sailing.

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: "Questions that don't deserve their own thread" thread

Post by Positive07 »

Sometimes a feature like detecting system fonts is usable for example in editing programs, you probably want a dropdown so the user can chose a font, but you don't want to include a lot of fonts with the program itself, and you want to let the user use their own fonts, so detecting available fonts is a good idea. This programs are very specific though, image and video edition software, document processors like Word, Excel, PowerPoint and code editors.

I would like this feature not as a part of LÖVE but as an external library which most likely would have to pick up the available fonts names and then have a function to load any such font and return a LÖVE Font... I'm pretty sure this could be done, if someone has more info please write it, it might spark some interest
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
unixfreak
Citizen
Posts: 82
Joined: Thu Oct 15, 2015 6:25 am
Location: Bristol, UK
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by unixfreak »

I'm trying to set a randomly rotated image
But i only end up with integers, for example;

Code: Select all

-- returns 0,1,2,3 
love.math.random(math.pi)

-- same as above
love.math.random(0.0, math.pi)
The angle of a placed image isn't as random as i'd like it to be. How can i get math.random / love.math.random to choose a random floating number?

EDIT; DO'H math has never been my strong point but this gives what i need;

Code: Select all

love.math.random(math.pi*10)/10
Solved i guess.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Questions that don't deserve their own thread" thread

Post by Nixola »

You could also do

Code: Select all

love.math.random()*math.pi
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by zorg »

If you give at least one argument to love.math.random, it will output integers less than the number. You wanted what Nixola wrote.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
jakie
Prole
Posts: 4
Joined: Tue Feb 03, 2015 1:27 am

Re: "Questions that don't deserve their own thread" thread

Post by jakie »

I want to export Love2d to my android device.
What's the best way to find the dimensions of my phone?

EDIT: Nvm solved.
jakie
Prole
Posts: 4
Joined: Tue Feb 03, 2015 1:27 am

Re: "Questions that don't deserve their own thread" thread

Post by jakie »

My project is too big for my monitor. I have a Samsung galaxy s6 with the dimensions 1440 x 2560 pixels
How can I test my project on the PC and Android? Or should I just forget about running it on the PC at all.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: "Questions that don't deserve their own thread" thread

Post by Positive07 »

Android, iOS and Mac use PixelScale (which you can get with [wiki]love.window.getPixelScale[/wiki]), this works like this, if the PixelScale is 4 then 1dip (density independant pixel) is 4 actual pixels. You want to draw with dip units so then you scale everything by the PixelScale and get beutiful results.

So since the S6 has a PixelScale of 4 then you will have a 360dip x 640dip drawing area. And since your computer has a PixelScale of 1 (most systems use this) and it is most likely 800px x 600px (at least) then your monitor has a drawing area of 800dip x 600 dip which is bigger than your phone!

This is useful too because Google recommends a touch target of 48dip which in your phone would be 184px!

NOTE: Calling them dip (density independant pixels/points) is most likely wrong, I just wanted to explain the concept
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: "Questions that don't deserve their own thread" thread

Post by raidho36 »

I think what you should be using is adjustible screen dimensions. If you use rigid numbers for the screen resolution, then it will only work well for screens with that exact resolution, and will be broken for everything else one way or another.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: "Questions that don't deserve their own thread" thread

Post by Positive07 »

Of course, you need a combination of both, I recommend dips for the sake of touch input (Hell having a 48px button on a screen with 4x pixel scale would be a pain) but then you have to dynamically resize your drawing area because your phone may be 360x640 but other may be 320x600 and so on... So the size and or aspect ratio may not be the same and you should adapt to it (which is a pain but one that is needed to give the best user experience everywhere)

SO! Adapt to the user screen dinamically, by scaling, adding black borders or whatever. And make sure that all your input has a good touch target of 48dips!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Locked

Who is online

Users browsing this forum: No registered users and 7 guests