Skip to main content
gamedev.net
🔒 Locked

Fullscreen/Windowed

Started by Magmatwister Sep 24, 2010 at 11:13 AM 9 replies 1.5k views
Original Post
Magmatwister
Magmatwister
So basically I want a console in my game, but I want the console to have the WS_EX_LAYERED style (Just so it can be transparent, if there is another way of doing this then tell me), but this prevents me from making this console a child window to my main window. As well as this, when I go fullscreen, my console window obviously won't be shown up. The other thing is that I need to have the window move-able within the parent window. In other words it can't be static as it is default if it's a child window afaik.

So the TL;DR of it is:

The window has to be able to be/do:
Fullscreen/Windowed
Clip it to the parent window
Be semi-transparent in the parent window
Be moveable
Currently trying to make a planet renderer. After many hours of work, somehow I know It'll never be complete.
Also, If I help you, please give me an ++
MJP
MJP
As far as I know, you can't do that without totally drawing the window yourself.
Magmatwister
Magmatwister
Quote:
Original post by MJP
As far as I know, you can't do that without totally drawing the window yourself.



*Gulp* and what would that involve?
Currently trying to make a planet renderer. After many hours of work, somehow I know It'll never be complete.
Also, If I help you, please give me an ++
DieterVW
DieterVW
A custom in app UI library.
Magmatwister
Magmatwister
Quote:
Original post by DieterVW
A custom in app UI library.


In other word's, it's out of my league? I don't mind having a go at it, but I need to know the basics of what would be involved. Could you point me in the right direction or give me a few links or advice?
Currently trying to make a planet renderer. After many hours of work, somehow I know It'll never be complete.
Also, If I help you, please give me an ++
DieterVW
DieterVW
Which D3D api are you using? If you can use Direct2D then it'll be a bit easier. D2D provides easy vector graphics with shading and text/layout API's and structures.

Anyway, you'll have to probably code all of the parts yourself which isn't hard, though it could be time consuming depending on the features you want. You'll need something to represent the UI and know when it's selected so that commands and key strokes can be funneled too it. It'll probably need a title bar so that it can be moved around the screen and resize controls on the edges. If you want cursor animations then you'll have to draw that too.

You'll need a buffer to capture the text you want to display, and then some way to mark the span of text that will be drawn, since it's likely that it'll more than fill the screen if this is just a console.

Transparency will be fairly easy since this stuff will just be blended over the render target after the main frame is done.

If you want text editing controls, that bit will take a bit longer. Direct2D has lots of helper items for creating and hit testing text layouts, which is a huge time saver. That will help you get cursor and text locations so that things can be copied/pasted and edited.

You may also need buttons or a scroll bar, though if you can do with arrow up/down or page up/down then it'll some coding time.

You could also save time by making it just a drop down console, with no concept of resize or movement. Just a text display area where something like ~ can open and close it.
Magmatwister
Magmatwister
Quote:
Original post by DieterVW
Which D3D api are you using? If you can use Direct2D then it'll be a bit easier. D2D provides easy vector graphics with shading and text/layout API's and structures.

Anyway, you'll have to probably code all of the parts yourself which isn't hard, though it could be time consuming depending on the features you want. You'll need something to represent the UI and know when it's selected so that commands and key strokes can be funneled too it. It'll probably need a title bar so that it can be moved around the screen and resize controls on the edges. If you want cursor animations then you'll have to draw that too.

You'll need a buffer to capture the text you want to display, and then some way to mark the span of text that will be drawn, since it's likely that it'll more than fill the screen if this is just a console.

Transparency will be fairly easy since this stuff will just be blended over the render target after the main frame is done.

If you want text editing controls, that bit will take a bit longer. Direct2D has lots of helper items for creating and hit testing text layouts, which is a huge time saver. That will help you get cursor and text locations so that things can be copied/pasted and edited.

You may also need buttons or a scroll bar, though if you can do with arrow up/down or page up/down then it'll some coding time.

You could also save time by making it just a drop down console, with no concept of resize or movement. Just a text display area where something like ~ can open and close it.


Unfortunately, I'm using Direct3D. However, if I can mix Direct3D with Direct2D then I have no problem with using it if it'll make this process easier. I'm just starting to fully realise the enormity of what I'll be undertaking if I do this, It won't be difficult but I'm going to have to include ALOT of functionality to this. Among them would be detecting when the mouse is hitting the window at any one time, when it's in focus, handling text when it is in focus... At the moment I am considering all this in a Direct3D way of a mind, whereby I will just draw a transparent quad or do as you suggested and blend it over the main frame and then add all the features that I need to it. I suppose I'm going to have to though. So if possible shall I try and integrate direct3d with direct2d or is that not possible. I've never used 2d.
Currently trying to make a planet renderer. After many hours of work, somehow I know It'll never be complete.
Also, If I help you, please give me an ++
DieterVW
DieterVW
Which version of D3D are you using? Is targeting vista/win7 enough? If you need to target XP then Direct2D won't work for you.
Magmatwister
Magmatwister
Quote:
Original post by DieterVW
Which version of D3D are you using? Is targeting vista/win7 enough? If you need to target XP then Direct2D won't work for you.



Yes, I'm targeting directx9 atm, but dx11 also in the future, both for windows 7 or vista.

Currently trying to make a planet renderer. After many hours of work, somehow I know It'll never be complete.
Also, If I help you, please give me an ++
MJP
MJP
You might want to check out something like CEGUI, so you don't have to implement the UI stuff yourself.
Jamoflaw
Jamoflaw
I used a 2x2 texture and stretched it over the top half of the screen when active. I then have a std::vector of std::strings and use a reverse iterator to draw the console lines to the window using my bitmap font class. the basic idea came from Advanced 2d game programming by JonathanHarbour

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.