Simple Options Menu and Interface?

Started by
2 comments, last by ValMan 15 years, 9 months ago
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?
Advertisement
hi
here is a nice site with tutorials for sdl

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

hope you find it useful.
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?
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

This topic is closed to new replies.

Advertisement