Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Feb 2000
Offline Last Active Sep 11 2015 07:56 AM

Posts I've Made

In Topic: Newbie Javascript question

18 May 2013 - 05:18 AM

The problem is right there in the error message: You are calling 



in your this.Tick function, but you have not defined an Update function anywhere.

In Topic: Best Method For Writing Unit Tests

20 January 2013 - 09:06 AM

IMHO, tests should really only use the public members of a class. You shouldn't need to add any kind of "hooks" for testing.

I've been kind of on the fence about the whole debate over whether or not to test private members, but I'm of the mind that private members are most likely to be small helper functions that are easy to prove that they work, and they require in-class access to test them.


Normally this sort of thinking can work out fine, but since you specifically mentioned Test Driven Development in your first post you should start thinking about tests differently. In TDD a test is not written to prove that something works, it's written to specify how it should work

A test is, in a manner of speaking, a functional specification written in code.


Once you start thinking about tests as specifications instead of verifications then a lot of the things that initially seem "weird" about TDD makes immediate and intuitive sense (such as why you write the tests before the code, and why the code should not have the minimal functionality required to pass the tests, for instance).


So you should not test private methods. Not because they tend to be small and it is easy to prove that they work (which is often not the case anyway), but because they are not part of the specification of the class, and as such they are merely an implementation detail rather than something that should have  tests written for it.

In Topic: The #'th game engine question.

18 May 2012 - 12:24 PM

If you want something like Unreal Engine or Cryengine, then why don't you use Unreal Engine or Cryengine? This may seem like a frivolous question, but these are both available and fit the criteria you have listed, so there must be *something* that makes you not choose these, and telling us what that is will help us answer your question.

In Topic: Scaling game to different resolutions (LWJGL)

16 May 2012 - 07:20 AM

It's been a while since I played with OpenGL, so take this with a grain of salt, but glOrtho doesn't require you to use the actual resolution of the screen.

That is, your call
GL11.glOrtho(0.0D, xRes, 0.0D, yRes, 1.0D, -1.0D);
could be replaced with, for instance
GL11.glOrtho(0.0D, 1920.0D, 0.0D, 1080.0D, 1.0D, -1.0D);

which ought to solve your problem.

In Topic: toString() [Java]

28 March 2012 - 04:43 AM

Use an anonymous inner class, like this

public class Tester
    public static void main(String [] args)
        C cObj = new C() {
            @Override public String toString() { return "I am C"; }
        B [] bList = { cObj };
        for (int i = 0; i < bList.length; i++)
            System.out.println( bList[i].toString() );

Edit: Fixed whitespace-issues