LÖVELINESS a LÖVE Chrome Extension
Re: LÖVELINESS a LÖVE Chrome Extension
Slight bug: lg.supported 'npot' returns false but LÖVELINESS can display npot images.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: LÖVELINESS a LÖVE Chrome Extension
Yes, 0.8.0 can display NPOT images regardless of hardware support.
- slime
- Solid Snayke
- Posts: 3166
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: LÖVELINESS a LÖVE Chrome Extension
Canvases (the love.graphics kind) aren't auto-padded when NPOT textures aren't supported, even though images are, so that's mostly what love.graphics.isSupported("npot") is useful for.
Re: LÖVELINESS a LÖVE Chrome Extension
Oh, right, I forgot about that and I forgot to test canvases too.
The problem is that now I've tested a canvas (200x200) and it works too
The problem is that now I've tested a canvas (200x200) and it works too
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: LÖVELINESS a LÖVE Chrome Extension
This is probably going to be a "no", but is there any way to run something like LÖVELINESS inside of a webpage instead of as a full browser tab?
I mean like opening it in a html-element and running it there.
I mean like opening it in a html-element and running it there.
Re: LÖVELINESS a LÖVE Chrome Extension
Actually, yes! I was going to add a demo of this, but haven't gotten around to it. To do it, add something like this to your HTML:Plu wrote:This is probably going to be a "no", but is there any way to run something like LÖVELINESS inside of a webpage instead of as a full browser tab?
I mean like opening it in a html-element and running it there.
Code: Select all
<div id="listener">
<script>
document.getElementById('listener').addEventListener('load',
function() { document.embeds[0].postMessage('run'); }, true);
</script>
<embed type="application/x-love-game" love_src="url/of/your/game.love" width="800" height="600">
</div>
A little explanation of the JavaScript: it is necessary to notify the plugin when it should run. It unfortunately does not run automatically. Instead, the code waits for the module to load, then posts the message "run" to it.
If the user does not have LÖVELINESS installed, they'll just get the missing plugin image. If you want to detect whether they have LÖVELINESS installed, you can do something like this:
Code: Select all
if (navigator.mimeTypes['application/x-love-game']) {
// the user has LÖVELINESS installed
} else {
// the user doesn't have loveliness installed, display an error, remove the embed, etc.
}
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: LÖVELINESS a LÖVE Chrome Extension
Why is that source attribute named love_src instead of src?
Help us help you: attach a .love.
Re: LÖVELINESS a LÖVE Chrome Extension
Awesome! Thanks, it works great. (As long as the .love file is on the same domain as the .html page, I'm guessing? It didn't work when I opened the file from my local machine with the .love on the web)binji wrote:Actually, yes! I was going to add a demo of this, but haven't gotten around to it. To do it, add something like this to your HTML:Plu wrote:This is probably going to be a "no", but is there any way to run something like LÖVELINESS inside of a webpage instead of as a full browser tab?
I mean like opening it in a html-element and running it there.
Re: LÖVELINESS a LÖVE Chrome Extension
Hm, this makes me wonder. Can the plugin send messages that the game generates back to javascript? So that the love application can communicate with the rest of the website? And can javascript send additional messages to the plugin that end up in the game?A little explanation of the JavaScript: it is necessary to notify the plugin when it should run. It unfortunately does not run automatically. Instead, the code waits for the module to load, then posts the message "run" to it.
I realise it'd make a pretty tight coupling and is probably not of much interest to you, but the webdeveloper in me wants to know
Re: LÖVELINESS a LÖVE Chrome Extension
Good question. Basically, LÖVELINESS can be loaded three ways:Robin wrote:Why is that source attribute named love_src instead of src?
Code: Select all
1. <embed type="application/x-nacl" src="love_release.nmf" love_src="...">
2. <embed type="application/x-love-game" src="...">
3. <embed type="application/x-love-game" love_src="...">
Yeah, AFAIK that won't ever work on Chrome. You can't reference file:// resources from a normal web page, and you can't reference file:// resources from other file:// resources.Plu wrote:Awesome! Thanks, it works great. (As long as the .love file is on the same domain as the .html page, I'm guessing? It didn't work when I opened the file from my local machine with the .love on the web)
As for cross-origin support: I could read the .love file using CORS, allowing you to specify a .love file on a different origin than the page. You'd have to set up the .love file server to use CORS, naturally. Would anyone use this functionality?
Yes, it's possible. There would need to be a new function in lua to do it, obviously, and I'm not too keen on extending the LÖVE API. BTW, there are some messages that the plugin already sends to the page that may be useful. You can listen for them like this:Plu wrote:Can the plugin send messages that the game generates back to javascript? So that the love application can communicate with the rest of the website? And can javascript send additional messages to the plugin that end up in the game?
Code: Select all
document.getElementById('listener').addEventListener('message', function(event) {
// event.data is a string:
// setWindow:<width>,<height> -> the plugin is asking to change the size of the embed
// download:<downloaded>,<max> -> the plugin is telling how much of the .love file is downloaded, in bytes
// OK -> the plugin has finished downloading the .love file
// bye -> the .love game has ended, remove the embed element or reload it, etc.
// requestFileSystem -> the .love game is trying to write to persistent storage, but needs JavaScript to OK it.
}, true);
Who is online
Users browsing this forum: No registered users and 4 guests