how should a console be implemented
Moderator: Coders of Rage
-
- Chaos Rift Newbie
- Posts: 7
- Joined: Tue Jan 04, 2011 11:00 pm
- Programming Language of Choice: C++
how should a console be implemented
I made a console using win32 controls but I'm not sure how to implement it. I had the idea of making a pure static class because I can't think of a situation where I would need multiple console windows. Does anyone have any better ideas?
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
Re: how should a console be implemented
I can think of many cases where you need multiple consoles. Don't makes it static. Make some base class, and virtual the functions you'll probably change in other consoles, like parseComand() or something.
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
Re: how should a console be implemented
I'm going to have to agree with adikid89 here, making a "pure static class" is rarily necessary or good design. For example, you can have two consoles, having them to be able to pass information to each other would be a nifty little thing for example, which would need you to pass a pointer or reference to another console object.adikid89 wrote:I can think of many cases where you need multiple consoles. Don't makes it static. Make some base class, and virtual the functions you'll probably change in other consoles, like parseComand() or something.
At all, being able to instantiate more than one console is seldom "bad", it totally depends on what you want to do with it, or need. :]
I remember when I used to be into nostalgia.
Re: how should a console be implemented
I don't really understand, I didn't think you could have a "pure static class". You mean a singleton? If you don't need more instances then just don't create any more.
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
Re: how should a console be implemented
I think he means by "pure static" a class that only has static members/methods.
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
Re: how should a console be implemented
Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.
Re: how should a console be implemented
If you are ever doing enough console writing to demand use of multiple windows, then you should not be using default windows console as you have outgrown it.
I will reccommend you write a simple class that creates a new window and another one that lets you write into it. Then you can create a single global-scoped version of the window, and create writers when needed (or globally).
I will reccommend you write a simple class that creates a new window and another one that lets you write into it. Then you can create a single global-scoped version of the window, and create writers when needed (or globally).
You wouldn't pass a class that contains all statics (monostate) by reference.N64vSNES wrote:Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
Re: how should a console be implemented
He didn't say the class should be all static.. in fact he was referring to make a class without statics, and just pass that one by reference.pubby8 wrote:You wouldn't pass a class that contains all statics (monostate) by reference.N64vSNES wrote:Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
Re: how should a console be implemented
Read what I said.pubby8 wrote:If you are ever doing enough console writing to demand use of multiple windows, then you should not be using default windows console as you have outgrown it.
I will reccommend you write a simple class that creates a new window and another one that lets you write into it. Then you can create a single global-scoped version of the window, and create writers when needed (or globally).
You wouldn't pass a class that contains all statics (monostate) by reference.N64vSNES wrote:Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.
Re: how should a console be implemented
Oh, I misread.N64vSNES wrote:Read what I said.pubby8 wrote:If you are ever doing enough console writing to demand use of multiple windows, then you should not be using default windows console as you have outgrown it.
I will reccommend you write a simple class that creates a new window and another one that lets you write into it. Then you can create a single global-scoped version of the window, and create writers when needed (or globally).
You wouldn't pass a class that contains all statics (monostate) by reference.N64vSNES wrote:Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: how should a console be implemented
pubby8 wrote:Oh, I misread.N64vSNES wrote:Read what I said.pubby8 wrote:If you are ever doing enough console writing to demand use of multiple windows, then you should not be using default windows console as you have outgrown it.
I will reccommend you write a simple class that creates a new window and another one that lets you write into it. Then you can create a single global-scoped version of the window, and create writers when needed (or globally).
You wouldn't pass a class that contains all statics (monostate) by reference.N64vSNES wrote:Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.
-
- Chaos Rift Newbie
- Posts: 7
- Joined: Tue Jan 04, 2011 11:00 pm
- Programming Language of Choice: C++
Re: how should a console be implemented
I'm not using the windows console. The console I'm working is made up of one parent window and two edit controls.pubby8 wrote:If you are ever doing enough console writing to demand use of multiple windows, then you should not be using default windows console as you have outgrown it.
I will reccommend you write a simple class that creates a new window and another one that lets you write into it. Then you can create a single global-scoped version of the window, and create writers when needed (or globally).
You wouldn't pass a class that contains all statics (monostate) by reference.N64vSNES wrote:Oh I see.adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
I don't think this is needed, just have a single instance and pass it by reference.