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 / How do I create a Menu bar?

Author
Message
Kerasonb
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Beautiful Southern Oregon
Posted: 24th Feb 2009 15:18
Hi, I am using dark gdk with msvc9 (c++) I have looked at the tutorials but have not seen what I am looking for.

I would like to create a "menu" on the screen. I will be using the menu to do x y z (it will be a very basic user interface for things such as "save game" or "exit"

I would appreciate any help at all. If anyone has a sample or code snippet or tutorial please point me in the right direction. I have spent days scouring the net for such and have found nothing I can use.

I am using c++ with dark gdk and directx aug 2007

Thank you.

I can be contacted by email at kerasonb@gmail.com or you may reply to this post with any help.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 24th Feb 2009 22:24 Edited at: 24th Feb 2009 22:26
You can draw images on the screen, then check if the mouse is in the same area of those images and then check if the mouse button was clicked and if it was then do the actions of that button:



obviously change the capitalized words to the value they say.
Kerasonb
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Beautiful Southern Oregon
Posted: 24th Feb 2009 22:43
Thanks I will give this a try. I guess I should have said also that I need to be able to move the "menu" around on the screen I will try this and see if there is a way that I can set the image to be moved. I am familiar with the idea of 'hot spots' on images from my experience with website construction. I am sure you know you can do the same thing with web images. The problem I have run into is when you resize the screen the x,y coords don't change and so the image moves but the "hot spot" does not. Is that the case here?

ex: window is 800x600 and user has a 1280x1024 resolution.. he clicks maximize or drags the screen to a larger size. the result is a whole new set of coords for the 'image menu'

in the example above will the x,y coords be updated? or do I need to do something to make the relevant adjustments? I can see how an algorithm to adjust the coords for screen rez / screen size adjustment...similarly there could be an algorithm for when the "image menu" is moved on the screen... but anyway to my question will I need to make these functions or is that done for me by windows?
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Feb 2009 00:53
@Kerasonb
All DBPro coordinates are in directx space rather than screen space, and so you needn't worry about scaling problems unless you are using the windows api.

When the user makes the window bigger, the values returned by dbMouseX/Y scale down accordingly, so the midpoint of the window will always be half the resolution of the window, no matter what the size of the window is.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 26th Feb 2009 09:52 Edited at: 26th Feb 2009 09:54
Quote: "@Kerasonb
All DBPro coordinates are in directx space rather than screen space, and so you needn't worry about scaling problems unless you are using the windows api"


Only if you use 3D objects. If you use any of the 2D commands they will not be "resized" if the window is. e.g I paste a 1024x1280 image on a 1024x1280 resoloution it will be full screen, at 640x480 it will just be a segement of the image it wont change to look how it did previously. You could just have a set resoloution and not allow the user to change it, but users like chaning the screen resoloution Especially if its full screen app. By resoloution I am mean the rendering resoloution not when you resize the window.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Feb 2009 00:28
Quote: "Only if you use 3D objects."


Um... Did you even bother reading my post before you posted that...

The resolution of the GDK app and the resolution of the screen, and the client size of the GDK window are all completely separate things.

Both 2d and 3d objects are in GDK coordinates, and so changing the size of the window will scale them both, but it will also scale the results returned from dbMouseX()/dbMouseY() to counter for this change.

Changing the resolution of the window will affect everything, but DBPro will automatically adjust the 3d viewport, and so you won't notice a change for 3d things.

Changing the resolution of the screen will scale EVERYTHING, including windows coordinates, and so has no effect on the application (except if it is maximised, it will change the client size of the window).

If GDK is in fullscreen exclusive mode, then the resolution of the screen and the GDK resolution are forced to be the same.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!

Login to post a reply

Server time is: 2024-09-30 19:22:45
Your offset time is: 2024-09-30 19:22:45