Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 21 Mar 2004
Offline Last Active Sep 23 2014 05:55 PM

Topics I've Started

Java - How to deal with Abstract Static functions

22 September 2014 - 10:08 AM

I'm coming from C++, trying to learn Java.
The issue is that Java doesn't allow overriding of static functions.
In this case, I would like each class that inherits from a parent (let's call it the Item class) to have an identifier that get by calling getId().
class Item
  abstract String getId();
class ItemA extends Item
  String getId()
    return "ITEM_A";
The thing is that I want to be able to call getId without having to instantiate the class, so that I can do something like this:
void foo(Item i)
  if(i.getId() == ItemA.getId())
    //Do Something
Java doesn't allow abstract static functions, so I'm left with defining non-abstract static functions. As a result, the above function doesn't work, because i.getId() returns the Parent object's id, not that of the child object.
Are there any ways around this, or what would be a better way of dealing with it?

Alternatives to singletons for data manager?

03 May 2013 - 01:07 PM

I want to add a central data manager to my project, so that different classes can share data. It will also act as a map to avoid doubling up on resources.


Attached File  layout1.png   20.1KB   34 downloads


I figure that there are 3 ways I can do this:

  • create the manager as a global (EVIL)
  • pass the manager to each class as it is created (UGLY)
  • create the manager as a singleton

Every post I see says to avoid singletons, but is this a situation that breaks the rule, or is there a better solution?


Also, the graphic data above is just one type of data; realistically there will be many data types. To avoid having a whole mess of singletons, I would create a central data manager that has a factory class for each type:


Attached File  layout2.png   25.37KB   33 downloads


Oh yeah, I'm doing this in C++, but the concepts should apply to most languages

write texture to stereo buffer

14 April 2012 - 10:59 AM

I know that in directx, the 3d stereo works by shifting the camera and rendering two different images. I was wondering if there is any way to write directly to the buffer, to display different textures to each eye. This would be useful for having 3d background images, or in my case, writing a 3d image viewer.
I know this can be done in opengl by accessing the quad buffer, but I haven't been able to find any documentation for directx. If it helps any, I'm working with nvidia cards.


MVC pattern question

22 September 2010 - 11:13 AM

I'm trying to understand the MVC pattern, and I'm having difficulty figuring out where data processing takes place.

Let's say I was building a paint program using MVC, which would be the better way to go?

  • the user draws a line

  • the line is sent to the controller

  • the controller processes the line, turning it into an image

  • the line image is sent to the model, which adds it to the existing image data

  • the controller tells the view to update

  • the view gets and displays the updated image data


  • the user draws a line

  • the line is sent to the controller

  • the controller sends the line data to the model

  • the model processes the line, and adds it to the existing image data

  • the controller tells the view to update

  • the view gets and displays the updated image data


problems with xCode... Directory not found

27 April 2010 - 03:28 PM

I'm getting the following warning when I compile my program: ld: warning: directory '/Users/alex/Library/Frameworks' following -F not found Does anybody know what causes this error, and ideally how to fix it? I'm pretty sure that it started after I updated xCode via the automatic update (xCode 3.2.2). Normally I wouldn't worry about it too much, but I'm having a problem rendering in opengl (via SDL), and I want to make sure that it's not because of some linking error. Thank you