Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Singleton - To be or not to be?  (Read 1590 times)

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Singleton - To be or not to be?
« on: May 30, 2006, 06:42:00 PM »

I am contemplating removing the singleton nature of OIS for the next release (0.8). his will allow the user to create several managers (one for each window if needed).. This can be accomplished other ways too, but, the overhead of having a different manager for each window is small, at the loss of a couple small convience things (getting the InputManager instance at anytime - you will have to hold on to it).

Anyway, feel free to cast your vote/feelings.
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Singleton - To be or not to be?
« Reply #1 on: May 31, 2006, 08:27:55 PM »

I say make it support multiple windows, a singleton pointer doesn't make much sense with multiple windows, *unless*, you can do something like getSingletonWindow(int) or whatnot....
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Singleton - To be or not to be?
« Reply #2 on: May 31, 2006, 08:47:23 PM »

Yeah, I totally agree. There are ways to work around it.. Like, specifying a window handle when creating objects too.. But, I think that it is just cleaner to have one Window handle per InputManager, and hence, no singleton.
Logged

vectrex

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 33
    • View Profile
    • http://www.kartsim.com
Singleton - To be or not to be?
« Reply #3 on: June 01, 2006, 07:42:42 PM »

Quote from: "pjcast"
Yeah, I totally agree. There are ways to work around it.. Like, specifying a window handle when creating objects too.. But, I think that it is just cleaner to have one Window handle per InputManager, and hence, no singleton.


I'm sure sinbad would have something to say :) Can't have both? :)

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Singleton - To be or not to be?
« Reply #4 on: June 01, 2006, 08:00:03 PM »

If there was an InputManagerManager, than, there could be both ;)
Logged