G
gamedev513
Guest
Hey everyone,
In my game I have a basic loop that runs through each room of my game and sets the given view/port values. Once the loop reaches the final room of the game, I end the loop. I am currently using a While Loop to handle this,however, I am curious which Loop method is faster: For Loop or While Loop? And if For is in fact faster, how would I convert the following code below into For Loop format?
Thanks!
Anthony
In my game I have a basic loop that runs through each room of my game and sets the given view/port values. Once the loop reaches the final room of the game, I end the loop. I am currently using a While Loop to handle this,however, I am curious which Loop method is faster: For Loop or While Loop? And if For is in fact faster, how would I convert the following code below into For Loop format?
Thanks!
Anthony
Code:
i = true;
rm = room_next(room);
while (i)
{
room_set_view(rm, 0, true, 0, 0, view_w, view_h, 0, 0, view_w, view_h, 64, 64, -1, -1, noone);
room_set_view_enabled(rm, true);
if (rm == room_last)
{
i = false;
room_goto_next();
break;
}
else
{
rm = room_next(rm);
}
}