Jump to content

  • Log In with Google      Sign In   
  • Create Account

Scrolling Horror

  • You cannot reply to this topic
3 replies to this topic

#1 willpowered   Members   -  Reputation: 516

Like
5Likes
Like

Posted 04 May 2013 - 11:14 PM

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.



Sponsor:

#2 TheChubu   Crossbones+   -  Reputation: 4766

Like
3Likes
Like

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;
}
: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


#3 Dim_Yimma_H   Members   -  Reputation: 469

Like
0Likes
Like

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?



#4 Sik_the_hedgehog   Crossbones+   -  Reputation: 1833

Like
0Likes
Like

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.





PARTNERS