Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 May 2011
Offline Last Active Sep 13 2011 05:52 AM

Topics I've Started

How does a game loop work?

08 September 2011 - 08:17 AM

Can someone please explain the concept of a game loop to me? I am really slow on this kind of stuff.

I am really trying to understand the concepts of game update and draw. And frames per second.

A frame is like a picture yeah? So if I flip through many frames I can get something like an animation. I think the recommended is 60fps?

Right now, all I have is


So anytime the loop is run input is required, then the changes - if any - are applied to the game objects, maybe they changed position screen. The backbuffer is cleared to reflect later change of positions or whatever.

But the thing is..what is the number of frames in this case? I haven't set any number..so I assume the number of frames is how fast the while loop can run depending on the computer?

If I was to introduce the concept of frames per second how would I do it? I can't find tutorials on this. I am using C++ thanks.
NB: Can you please make explanations simple. Think of it like explaining to a 2 year old :).

[web] Jquery animate problem

20 July 2011 - 03:59 PM

I just started learning jquery and this problem baffles me
I have divs in a container and when the mouse is over them it resizes the div and shifts the divs in front by a certain offset.
on mouseout it shifts the div by subtracting from that offset. This is the code if you are kind enough to look at it:

		<script src="http://code.jquery.com/jquery-latest.js"></script>
		<script language="JavaScript1.2">
			function resize(obj)
				$("#"+obj.id).height("100px").width("100px") ;
			function shift(id)
				for(var i=id+1;i<=4;i++)
					$("#hello"+i).stop().animate({"left":"+=60px"},1000) ;
			function shrink(obj)
				$("#"+obj.id).height("64px").width("48px") ;
			function reshrink(id)
				document.getElementById('testvalue').innerHTML+=document.getElementById("hello2").style.left ;

				for(var i=id+1;i<=4;i++)
					$("#hello"+i).stop().animate({"left":"-=60px"},1000) ;
				document.getElementById('testvalue').innerHTML+=document.getElementById("hello2").style.left ;
		<h1>Hello World!</h1>
		<div id="formWrapper" style="height:180;width:530;">
			<div id="wrapper"  style="position:relative;bottom:20px;width:460px;left:40px;height:160px;background-color:green;overflow:auto;" ">
				<div id="hello1" style="position:absolute;left:0px;height:64px;bottom:0px;width:48px; background-color:black;color:white;" onmouseover="resize(this);" onmouseout="shrink(this)"></div>
				<div id="hello2" style="position:absolute;left:49px;bottom:0px;height:64px;width:48px; background-color:maroon;color:white;" onmouseover="resize(this);" onmouseout="shrink(this)"></div>				
				<div id="hello3" style="position:absolute;left:98px;bottom:0px;height:64px;width:48px; background-color:brown;color:white;" onmouseover="resize(this);" onmouseout="shrink(this)"></div>
				<div id="hello4" style="position:absolute;left:147px;bottom:0px;height:64px;width:48px; background-color:white;color:white;" onmouseover="resize(this);" onmouseout="shrink(this)"></div>
		<div id="testvalue" style="position:absolute;top:390px;background-color:yellow;height:100px;width:400px;">

It is quite simple really, nothing too complicated in it..
What I found is that when the mouseover and out is rapid or maybe the animation isn't complete..the divs change more than the offset and eventually it overlaps! :'(
Can someone please suggest how to solve this problem?
And thanks :).

To test rapidly move mouse over the first div..

[web] No IMDB API, so what am I to do?

14 July 2011 - 04:42 PM

24 views..never mind found an api

[web] How to call a link without redirecting a page

09 July 2011 - 08:04 AM

I have a shortened link, for example like http://bit.ly but I need to find out what url it really is..
I was told I could use javascript to make an asynchronous call to the page and get the header information or something, which will give me the status code if it is redirecting and the actual link..I am newbie, and I don't know wtf that is lmao..
Can someone tell me if there is a way I can get this done with javascript thanks.

[web] HTML5 canvas problem

22 June 2011 - 08:17 AM

I just started learning HTML5 mainly because I need to know it..the problem is I am trying to move the canvas instead of the drawing inside the canvas...but I haven't been able to succeed in doing so!
How can one choose where to draw the canvas without using div layers?

I used div layer which was working fine..but the child layers into a parent div it got a messed up because the elements are relative to each other, and other positioning will render the div outside the parent div..I feel like shooting myself :(
So either I find a way to change the canvas x and y position or find a solution with div..please any suggestion guys.