Run a love program with no GUI screen [resolved]

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.
Post Reply
code_fodder
Prole
Posts: 3
Joined: Wed Aug 10, 2016 6:44 am

Run a love program with no GUI screen [resolved]

Post by code_fodder »

I know the question sounds a bit demented, but I am trying to write a bunch of emulators, some of which need a GUI and some don't.

I could use pure lua, but I really like the love callback mechanism as it provides "scheduler" in its update() callback.

So for the emulators that need the GUI its great, but for the emulators that don't need the GUI I still get the blank window that appears - I kind of just don't want it to appear (or just be hidden).

Is that possible? I have provided my code, but I don't think it makes a difference to this question... here is an example anyway (note no GUI stuff):

Code: Select all

-- TCP Controller
local socket = require("socket")

-- UPDATED AFTER POST:
-- Dont need a GUI
function love.conf(t)
    t.window = nil
end
-- UPDATE END

-- Startup
function love.load()
  udp = socket.udp()
  udp:setsockname("*", 53474)
  udp:settimeout(0)
end

-- Scheduler 
function love.update()
  -- Check for UDP data
  data, ip, port = udp:receivefrom()
  if data then
    print("Received: ", data, ip, port)
    print("Reply...")
    udp:sendto(data, ip, port)
  end
end
Last edited by code_fodder on Thu Aug 11, 2016 6:19 am, edited 2 times in total.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Run a love program with no GUI screen

Post by Nixola »

[wiki]love.conf[/wiki]. Just set t.window to nil.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
code_fodder
Prole
Posts: 3
Joined: Wed Aug 10, 2016 6:44 am

Re: Run a love program with no GUI screen

Post by code_fodder »

I added this function in, it did not seem to have an effect - i.e. when I run the command to launch the script:

Code: Select all

c:\test-area\tcp-test> love .
I still have a blank window that appears...
code_fodder
Prole
Posts: 3
Joined: Wed Aug 10, 2016 6:44 am

Re: Run a love program with no GUI screen

Post by code_fodder »

No, its my mistake, I did not read the instructions carefully. I now created a file called conf.lua and move the function into that - and it now works nicely.

Thanks Nix : )
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot], Semrush [Bot] and 2 guests