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 / Skinning the Window!

Author
Message
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 12th Jun 2008 09:16
I would like to get rid of the standard Window border and have my own window border with my own graphics. ie Skinning

I thought of 2 ways of doing this:

1. use dbSetWindowLayout() to switch OFF Window border and minimize/maximize icons. then paste my border graphics every loop. This way though I would have to write a move Window handler to move the Window around the screen when the user clicks LMB on the top border. I tried doing this using dbMouseMove but was not very successful.

2. Use Windows API to configure look of minimize/maximize icons, width of windows borders etc..

any hints or suggestions?
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 12th Jun 2008 20:02
Can you use an image/sprite combination with alpha fading where you want everything else to show through? If you gave it a high enough priority it would be in the foreground and you wouldn't have to paste it every loop.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 12th Jun 2008 20:34
yes this would be a good option, but right now the bigger prroblem is the emulation of clicking the caption bar and dragging the window around the screen
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 12th Jun 2008 22:46 Edited at: 13th Jun 2008 00:41
Okay, i've written an example of how to do what you want. Make a new DGDK project and paste this into main.cpp:



That is a fully working, fully commented example, tested here. Instead of sprites I have just drawn a box in the top of the screen - you can use a sprite if you like. I've also calculated if the mouse is over the box manually - you could just position another sprite at the mouse position and check for sprite hit I guess.

Whatever you like Obviously in a real world situation you wouldnt hard code values like I have because it doesnt account for the user changing the window size etc.

The key to this is using the winapi functions to get and set the position of the window. We use the HWND stored in the dgdk globstruct to tell the winapi which window we're talking about. For detailed information about the functions i've used either google them or copy/paste them into msdn and it will explain each and every parameter

Hope this mini tutorial helps!

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 13th Jun 2008 10:06
works perfectly.

thanks a million Sephnroth.

Login to post a reply

Server time is: 2024-09-29 23:20:24
Your offset time is: 2024-09-29 23:20:24