Page 68 of 91

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

Posted: Sun Jul 17, 2016 2:43 am
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.

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

Posted: Mon Sep 19, 2016 6:23 am
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)?

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

Posted: Mon Sep 19, 2016 7:27 am
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.

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

Posted: Mon Sep 19, 2016 7:46 am
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.

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

Posted: Mon Sep 19, 2016 8:37 am
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.)

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

Posted: Mon Sep 19, 2016 9:02 am
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.

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

Posted: Mon Sep 19, 2016 12:40 pm
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.

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

Posted: Mon Sep 19, 2016 3:49 pm
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?

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

Posted: Tue Sep 20, 2016 2:57 am
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.

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

Posted: Tue Sep 20, 2016 5:37 am
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 274 times
EDIT: Use mouse and/or mousewheel, also click and escape