Jump to content

  • Log In with Google      Sign In   
  • Create Account

D.Chhetri

Member Since 16 Oct 2009
Offline Last Active May 10 2014 06:46 PM

Posts I've Made

In Topic: Newbie Javascript question

19 May 2013 - 01:43 AM

If you are running on chrome, you can simply use the bind function, 

this.tickIntervalId = setInterval(this.Tick.bind(this), 1000/60); //Update at 60 fps

 

or if you are using the popular underscore utility

 

this.tickIntervalId = setInterval(_.bind(this.Tick,this), 1000/60); //Update at 60 fps

 

 

The problem is that your Tick function gets called in a global context. Which means that, the 'this' pointer is the global 'this' which is not what you need. Hence you need to bind the 'this' context so that when the Tick function gets called from a global context, the original 'this' pointer is still saved.


In Topic: Question about good practice and static member variables

04 May 2013 - 08:22 AM

Try instantiating BitText in main, then pass it around where needed. That class seems to be lightweight right? So I assume creating that object is light.


In Topic: Html5 Canvas: Why in the following JSFiddle, the stroke rectangle full opacit...

04 May 2013 - 12:06 AM

Interesting, this seems like a bug? Same result in chrome/firefox as well. Btw, on chrome increasing linewidth by 2, seems to fix the issue as you've mentioned.


In Topic: Is there anything faster than A* pathing?

03 May 2013 - 08:41 PM

Check this http://qiao.github.io/PathFinding.js/visual/ out. Check out the jump point search, with preprocessing and future information that algorithm is very fast. So it all depends on the context. But A* is a good starting point in most scenarios. 


In Topic: A class that contains an instance of itself

27 October 2012 - 09:34 PM

[source lang="cpp"]class Menu{private: Menu * subMenu;.....};[/source]

is this possible?


Did you try to compile this? Simple question like this could just be tested. Learn to be more independent.

PARTNERS