push - a resolution-handling library

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

Re: push - a resolution-handling library

Post by Ulydev »

Added stretched and highdpi flags. Also fixed some issues with :toGame().
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: push - a resolution-handling library

Post by Ulydev »

Custom canvases and shaders are here!

Image

Code: Select all

push:setupCanvas({
  { name = "canvas1", shader = myShader },
  { name = "canvas2" }
})
User avatar
dizzykiwi3
Citizen
Posts: 58
Joined: Tue Jan 14, 2014 2:03 am

Re: push - a resolution-handling library

Post by dizzykiwi3 »

Hey, I'm having some issues using this library with HUMP's camera module. I'd love to be able to just add the push:start() and push:end() around my draw function, but it's not agreeing and scaling and translating well with anything that is within hump's camera. I don't know however if this is some unavoidable issues with using multiple pops and pushes, as I am a bit unfamiliar with how that works.
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: push - a resolution-handling library

Post by Ulydev »

dizzykiwi3 wrote: Thu Mar 30, 2017 4:59 am Hey, I'm having some issues using this library with HUMP's camera module. I'd love to be able to just add the push:start() and push:end() around my draw function, but it's not agreeing and scaling and translating well with anything that is within hump's camera. I don't know however if this is some unavoidable issues with using multiple pops and pushes, as I am a bit unfamiliar with how that works.
That's weird, it works well with kikito's gamera. I just need to set the draw range using camera:setWindow(gameWidth, gameHeight) - maybe there is something similar with HUMP?
Sungray
Prole
Posts: 7
Joined: Sun Apr 09, 2017 8:02 pm

Re: push - a resolution-handling library

Post by Sungray »

dizzykiwi3 wrote: Thu Mar 30, 2017 4:59 am Hey, I'm having some issues using this library with HUMP's camera module. I'd love to be able to just add the push:start() and push:end() around my draw function, but it's not agreeing and scaling and translating well with anything that is within hump's camera. I don't know however if this is some unavoidable issues with using multiple pops and pushes, as I am a bit unfamiliar with how that works.
Hi there. Got this issue aswell. The black borders show up on the screen when I'm in wondowed mode. Switching windowed-fullscreen triggers the problem.

I'll try with Gamera to make it work.

Awesome job Ulydev, thanks ! Would love it if you took a look at Hump camera compatibility :).
Sungray
Prole
Posts: 7
Joined: Sun Apr 09, 2017 8:02 pm

Re: push - a resolution-handling library

Post by Sungray »

Gamera works with Push.

Now implementing Lightworld. This is a nightmare. Did you try Push with Lightworld ?
myogaman
Prole
Posts: 3
Joined: Tue Sep 19, 2017 3:42 am

Re: push - a resolution-handling library

Post by myogaman »

Sorry to resurrect an old thread but I was curious if there was a dynamic way to change the game resolution without reinitializing the window. This would make it easier to have different depths of field for cutscenes and special maps.

For example, one could make it so the city map is a big resolution and a single room is a smaller resolution. Or if a character dies and you want to place emphasis, you can zoom on their death animation.

Not sure if this library is meant for this kind of abuse so if anyone knows an alternative, I'd be very appreciative.
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: push - a resolution-handling library

Post by Ulydev »

myogaman wrote: Tue Sep 19, 2017 3:49 am -snip-
I think you're looking for a camera library such as https://github.com/kikito/gamera. Or maybe I didn't understand your question at all. Either way just let me know :crazy:
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: push - a resolution-handling library

Post by D0NM »

Hi Ulydev.

Image

today I tried to update your library and got the reported greenish effect .
The affected are "phosphorish.frag" shader and the windowed mode only.

Code: Select all

/*
   Plain (and obviously inaccurate) phosphor.
   Author: Themaister
   License: Public Domain
*/
// modified by slime73 for use with love pixeleffects


extern vec2 textureSize;

vec3 to_focus(float pixel)
{
	pixel = mod(pixel + 3.0, 3.0);
	if (pixel >= 2.0) // Blue
		return vec3(pixel - 2.0, 0.0, 3.0 - pixel);
	else if (pixel >= 1.0) // Green
		return vec3(0.0, 2.0 - pixel, pixel - 1.0);
	else // Red
		return vec3(1.0 - pixel, pixel, 0.0);
}

vec4 effect(vec4 vcolor, Image texture, vec2 texture_coords, vec2 pixel_coords)
{
	float y = mod(texture_coords.y * textureSize.y, 1.0);
	float intensity = exp(-0.2 * y);

	vec2 one_x = vec2(1.0 / (3.0 * textureSize.x), 0.0);

	vec3 color = Texel(texture, texture_coords - 0.0 * one_x).rgb;
	vec3 color_prev = Texel(texture, texture_coords - 1.0 * one_x).rgb;
	vec3 color_prev_prev = Texel(texture, texture_coords - 2.0 * one_x).rgb;

	float pixel_x = 3.0 * texture_coords.x * textureSize.x;

	vec3 focus = to_focus(pixel_x - 0.0);
	vec3 focus_prev = to_focus(pixel_x - 1.0);
	vec3 focus_prev_prev = to_focus(pixel_x - 2.0);

	vec3 result =
		0.8 * color * focus +
		0.6 * color_prev * focus_prev +
		0.3 * color_prev_prev * focus_prev_prev;

	result = 2.3 * pow(result, vec3(1.4));

	return vec4(intensity * result, 1.0);
}

And after many changes you haven't changed the library version number ;)

I'm going to stick to this library some more time.
Btw, I use HUMP camera + push. Going to try the new STALKER-X camera. viewtopic.php?f=5&t=84591
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: push - a resolution-handling library

Post by Ulydev »

D0NM wrote: Tue Feb 20, 2018 9:40 am -snip-
Hi D0NM!
Thanks for the report :-)

May I look at the code where you use your shader? At first glance, if it works in fullscreen but not windowed mode it might be because of the TextureSize.

Also, I'm very bad at versioning, haha. But I'll remember to update the version number next time ;-)
Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests