Sure, but how do i know if a source was stopped or paused? Or do I have to remember that now? Before i had only to ask the source.
LÖVE 11.0 released!
Re: LÖVE 11.0 released!
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: LÖVE 11.0 released!
The point is that when playback is suspended at the very beginning, the paused and stopped "states" are basically equivalent. pause is always halt playback, stop is always halt playback and rewind, and rewind is always seek(0).
Me and my stuff True 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.
-
- Prole
- Posts: 36
- Joined: Wed Apr 13, 2016 3:53 pm
Re: LÖVE 11.0 released!
So I found an answer on color clamping.
https://bitbucket.org/rude/love/issues/ ... error-if-a
Indeed the behavior my project relies on was against spec, and in 11.0 requires a pixel shader (or one of the floating point pixel formats but no idea how widely supported they are).
https://bitbucket.org/rude/love/issues/ ... error-if-a
Indeed the behavior my project relies on was against spec, and in 11.0 requires a pixel shader (or one of the floating point pixel formats but no idea how widely supported they are).
Re: LÖVE 11.0 released!
I was also able to recreate the effect by drawing a given sprite additional time(s) after calling `love.graphics.setBlendMode('add')`. I don't know a lot about shaders or alternate pixel formats, so I don't have any conception of whether this is more or less computationally expensive than either of those approaches.Iori Branford wrote: ↑Mon Apr 09, 2018 9:58 pm Indeed the behavior my project relies on was against spec, and in 11.0 requires a pixel shader (or one of the floating point pixel formats but no idea how widely supported they are).
Re: LÖVE 11.0 released!
Shaders are running all the time, therefore using a shader should be computationally cheaper than drawing the sprite multiple times.shru wrote: ↑Tue Apr 10, 2018 7:18 am I was also able to recreate the effect by drawing a given sprite additional time(s) after calling `love.graphics.setBlendMode('add')`. I don't know a lot about shaders or alternate pixel formats, so I don't have any conception of whether this is more or less computationally expensive than either of those approaches.
This is an approach you can try:
Code: Select all
local shader = love.graphics.newShader[[
// Based on the default shader code at https://love2d.org/wiki/love.graphics.newShader
extern number colour[4];
vec4 effect(vec4 ignored, Image texture, vec2 texture_coords, vec2 screen_coords)
{
vec4 texturecolor = Texel(texture, texture_coords);
return texturecolor * (vec4(colour[0], colour[1], colour[2], colour[3])*(1.0/255.0));
}
]]
love.graphics.setShader(shader)
function mySetColour(r, g, b, a) -- in this example it's global; you may want to put it inside a module or object.
if g == nil then assert(type(r) == "table"); g = r[2]; b = r[3]; a = r[4]; r = r[1] end
if a == nil then a = 255 end
assert(type(r) == "number" and type(g) == "number" and type(b) == "number" and type(a) == "number")
shader:send('colour', r, g, b, a)
end
-- example usage:
local img = love.graphics.newImage('image1.jpg')
function love.draw()
mySetColour(511, 255, 255) -- draw redder than normal
love.graphics.draw(img)
end
- pixelicidio
- Prole
- Posts: 5
- Joined: Sat Mar 17, 2018 2:47 pm
- Contact:
Re: LÖVE 11.0 released!
For the new COLOR FROMAT change the fun thing about lua is that you can replece the setColor function for the whole project only once like this:
Then do the same for other functions involving colors.
Code: Select all
--love version >11 fix colors
if api.getVersion() >= 11 then
local oldSetColor = love.graphics.setColor
love.graphics.setColor = function (r, g, b, a)
if type(r)=="table" then
g = r[2] / 255
b = r[3] / 255
a = (r[4] or 255) / 255
r = r[1] / 255
else
r = r / 255
g = g / 255
b = b / 255
a = (a or 255) / 255
end
oldSetColor(r,g,b,a)
end
end
Re: LÖVE 11.0 released!
Just wanted to take the time to thank you for the example code.
Re: LÖVE 11.0 released!
Thank you, pixelicidio!
You just have to think about something like that... and it is ready ))
You just have to think about something like that... and it is ready ))
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
Re: LÖVE 11.0 released!
Note that this function is just a compatibility layer to spare you the work. You probably want to properly convert your setColor functions some time in the future.
Re: LÖVE 11.0 released!
Also don't forget getColor.
Who is online
Users browsing this forum: Google [Bot] and 2 guests