Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Graphical User Interface

Author
Message
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 24th Apr 2008 02:37
Is there an easy way to do it with Dark GDK? Like, if I want a window to pop up, but not the standard 'MessageBox'. I want it to be semi-transparent, red, and have text fields for input, and a button to close and submit.

I also need a way to display the armor, shields, and ammo, without using plain, old text.

I don't need an oven to make my cookies.
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 24th Apr 2008 11:46
That requires using Windows, and has little to do with GDK at all. Transparent windows are EX style windows...GDK registers only a std window class, not an ex style.

You will need to register a class, and create/manage your own windows. Once you do that, you can open as many as you like.

It is neither simple, nor easy if you have not done it before, but I could probably help you get it started, but be aware that it requires a deeper understanding of C/C++ and Windows than you might expect.

It would be a great idea to download and install the Platform SDK first, as there is a lot of information there to guide your efforts. Also, you might consider purchasing a book about Windows application programming.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 24th Apr 2008 19:24
Okay. But what about a bar across the top that could be the panel for the ship stats and stuff?

I don't need an oven to make my cookies.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 24th Apr 2008 19:25
And how do I get fullscreen?

Also, jinzai, I know about all that, I was just wondering if Dark GDK had something built-in for it.

I don't need an oven to make my cookies.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Apr 2008 22:03
I am making one. You can do it in DarkGDK without windows at all. Best for Full screen too if you ask me.



If you don't feel like making a full blown own, you can paint up an image, and make a sprite. You can then if you want to really cheat, place button sprites in front of the "Window" and have button up and button down images and change accordingly.. either images or alternate what sprite is displayed. See dbSetSpritePriority to control the zorder.

More than one way to skin a cat.

the one I'm making does 100% 3d GUI (on plains in 3d space, or like pictured here... the rendering is turned to an image and used to display these sprites.

The trick to the transparency has nothing to do with the sprite alpha or transparency commands or anything. I personally, draw the images in a memblock, and then when I'm done, I set the alpha channel in the memblock to the level of transparency I want. 255 for full - opaque, zero == holes. I can make shaped windows really easy like this.. and then I make image from memblock, and use that image like I said on a sprite or a 3d plain.

Have fun!

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 24th Apr 2008 23:39
@Jason

Might I ask what algorithm you're using to balance the intensity of the under color vs. the over color when you do alpha?

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 24th Apr 2008 23:52
Yeah... how do I get the fullscreen thing?


I want my windows to be draggable, but not interfere with the game. Like, when it pops up, it shouldn't minimize the game.

I don't need an oven to make my cookies.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Apr 2008 01:16
LOL - Yeah... But You're giving me more credit than is do on this one. Each Window is a sprite in the screenies I've posted so far. the images.. get this:



That is, it FILLS the "A"lpha channel with the Calculated Opacity percentage across the whole memblock image. I don't have like This BUTTON is more transparent that that one... and then use some fancy merging lerp thingy.

I May, but haven't got that far. I'm fighting THIS stupid issue I can't 100% nail its making me frustrated!

You know when you click a button... then while still holding the mouse down you're like AAHHHH NOO!!! So you draw the mouse OFF the button and then let go? THAT is EASY in theory, but in the message handler, it needs to be coded in multiple places sorta... the press, the up. is it off a window, ok . release that action, it it mouse up over another window? Ok Release... over Same Window? OH.. then need to check if its over same button originally pressed DOWN over... UGH.. simple but I ahven;t nailed it 100%

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Apr 2008 01:29
Right, that's what I'm doing. Its too complex to tell you HOW I'm doing it, but I can Say that following Jenzai instructions wouldn't hurt because that model for GUI that Microsoft uses in the WINAPI is similiar to almost EVERY GUI I know about that is scalable (Meaning works equally well with one ot two windows or a hundred of them .. speed lag aside... hundred windwos is alot LOL )

The trick is making a System that can store "MESSAGES" in a FIFO. Messages like MSG_WINDOWSETFOCUS, MSG_WINDOWGOTFOCUS, MSG_LOSTFOCUS. Baby steps really... Then There is usually two main routines you call for "STOCK" usage, and when you start making your own code control things.. like disabling this button because the user hasn't typed in their name yet etc.. its gets a little trickier... but.. that's called event programming, and its not hard to do, however its a bit hard to MAKE it HAPPEN from scratch.

I also think its fun making GUI and frustrating at the same time.

The way I make it Not interfere with the "Game" to much is that the GUI can be turned on/off AND if on simultaneously, it only REALLY "WORKS" hard when you interact in a way that is "Captured" by the gui.

The reason the gui seems to multi-thread because its only little gear in the proverbial game engine, and like everything else in the game, its multiplexed. (One Thread, tasks all have a turn... some of which only happen at timed intervals, etc) I do have Physics working in a separate thread, and I suspect my eventual multiplayer netorking code will be multithreaded as well... but in short.. the GUI does not interfere with Game Play within reason.

Why within reason? If steps aren't taken, and a window is on the screen, and you say have an FPS game that has mouse camera (eyes) movement.. and the invisible mouse goes over the gui... WHOA.. GUI Owns it! I can make invisible mouse pointer mean don't allow this, I can make it do anything I want really.. like.. Right Click to enable GUI... or not.. whatever.. its not a problem, and I'll simply make it work on a case by case basis so the user gets an interface that makes sense.... at least I'll try

Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 25th Apr 2008 02:45
Okay... calm down, Jason. How do I make buttons?

I don't need an oven to make my cookies.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 25th Apr 2008 03:37
How do I use the Ex style windows to do a custom window? Has anyone played Anarchy Online? They have the kind of windows I want.

I don't need an oven to make my cookies.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Apr 2008 03:42
How do you make buttons?

Well, I always make a base class called widget, and the controls and the window are clilds of the WIDGET class.

I have a Double Linked lists of the GUI WIDGETS. (Usually Windows and/or Menu systems in here). Each Window has a Double Linked List of Widgets. (Buttons qualify )

My Windows have a paint event, and so do my controls...

Controls are always in a Window, and My window always has a "memblock" I'm drawing in.

when I go thourgh my list of widgets in a window, they are pointers to my classes of controls.. (buttons). My windows Paint Event, cycles through the controls, and calls each controls Paint Event.

the Buttons Paint Event has two modes. UP and DOWN. My Buttons naturally have a "Up" flag. During the Button paint - I simply have an IF ButtonUp then draw up else draw it down. The drawing actually is manipulating pixels in the WINDOW Memblock (image stored therein.. like I described in my previous post).

Does that make Sense?

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Apr 2008 03:46
Um.... The platform SDK from Microsoft has alot of reference materials... There is basically the original CreateWindow and an extended one that allows you to do more.. but.. that's only one command out of many to make it all jive.

CreateWindowEx, CreateWindow, GetMessage, PostMessage, SendMessage, (I forget.. Might be a PeekMessage, or its GetMessage with a flag to not pull it off the fifo "yet"), You need Window "Handles" and Control Handles, and message handlers of your own making if you want to do useful things...

Login to post a reply

Server time is: 2024-11-20 09:16:04
Your offset time is: 2024-11-20 09:16:04