Jump to content
  • Advertisement
Sign in to follow this  
darcmagik

In Game Console window using DirectX 11

This topic is 906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everybody I'm back again with another problem I'm trying to solve and hoping for some advice from all of you game developers.  So I'm trying to implement an in game console window like you would find in unreal games, or other games where you press the ~ key on the keyboard and a little window pops up on top of the screen and you can enter commands.  Now as far as accepting the commands and how to handle those commands I already know how I want to handle that but I'm trying to figure out the best way to handle drawing the console window on screen and drawing the text that is being typed.

 

I have been researching this for a couple weeks now and I have an example of how to do this in Direct X 9 where you just draw a quad made up of 2 triangles and then it uses D3DX sprite font functionality to draw the text to the screen.  I'm already using DirectXTK library in the game so I am leaning towards using the primitive batch that allows drawing a quad to the screen, and then using their sprite font functionality to draw the text.

 

I'm wondering however if anybody knows of any thing out their that is already pre built that I could implement into my engine?  I only ask because this console system is going to be what I'm going to use for entering commands to enter the in game level editor being used by the team to build the actual maps the player will play in when the game is complete.  I admit I'm looking for a short cut here because I already have a daunting task of building the level editor in the engine.

 

So in conclusion what is everybody's thought on how to implement the console window in game?

Share this post


Link to post
Share on other sites
Advertisement

I added one recently using dear imgui, and basically copying some of their examples :) Took about 10 minutes to build the console (after going through the process of integrating the imgui library into my engine).

Share this post


Link to post
Share on other sites

The quickest solution would be IMGUI as suggested. I was never convinced it looked that great though and had limited skinning possibilities. I could be wrong though. If my understanding is correct and you wanted to ship the console with your game, it might be better to roll your own.

Share this post


Link to post
Share on other sites

My super basic console consists of a quad dimming part of the screen, and then using a text library (FW1) to render text on top of it :)

Edited by vinterberg

Share this post


Link to post
Share on other sites

Thank you guys for your comments and suggestions I have decided to role my own console system which I am working on currently, I have been able to get the quad to display on the screen at the location I want it to now I'm working on getting the text to display at the right location and scrolling, etc, etc.

Share this post


Link to post
Share on other sites

examples_04.png

 

That's how the dear imgui console example looks like (upper-right)

It shows ways to do completion, history, filtering. It is merely a sample that is, so probably need readjusting but can be used as a base.

 

It's ok and not too hard to roll your own but with an existing library you'll probably be able to do much more.

 

Skinning wise, one reason the default skin in dear imgui looks fugly are that a) the font is embedded in the code b) most rounded shapes have been disabled by default. c) the color scheme isn't good (the buttons are horrible). so that's something to work on.

 

This is what some people have been working on. Notice it is still close but you can get a long way by changing font / color / rounding settings.

 

OdenVR

https://cloud.githubusercontent.com/assets/840235/13230096/55e766f6-d9a4-11e5-9d30-419f0f2576e2.png

 

Some OSX looking color scheme

https://cloud.githubusercontent.com/assets/8225057/12702454/ecd396b6-c829-11e5-9501-1b507a305395.png

https://cloud.githubusercontent.com/assets/8225057/12702458/f23eddae-c829-11e5-8188-b4a6b60b0b36.png

https://cloud.githubusercontent.com/assets/8225057/12702456/f20d4618-c829-11e5-9dfd-045e267ccdde.png

https://cloud.githubusercontent.com/assets/8225057/12702459/f26f22fc-c829-11e5-96cc-2f2d035dd0cc.png

 

LumixEngine

https://cloud.githubusercontent.com/assets/153526/13794457/2665936c-eafc-11e5-811d-9757b24b8d05.png

 

Tools for Lumote game

https://cloud.githubusercontent.com/assets/4952023/13963091/3f8caedc-f021-11e5-8709-90c8ea7df1c0.png

Edited by ocornut

Share this post


Link to post
Share on other sites
Thanks for the links ocornut, it's interesting to see what people have done with IMGUI.

Share this post


Link to post
Share on other sites

After spending the day yesterday trying to roll my own version of a console system I have decided that I am going to try out the imgui and see how well it works implementing it into my engine.  I will post more later after I see how well it works.

Share this post


Link to post
Share on other sites

New thought about the situation because I'm still going back and forth over the idea of using a pre built solution or building my own.

 

If I build my own when it comes to handling commands that are entered into the console I'm planning on having quite a few commands built into the system for level editing and other tasks.  The part that I'm still going back and forth on is do I use a simple switch statement for each command and have it call a function or do I setup a key, value maybe a c++ map relationship where each command has a function pointer attached to it and then I can simply find the pair in the map and have it call the specific function through the pointer.  I realize they will essentially both do what I need it to do the question is which was is more efficient and just an all around better idea for this task.  I can see how I would implement both ideas but can't decide which one is better...  I guess I will sleep on it tonight and see what people's thoughts are tomorrow.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!