"Questions that don't deserve their own thread" thread

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.
Locked
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: "Questions that don't deserve their own thread" thread

Post by airstruck »

pgimeno wrote:I don't like lg.scale as a substitute in this case, because it scales everything else. Line thickness, fonts, images... Not just the coordinates.
Yeah, there is that. The stuff I've been working on lately already factors scale in to keep lines the same width when you zoom in or out, and no text is rendered until all the transformations are popped off, so I haven't been affected by that so far. I think there's going to be some give and take no matter how you slice it, but so far I'd rather work with the scale transformation than work with weird nths-of-a-meter units.
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

Re: "Questions that don't deserve their own thread" thread

Post by scissors61 »

Hey guys, I'm creating a game that will have a search function and the results will be a long list of items, so I need to create a vertical scrolling list to navigate through every item on the list. My first solution was to draw them all and to "fly" on top of them with gamera. Is this alright or should I just move the Y of every item of the list (notice that the list will have more than 1000 items)?
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: "Questions that don't deserve their own thread" thread

Post by Tjakka5 »

scissors61 wrote:Hey guys, I'm creating a game that will have a search function and the results will be a long list of items, so I need to create a vertical scrolling list to navigate through every item on the list. My first solution was to draw them all and to "fly" on top of them with gamera. Is this alright or should I just move the Y of every item of the list (notice that the list will have more than 1000 items)?
You can render them all to a canvas and move it's Y instead.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Questions that don't deserve their own thread" thread

Post by Nixola »

A canvas for such a long list isn't really recommended; either draw them all with gamera or (if Gamera doesn't do that for you) figure out which ones are visible, and only draw those.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: "Questions that don't deserve their own thread" thread

Post by Tjakka5 »

Note that you only need to render all the items to the canvas once, after that you can reuse it without any overhead.
That is, as long as the list of items is somewhat static. (Which in de case of a search function, should be.)
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Questions that don't deserve their own thread" thread

Post by Nixola »

The issue is the canvas height; with 1000 elements you'd need at least 12 thousand pixels vertically; I think that's more than most GPUs texture size limit, and it would be a waste of video memory.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: "Questions that don't deserve their own thread" thread

Post by pgimeno »

Such a list is not that different to a map, actually. Maybe you could use STI, which handles tile visibility for you. Or handle the visibility yourself.
User avatar
PiFace
Prole
Posts: 28
Joined: Mon Sep 05, 2016 5:35 pm
Location: Brazil

Re: "Questions that don't deserve their own thread" thread

Post by PiFace »

I'm about to run into this same issue, as my game needs that same type of search feature. As I'm using the Suit lib for gui, I was thinking about creating ~7 buttons where the search results should appear, then using a slider or something to change the "offset" of the buttons index. I've tried that with a text-only dropdown and it works, but I'm not sure if that would be a good idea for a bigger list, with images and stuff. If it works, I'm gonna post it here. :P

EDIT: let's suppose the game loads some images from a folder and stores them in a table (using love.graphics.newImage() and some loops). Then at some other point of the game, that table is replaced by another table with other images (like imgTable = functionThatReturnsANewTable() ). My question is: are the old images deleted from memory? Is it enough to have no variable storing an image to prevent it from using memory?
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

Re: "Questions that don't deserve their own thread" thread

Post by scissors61 »

I see. Thanks to all... It seems that it wasn't a bad idea to use gamera. The only risk is the quantity of items becoming too big for the graphics to handle them. If the quantity becomes a problem I'll try to apply Nixola's suggestion of drawing only the items that I'm hovering on.
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by HugoBDesigner »

Well, I did something that could be of use for you. Don't mind me, I always overdo things when it comes to coding (I'm looking at you Simple Path Animation):
Scroller.love
LÖVE 0.10.1
(1.59 KiB) Downloaded 307 times
EDIT: Use mouse and/or mousewheel, also click and escape
@HugoBDesigner - Twitter
HugoBDesigner - Blog
Locked

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests