Scrolling Horror

Started by
2 comments, last by Sik_the_hedgehog 10 years, 11 months ago

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.

Advertisement

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

"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


(2 * 6) - 12

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

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.

This topic is closed to new replies.

Advertisement