## 0.9.2 to 11.2 love.graphics cannot function without a window

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
vortizee
Prole
Posts: 34
Joined: Sat Feb 14, 2015 6:23 am

### 0.9.2 to 11.2 love.graphics cannot function without a window

What am I missing?
main.lua:26 is

Code: Select all

require ‘lua/loader’
which is at the top of main.lua, and line 220 of loader.lua simply loads an image:

Code: Select all

local LGNI	= love.graphics.newImage
.
.
.
controls	= LGNI( 'resources/images/controls.png' )

Runs peachy in Löve 0.9.2 on OS X Mavericks but fails on OS X High Sierra as an executable app. Dropping the game folder over Löve 11.2 spits the error below unlike over 0.9.2.
Error

lua/loader.lua:220: love.graphics cannot function without a window!

Traceback
[C]: in function 'LGNI'
[C]: in function 'require'
main.lua:26: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function ‘xpcall’
I have just started the port to 11.2 — color definitions, stencil, and mouse changes yet to be done. conf.lua is

Code: Select all

function love.conf(t)

t.identity				= "ATCH"
t.window.title			= "ATCH"
t.window.width			= 1280
t.window.height			= 800
t.modules.joystick			= false
t.modules.physics			= false
t.window.highdpi			= true
t.window				= nil

end

zorg
Party member
Posts: 2484
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

A quick look at Config_Files will tell you that you're missing at least two things; t.modules.window = true and t.modules.graphics = true.
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.

vortizee
Prole
Posts: 34
Joined: Sat Feb 14, 2015 6:23 am

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

Thank you, same error though. I’m trying to find out what other things might bite like this from the changelogs.

zorg
Party member
Posts: 2484
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

In that case, it might be that because of some inexplicable design decision on löve's part, you can no longer use love.graphics functions without creating an actual graphical window (even if some functions did work without it previously); i'm not sure on this one, though i do remember something like this faintly.
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.

slime
Solid Snayke
Posts: 2806
Joined: Mon Aug 23, 2010 6:45 am
Contact:

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

It never worked to use love.graphics without a window, since the window has always created an OpenGL context (partly since an SDL OpenGL context requires a window to be created in the first place - because on various platforms an OpenGL context and a renderable backbuffer are tied together, and the latter requires a window).

Before love 0.10 or so, it would just randomly crash or corrupt your memory in that case. Now it causes a Lua error instead (when some functions are called, at least.)

pgimeno
Party member
Posts: 1448
Joined: Sun Oct 18, 2015 2:58 pm

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

From 0.10.1 release notes:

"Fixed love.graphics object creation functions (e.g. love.graphics.newImage) to error instead of crash, if called before a window has been created."

Indeed in 0.10.0 it crashes. According to what slime has said above, I wonder why in 0.9.1 and 0.9.2 I get no crash. In 0.9.0 I get one.
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

vortizee
Prole
Posts: 34
Joined: Sat Feb 14, 2015 6:23 am

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

I’m very rusty at the löve functions, and I worked everything out by trial and error. A window always launched at the start in 0.9.2, and I considered a config file the first time after noticing it started at some default dimension ( 800 x 600? ) before I could resize it with love.window.setMode. If in 11.2 the window is not automatically created, who does so and how? I can see a love.window.close at the top of the list, but not a love.window.open or anything intuitively similar.

slime
Solid Snayke
Posts: 2806
Joined: Mon Aug 23, 2010 6:45 am
Contact:

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

The window is automatically created by default in love 11. Your love.conf has the line "t.window = nil" in it, which stops that from happening. If you remove that line it should be automatically created.

You can also call love.window.setMode to (re)create the window in main.lua (before calling any love.graphics function).

There are also various t.window fields documented in the love.conf wiki page to set the size of the window, etc. when it's created the first time after love.conf is loaded, so you don't need to call setMode to set the initial size.

vortizee
Prole
Posts: 34
Joined: Sat Feb 14, 2015 6:23 am

### Re: 0.9.2 to 11.2 love.graphics cannot function without a window

There you go, I guess I put that in 0.9.2 to stop the visible resize and forgot all about it. Okay, I’m in the update business, thanks!

### Who is online

Users browsing this forum: No registered users and 11 guests