push icon indicating copy to clipboard operation
push copied to clipboard

Setting window width/height to 0 in push:setupScreen causes blank screen

Open FormularSumo opened this issue 4 years ago • 2 comments

The minimal code to reproduce the issue:

function love.load() push = require 'push' push:setupScreen(1920, 1080, 0, 0) end

function love.draw() push:start() love.graphics.rectangle('fill',10,10,100,100) push:finish() end

A window running at my desktop resolution opens but nothing within push:start() and push:finish() draws. If I move love.graphics.rectangle to be after push:finish it does draw.

If I change window width & height to any other value, either in push:setupScreen or by calling push:resize rectangle does draw.

FormularSumo avatar Apr 17 '21 20:04 FormularSumo

Hi, sorry if I'm wrong, but while 0x0 is technically an invalid resolution, the pull request seems to add more of an enhancement rather than a bugfix. It would probably make more sense for push to detect whether windowWidth and windowHeight are nil and default to the desktop dimensions if so, instead of 0 or less which should probably throw an error instead.

I'll leave this open for a few days in case there's something I'm missing, though.

htv04 avatar Aug 29 '21 03:08 htv04

My thinking was to make push:setupScreen mirror the beheaviour of love.window.setMode, where if you give it a width/height of 0 it sets them to desktop resolution. https://love2d.org/wiki/love.window.setMode "If width or height is 0, setMode will use the width and height of the desktop."

At any rate the current beheaviour should probably be changed, where the window is launched at desktop resolution but can't be drawn to within push:start and push:finish.

Also my pull request is only checking for == 0, if you put in a value less than 0 (or nil) it returns an error.

FormularSumo avatar Aug 29 '21 10:08 FormularSumo