Jump to content
  • Advertisement
Sign in to follow this  
yamaki308

how to create a console window using directX

This topic is 3759 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

I'm using DirectX 9.0c SDK and Visual Studio 2005 for my next 3D game. I'm want to create a console window on the screen but I'm not sure how? Do you have any suggestions of what to do? I can figure out the rest but I just need a way to help me get started.

Share this post


Link to post
Share on other sites
Advertisement
The console in my game is just a textured quad with trasparency (to make it look nice). With D3DXMatrixTranslation I make the quad go up and down.

For the text I use Direct3D DrawText function ... I think this is the standard way to create a simple console.

Share this post


Link to post
Share on other sites
Quote:
Original post by arc4nis
The console in my game is just a textured quad with trasparency (to make it look nice). With D3DXMatrixTranslation I make the quad go up and down.


sorry for hijack, but if u translate it to go up, does that mean that you still have to draw it every frame?

Share this post


Link to post
Share on other sites
There are two methods:

1. Draw the background quad(s) and text each frame and offset their position on the fly as you minimise the console to the top of the screen.

2. Render the console to texture (and only when something on it changes) and then render that texture to a quad and slide that one quad upwards.

Share this post


Link to post
Share on other sites
As Dave said, the easy way is to draw it every frame which is performance unwise, the way to go is to render it to a texture only if something changes.

Share this post


Link to post
Share on other sites
If you don't need to be able to see the console in DX you can set the subsystem to console. This will give you the console window used in console apps and you can use std::cin and std::cout to communicate with it. Of coarse to stop cin calls pausing your game you will need to use multi-threading but this is much simpler than the other solutions posted.


In VC it's project properties->Linker->System and then the first property. However you will need to use main instead of winmain. (To get a HINSTANCE use GetModuleHandle(NULL); )

Share this post


Link to post
Share on other sites
Quote:
Original post by Khaos Dragon
How would one direct printf output into a char* for the purposes of rendering the text into your direct3D console window?


Well, there's really no reason to do that, and it probably wouldn't be the best idea to try. You're much better off rolling your own printf() function tailored to the new console.

Share this post


Link to post
Share on other sites
Quote:
Original post by Flimflam
Quote:
Original post by Khaos Dragon
How would one direct printf output into a char* for the purposes of rendering the text into your direct3D console window?


Well, there's really no reason to do that, and it probably wouldn't be the best idea to try. You're much better off rolling your own printf() function tailored to the new console.


sprintf()

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave
Quote:
Original post by Flimflam
Quote:
Original post by Khaos Dragon
How would one direct printf output into a char* for the purposes of rendering the text into your direct3D console window?


Well, there's really no reason to do that, and it probably wouldn't be the best idea to try. You're much better off rolling your own printf() function tailored to the new console.


sprintf()


Well, yes, but that's not quite what he was asking, although it would have made sense for me to point that out. He wanted (as I read it) to continue using printf and simply redirect STDOUT. I suppose I could have mentioned sprintf though.

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!