• Create Account

## Scrolling Horror

3 replies to this topic

### #1willpowered  Members

Posted 04 May 2013 - 11:14 PM

POPULAR

public void scrollUp() {
if (scroll_index <= 0) return;
scroll_index--;

refreshContentsPosition();
}

public void scrollDown() {
if (scroll_index >= contents.Count() + (2 * 6) - 12) return; //todo: make sure this is the correct index, once you add more levels.
scroll_index++;

refreshContentsPosition();
}


The code speaks for itself. Obviously, upon review, it was not the correct index.

Dunno what came over me when I wrote that.

### #2TheChubu  Members

Posted 05 May 2013 - 12:10 AM

if (( 2 * 6) == 12) // Checking if 2 * 6 actually is 12. No one can be sure enough.
{
return;
}

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

### #3Dim_Yimma_H  Members

Posted 09 May 2013 - 08:31 AM

(2 * 6) - 12


I don't know what's worst, it doesn't look all correct, but does nothing ...so did the code work?

### #4Sik_the_hedgehog  Members

Posted 10 May 2013 - 10:22 PM

Basically it'd let the scroll index go as far as the last entry, but since that's what's at the beginning of the scroll (when you'd want the last entry at the end), this would result in the scroll going far beyond its limit. The calculation was supposed to compensate to get the correct limit, but obviously that's not what happened =P

At least if I'm understanding right.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.