Page 1 of 1

Basic Program Won't Work? (w/ 'push' library)

Posted: Mon Mar 23, 2020 4:09 am
by Falkyraizu
Here is my code:

Code: Select all

push = require 'push-master.push'
WINDOW_WIDTH = 1024
WINDOW_HEIGHT = 600
VIRTUAL_WIDTH = 400
VIRTUAL_HEIGHT = 200

function love.load()
	love.graphics.setDefaultFilter('nearest','nearest')
	push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
		fullscreen = false,
		resizable = false,
		vsync = true
	})
	
	love.window.setMode(WINDOW_WIDTH, WINDOW_HEIGHT, {
		fullscreen = false,
		resizable = false,
		vsync = true
	})
end

function love.draw()
	push:start()
	love.graphics.printf('Hello Pong', 0, WINDOW_HEIGHT / 2 - 6, WINDOW_WIDTH, 'center')
	push:finish()
end

function love.keypressed(key)
	if key == 'escape' then
		love.event.quit()
	end
end
Expected Output: https://love2d.org/imgmirrur/RL3rewA.png
My Output: A Blank Black Window (or sometimes nothing happens, not even the window pops up)
Can someone help me understand why this is happening? For some reason my code isn't working?

-Sincerly, Falkyraizu

Re: Basic Program Won't Work? (w/ 'push' library)

Posted: Mon Mar 23, 2020 10:45 am
by pgimeno
I haven't used push, but is it possible that you need to use VIRTUAL_WIDTH and VIRTUAL_HEIGHT for printf? IIUC the whole point of push is that you don't need to use the real device's size. And in that case, the coordinates you're passing are off the screen.

Re: Basic Program Won't Work? (w/ 'push' library)

Posted: Mon Mar 23, 2020 6:20 pm
by Falkyraizu
pgimeno wrote: Mon Mar 23, 2020 10:45 am I haven't used push, but is it possible that you need to use VIRTUAL_WIDTH and VIRTUAL_HEIGHT for printf? IIUC the whole point of push is that you don't need to use the real device's size. And in that case, the coordinates you're passing are off the screen.
Ahh, it works. Thanks m8 :)