"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
Cryogenical
Prole
Posts: 49
Joined: Mon Apr 28, 2014 5:23 pm

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

Post by Cryogenical »

It did nothing but change the size of my window. Still had borders.
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 »

Cryogenical wrote:It did nothing but change the size of my window. Still had borders.
Are you trying to remove the border or make the window resizable? Because they're two separate things. Just add "borderless = true" to that table. Go to the Wiki and look up love.window.setMode(). There's a lot of settings in there to play with.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

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

Post by Zilarrezko »

Cryogenical wrote:It did nothing but change the size of my window. Still had borders.
What system do you have? Because I know windows 8 won't get rid of borders unless you make it borderless and make it not resizeable.

Sorry I probably forgot to put in borderless.

Code: Select all

local resizeable = false
local borderless = false

function love.keypressed(key, unicode)
      if key == "5" then
           resizeable = not resizeable
           borderless = not borderless
           love.window.setMode(1080, 720, {resizable = resizeable, borderless = borderless})
      end
end
See if that works, sorry.
User avatar
Cryogenical
Prole
Posts: 49
Joined: Mon Apr 28, 2014 5:23 pm

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

Post by Cryogenical »

Closer, but the window was still resizeable.
I am running on windows 8 sadly.

I fixed it by either changing the local variable for resizeable to true, or just getting rid of the function of resizeable = not resizeable.

Thank you guys though! Helps a lot.
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

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

Post by rmcode »

Somehow my brain can't process why this

Code: Select all

return content and content:isPassable() or true;
doesn't work like this:

Code: Select all

        if content then
            return content:isPassable();
        else
            return true;
        end
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

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

Post by Robin »

Because

Code: Select all

a and b or c
is the same as

Code: Select all

(a and b) or c
which returns c if either a or b is falsy, otherwise it returns b.

What you want is

Code: Select all

return not content or content:isPassable()
Help us help you: attach a .love.
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

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

Post by rmcode »

Ah ... so the statement would return true, if isPassable() returns false. That's where the mistake was. I thought it would directly return the result of isPassable() if there was content and return true if there wasn't.

Thanks for the explanation.
Whatthefuck
Party member
Posts: 106
Joined: Sat Jun 21, 2014 3:45 pm

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

Post by Whatthefuck »

How do I use getPointer with FFI on an ImageData object to change a certain pixel in it? Is the ImageData array two dimensional, and what variable names do the pixel colors use?
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 »

If you use this (all you need to do is require the file) then you'll get the performance of LuaJIT's FFI when calling ImageData methods, without having to worry about whether your C pointer / array arithmetic is correct.
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

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

Post by rmcode »

I wrote a shader yesterday, which allows me to cycle through different colour palettes. Since I am pretty new to shaders I used a pretty brute-force approach:

Code: Select all

vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords )
{
    vec4 tex = Texel(texture, texture_coords);

    if (tex.r == 0 && tex.g == 0 && tex.b == 0) {                   // Black
        tex.r = PALETTE[0][0];
        tex.g = PALETTE[0][1];
        tex.b = PALETTE[0][2];
    } else if (tex.r == 1.0 && tex.g == 1.0 && tex.b == 1.0) {      // White
        tex.r = PALETTE[1][0];
        tex.g = PALETTE[1][1];
        tex.b = PALETTE[1][2];
    } else if (tex.r >= 0.5 && tex.g >= 0.5 && tex.b >= 0.5) {      // Light Gray
        tex.r = PALETTE[2][0];
        tex.g = PALETTE[2][1];
        tex.b = PALETTE[2][2];
    } else if (tex.r >= 0.2 && tex.g >= 0.2 && tex.b >= 0.2) {      // Dark Gray
        tex.r = PALETTE[3][0];
        tex.g = PALETTE[3][1];
        tex.b = PALETTE[3][2];
    }

    // This will make every pixel of the sprite opaque.
    // tex.a = color.a;

    return tex;
}
It works fine for the colour cycling part, but not for transparent images. When I set love.graphics.setColor(255, 255, 255, 0), it still shows the sprite at 100 % opacity. I know I have to do something with the alpha, but I'm not sure what :S
Locked

Who is online

Users browsing this forum: No registered users and 142 guests