"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
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

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

Post by parallax7d »

Are there specific plans to break it in the works, or just the vague notion that it may one day break?
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

0.11's code already breaks it, since 0.11 provides a variety of ImageData formats compared to just 32-bit RGBA in 0.10 and older – plus 0.11's colors are within [0, 1] rather than [0, 255], so the conversion between the internal representation of 32-bit RGBA and the Lua API values is different.

If you want to split work up between threads, a safer option that doesn't involve mutex contention might be to create an ImageData per thread, sized to the subsection of the main ImageData that the thread would have operated on, and then call [wiki]ImageData:paste[/wiki] several times in the main thread after all worker threads have completed their operations.

Also be sure to use [wiki]ImageData:mapPixel[/wiki] rather than ImageData:setPixel, since the former only does a single mutex lock whereas setPixel does a mutex lock per call.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

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

Post by davisdude »

slime wrote: plus 0.11's colors are within [0, 1] rather than [0, 255]
Is there any reason for this? I'm just curious: from a design standpoint, what is the motivation behind it?
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

  • It's more consistent (shader code and Shader:send already uses colors within [0,1] for example)
  • it's less restrictive (love 0.11 will provide other ImageData formats such as 32 bit floating point RGBA, which don't have normalized values, so the 0-255 range makes no sense there)
  • it makes math on colors such as interpolation and combining (e.g. multiplying) easier since you don't have to deal with dividing by 255
  • in a lot of cases it's more natural to write the values (e.g. is halfway between no value and full value 127 or 128 in a 0-255 range? in 0-1 it's just 0.5. What's halfway between no value and half? 1/4 aka 0.25 with 0-1, or ~64 with 0-255 range).
User avatar
Le_juiceBOX
Citizen
Posts: 71
Joined: Sat Mar 26, 2016 3:07 pm

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

Post by Le_juiceBOX »

Hey, I was wondering if it is possible to open 2 or more windows using love.

Thanks ^^ .
SteamLibrary-like Program For Love2D Games:
take me to the forum thread!
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

love only supports a single window, although you can close and re-open it multiple times!
User avatar
Le_juiceBOX
Citizen
Posts: 71
Joined: Sat Mar 26, 2016 3:07 pm

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

Post by Le_juiceBOX »

slime wrote:love only supports a single window, although you can close and re-open it multiple times!
Thanks!


Is there a way to open a second exe or love file inside the game?
SteamLibrary-like Program For Love2D Games:
take me to the forum thread!
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 »

[manual]os.execute[/manual] or [manual]io.popen[/manual] should do the trick, be careful with Operating System differences though. For comunications you could use one of the networking libraries and you could simulate that the windows come from a single program. I'm not sure if LÖVE won't try to launch a console when you execute the command in Windows... you should try it though
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
Le_juiceBOX
Citizen
Posts: 71
Joined: Sat Mar 26, 2016 3:07 pm

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

Post by Le_juiceBOX »

Positive07 wrote:[manual]os.execute[/manual] or [manual]io.popen[/manual] should do the trick, be careful with Operating System differences though. For comunications you could use one of the networking libraries and you could simulate that the windows come from a single program. I'm not sure if LÖVE won't try to launch a console when you execute the command in Windows... you should try it though


Thanks! this helped a lot :awesome:
SteamLibrary-like Program For Love2D Games:
take me to the forum thread!
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post by Jasoco »

The question is, are you trying to open two windows in the same game? Because Löve can't currently do that due to limitations. Or are you trying to open two instances of Löve and a game at once? Because that can be done depending on the OS. On macOS I can open multiple instances with the Terminal. The command line on any OS should allow it.
Locked

Who is online

Users browsing this forum: No registered users and 30 guests