Gröve: Mini graphics libraries for love2d.

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
FloatingBanana
Prole
Posts: 22
Joined: Sat Mar 02, 2019 4:57 pm
Contact:

Gröve: Mini graphics libraries for love2d.

Post by FloatingBanana »

Gröve

Hey guys! I've written some tools for my personal projects and decided to release them in libraries. Most of them are really simple, but may be useful for beginners or game jam projects.

animation.lua: Create animations using image sequences.
chainshaders.lua: Apply multiple shaders at once.
color.lua: Blend, convert and interpolate colors.
draworder.lua: Adds a layer system, allowing you to call functions in a specific order.
resolution.lua: Helps your game to fit in any window size.

Github repository

Code: Select all

if anyMistake(self.english) then
    print("Sorry, english is not my first language")
end
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Gröve: Mini graphics libraries for love2d.

Post by togFox »

Ooo - I'll check out that resolution module for sure. I've been procrastinating about solving this problem. Does it scale windows and donuts and images?
Thanks for your contribution.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Gröve: Mini graphics libraries for love2d.

Post by GVovkiv »

Well, good job
It looks interesting
User avatar
FloatingBanana
Prole
Posts: 22
Joined: Sat Mar 02, 2019 4:57 pm
Contact:

Re: Gröve: Mini graphics libraries for love2d.

Post by FloatingBanana »

togFox wrote: Sun Mar 21, 2021 9:44 pm Does it scale windows and donuts and images?
The resolution module scales everything on the screen to fit inside the window. Let's say your game is designed to run in a 800x600 window, but you also want the user to be able to maximize or resize the window. This module will pick the desired size and scale the game to match the current window size. Here is a example: Image

Code: Select all

if anyMistake(self.english) then
    print("Sorry, english is not my first language")
end
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Gröve: Mini graphics libraries for love2d.

Post by togFox »

Great. And I just noticed I said donuts! That is meant to be fonts!
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Gröve: Mini graphics libraries for love2d.

Post by togFox »

Either this does not work with SLAB (entirely possible) or the example leaves out some key steps. I'm keen to work out which.

resolution module has 8 functions but only one is demonstrated in the wiki. I'm keen to get this to work so I'm happy to help make the doco gud. :)

- where does .start need to go (inside love.draw?)
- what about .stop?
- what does .toResized do?
- I assume .toGlobal is the opposite.

Maybe these things are obvious and SLAB is messing me up. Hard to say without more info.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
User avatar
FloatingBanana
Prole
Posts: 22
Joined: Sat Mar 02, 2019 4:57 pm
Contact:

Re: Gröve: Mini graphics libraries for love2d.

Post by FloatingBanana »

I forgot to update the example, sorry about that :death:

When you pass an empty table in the "replace" field, the module modifies your love callbacks and some functions in love.mouse, so you don't have to worry about modifying your existing code. However, this module may be incompatible with other libraries (which was your case), so you can tell the module to not modify anything and let you setup everything manually:

Code: Select all

res = require "grove.resolution"
slab = require "slab"

local conf = {
	width = 640,
	height = 480,
	
	-- Leave the "replace" field empty, so the module won't modify anything.
	replace = nil
}

function love.load(args)
	res.init(conf)
	slab.Initialize(args)
end

function love.draw()
	-- Since the "replace" field in the configuration is nil, you need to setup everything manually.
	res.start()
	
	-- Put your game drawing operations here.
	-- Everything here will be affected by the resolution scaling.
	
	-- In the "manual mode", the mouse position returned from love.mouse.getX() and love.mouse.getY() doesn't match with
	-- the screen scaling, so you need to use res.mouse.getX() and res.mouse.Y() to fix this.
	love.graphics.circle("fill", res.mouse.getX(), res.mouse.getY(), 10)
	
	res.stop()
	
	-- Everything after res.stop() won't be affected by the resolution scaling
	slab.Draw()
end

function love.update(dt)
	slab.Update(dt)
end

function love.mousepressed(x, y)
	-- The original position doesn't match with the screen scaling, so you need to use res.toScaled to fix this.
	x, y = res.toScaled(x, y)
end
In this way, Slab is ignored by the module. The code above should also clarify your questions.

Code: Select all

if anyMistake(self.english) then
    print("Sorry, english is not my first language")
end
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Gröve: Mini graphics libraries for love2d.

Post by dusoft »

Cool resolution scaling!
Post Reply

Who is online

Users browsing this forum: RetroKevin and 6 guests