how should a console be implemented

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Void Mapper
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 7
Joined: Tue Jan 04, 2011 11:00 pm
Programming Language of Choice: C++

how should a console be implemented

Post by Void Mapper »

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?
User avatar
adikid89
Chaos Rift Cool Newbie
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

Post by adikid89 »

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
==============================================================
Image
D-e-X
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Tue Dec 28, 2010 6:49 pm

Re: how should a console be implemented

Post by D-e-X »

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.
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.

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.
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: how should a console be implemented

Post by N64vSNES »

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.
User avatar
adikid89
Chaos Rift Cool Newbie
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

Post by adikid89 »

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
==============================================================
Image
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: how should a console be implemented

Post by N64vSNES »

adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
pubby8
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 58
Joined: Mon Feb 07, 2011 12:22 am

Re: how should a console be implemented

Post by pubby8 »

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).

N64vSNES wrote:
adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
You wouldn't pass a class that contains all statics (monostate) by reference.
User avatar
adikid89
Chaos Rift Cool Newbie
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

Post by adikid89 »

pubby8 wrote:
N64vSNES wrote:
adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
You wouldn't pass a class that contains all statics (monostate) by reference.
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.
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
Image
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: how should a console be implemented

Post by N64vSNES »

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).

N64vSNES wrote:
adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
You wouldn't pass a class that contains all statics (monostate) by reference.
Read what I said.
pubby8
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 58
Joined: Mon Feb 07, 2011 12:22 am

Re: how should a console be implemented

Post by pubby8 »

N64vSNES wrote:
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).

N64vSNES wrote:
adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
You wouldn't pass a class that contains all statics (monostate) by reference.
Read what I said.
Oh, I misread.
User avatar
Falco Girgis
Elysian Shadows Team
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

Post by Falco Girgis »

:lol:
pubby8 wrote:
N64vSNES wrote:
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).

N64vSNES wrote:
adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
You wouldn't pass a class that contains all statics (monostate) by reference.
Read what I said.
Oh, I misread.
:lol:
Void Mapper
Chaos Rift Newbie
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

Post by Void Mapper »

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).

N64vSNES wrote:
adikid89 wrote:I think he means by "pure static" a class that only has static members/methods.
Oh I see. :lol:

I don't think this is needed, just have a single instance and pass it by reference.
You wouldn't pass a class that contains all statics (monostate) by reference.
I'm not using the windows console. The console I'm working is made up of one parent window and two edit controls.
Post Reply