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

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
Falkyraizu
Prole
Posts: 10
Joined: Sun Mar 22, 2020 9:30 pm

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

Post by Falkyraizu » Mon Mar 23, 2020 4:09 am

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://imgur.com/a/GZjzgvt
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

User avatar
pgimeno
Party member
Posts: 2029
Joined: Sun Oct 18, 2015 2:58 pm

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

Post by pgimeno » 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.

Falkyraizu
Prole
Posts: 10
Joined: Sun Mar 22, 2020 9:30 pm

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

Post by Falkyraizu » Mon Mar 23, 2020 6:20 pm

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 :)

Post Reply

Who is online

Users browsing this forum: MrFariator and 29 guests