push - a resolution-handling library

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Ulydev
Party member
Posts: 421
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: push - a resolution-handling library

Post by Ulydev » Tue Apr 03, 2018 12:01 am

Hi everyone!

I've updated push with multiple shaders support.

You can now provide a table of shaders, which will apply in the order they're provided. This allows you to combine shader effects, or even draw the same shader with multiple passes.

https://github.com/Ulydev/push

User avatar
Mermersk
Party member
Posts: 105
Joined: Tue Dec 20, 2011 3:27 am

Re: push - a resolution-handling library

Post by Mermersk » Thu Jul 12, 2018 6:35 pm

Great library Ulydev!

I am using it to scale my android game, it didnt work right away but after some digging I managed to make it work. I wanted to share some tips that are perhaps common-knowledge but took me some time to figure out. Firstly if you are developing for phones you have to take into consideration the Pixel density of the different phones that exist. I didnt know much about this so I never got Push to work properly before realizing that for example the the pixel density on my phone is 3(number I got from love.window.getDPIScale() ) and I have to take that also into account when scaling. My solution was this:

Code: Select all

	gameWidth, gameHeight = 480, 320
	screenWidth, screenHeight = love.window.getDesktopDimensions()
  	local dpi_scale = love.window.getDPIScale()
  	screenWidth = screenWidth/dpi_scale
  	screenHeight = screenHeight/dpi_scale
  	push:setupScreen(gameWidth, gameHeight, screenWidth, screenHeight, {fullscreen = true, resizable = false, canvas = false, pixelperfect = 		 
  	false, highdpi = true, stretched = true})
So i divide the screen resolution with the pixel density value before passing them on to the Push library. Perhaps there is a better way to do this, but since my game is pretty lowres this works for me.

Another thing is the canvas boolean. With it set to true it completely tanked my FPS on my phone from steady 60 to about 18-21 fps. Took some time to find this out but when i put canvas to false I was back into the usual 60fps.

Maybe those 2 tips will help others who are using this with android development. Once again thanks for this great library Ulydev :awesome:

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests