Jump to content
  • Advertisement
Sign in to follow this  
Sean_Seanston

Simple Options Menu and Interface?

This topic is 3742 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 planning on doing some kind of top-down shooter next, having completed Space Invaders and Pacman, but I was wondering about how to implement some kind of visual interface. e.g. just make it so that pressing Esc brings up a small set of options like Quit etc. and making it so that you can click on some kind of buttons at the bottom of the screen with the mouse. I'm using C++ and SDL. Is something like that quite difficult with SDL? Would I be best waiting until I start with DirectX or OpenGL?

Share this post


Link to post
Share on other sites
Advertisement
hi
here is a nice site with tutorials for sdl

http://lazyfoo.net/SDL_tutorials/lesson09/index.php

hope you find it useful.

Share this post


Link to post
Share on other sites
Ya, I've used Lazy Foo's site before... t'is quite cool. So, is it just a matter of using a lot of mouseover stuff? Could that even be used to create some kind of movable window in-game?

Share this post


Link to post
Share on other sites
To create a draggable widget, you would follow roughly these steps:

On Mouse Down:
- Save current mouse position ("DragOffset")
- Set "dragging" flag
- Capture mouse by only sending mouse messages to widget being dragged

On Mouse Up
- Reset "dragging flag"
- Release mouse capture on the dragged widget

On Mouse Move
- If dragging flag is not set, don't do anything
- If it's set, then set new position of the widget:

NewPosition.x = CurrentPosition.x + MousePosition.x - DragOffset.x
NewPosition.y = CurrentPosition.y + MousePosition.y - DragOffset.y

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!