"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
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

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

Post by Davidobot »

Jarodeno93 wrote:I've been playing a game that uses love2d and it was running fine until recently. Now the game can only run when my laptop is plugged into my tv through an hdmi cable. Without it double clicking on the .exe/trying to run it results in nothing happening. Any idea on what could cause this and how to fix this?
Check if your display is set as your primary screen. LOVE could be starting on the primary monitor, which is set to your HDMI output and so doesn't show up on your main display,
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

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

Post by TheMeq »

Can someone make me a function that posts to a PHP script and returns the result?

I have this that I found on a Lua forum, but I can't get it working.

Code: Select all

local http = require "socket.http"
local ltn12 = require "ltn12"

function postForm(url, body)
    local sink, responseData = ltn12.sink.table()
    local responseCode, statusCode, headers, statusLine = http.request {
        url = url,
        method = "POST",
        headers = {
            ["Content-Type"] = "application/x-www-form-urlencoded",
            ["Content-Length"] = #body -- this header might not be necessary
        },
        source = ltn12.source.string(body),
        sink = sink        
    }
    return table.concat(responseData), responseCode
end
User avatar
pgimeno
Party member
Posts: 3655
Joined: Sun Oct 18, 2015 2:58 pm

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

Post by pgimeno »

Works for me.

PHP:

Code: Select all

<?php
  foreach ($_POST as $k => $v)
  {
    echo "$k = $v\n";
  }
 
Lua (added after your code):

Code: Select all

local s = postForm('http://www.formauri.es/personal/pgimeno/temp/ping.php',
                   'data1=first&data2=second')

print(s)

function love.draw()
  love.graphics.printf(s, 0, 0, 800)
end
Output:

Code: Select all

data1 = first
data2 = second
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

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

Post by TheMeq »

Ah, I must have been doing it wrong xD
User avatar
pgimeno
Party member
Posts: 3655
Joined: Sun Oct 18, 2015 2:58 pm

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

Post by pgimeno »

Is the data passed to [wiki]love.image.newImageData[/wiki](w, h, data) always RGBA pixels, left-to-right, top-to-bottom? If not, how do I find what data does it expect?
User avatar
slime
Solid Snayke
Posts: 3161
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 is.
User avatar
toolebox
Prole
Posts: 1
Joined: Tue Jan 13, 2015 4:17 am
Contact:

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

Post by toolebox »

Hey guys, any chance you could explain to me what the z and w values of the vec4 vertex_position in the vertex shader are for and if there is any way i can utilise them? Working on a small-scale 3d thing for a project (switching between 2d topdown and 3d in realtime), and I believe I can implement it in pure Love2D quite efficiently. cheers.
Ctastic
Prole
Posts: 1
Joined: Sun Apr 17, 2016 4:08 am

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

Post by Ctastic »

So i'm doing some basic drawing for a little project i'm working on, and in the draw function i'm drawing rectangles and text and then drawing an image. When I draw the sprite, it is being filled by the color I last set to draw with. Looking at the documentation it seems that there used to be a function "setColorMode" I could use in order to set the way images (sprites) were affected by "setColor" but it was removed for 9.0 and I can't figure out how to do it now!

Help!
User avatar
Vimm
Party member
Posts: 113
Joined: Wed Mar 16, 2016 8:14 pm

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

Post by Vimm »

why can't you use tables as values for setColor? lets say I make a variable called r and in setColor I do

Code: Select all

love.graphics.setColor(r, 255,255)
whatever I set r to produces the result you would think, but lets say i make a table called colors and do something like

Code: Select all

colors = {}
colors.r = 255
colors.g = 255
colors.b = 255

love.graphics.setColor(colors.r, colors.g, colors.b)
why doesnt this work? the error says its expecting an integer and its getting a nil value, I'm just curious why I can't use tables.
User avatar
Doctory
Party member
Posts: 441
Joined: Fri Dec 27, 2013 4:53 pm

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

Post by Doctory »

Vimm wrote:-snip-
You can use tables. Theres probably something wrong with your code.
Locked

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest