could you use a joystick like this for games like starwars?
Yes
How would you set it up in the control settings in mame, as a mouse or what?
Just like posted by Kermmit, just enable joysticks, except...
Same question for a steering wheel, I'd like to have both of these controllers where I could just plug them into a usb port when I wanted to use them, but not have them in use all the time.
If you always have both plugged in, you'll have to remap depending on how windows numbers them. If the stick is joystick 2, then you'll have to remap starwars (and other analog joystick games); if the wheel is joystick 2, then you'll have to remap the driving games: Tab, "Input (this game)", select the direction, enter, move stick/wheel, repeat last three. (For more details on remapping,
MameFAQ or
easyemu.)
Is there a setting in mame that I could change in the general controls that wouldn't mess up my regular control settings or would I just have to change the controls in each game individually?
One thing you can do is set up two ctrlr files: one for the stick, the other for the wheel. Then make game specific ini files with only one line in them "ctrlr stick" or "ctrlr wheel" (assuming you named the ctrlr files "stick.cfg" and "wheel.cfg"). Ctrlr files are a little harder to describe, so it will be easier for us helpers if you looked at
easyemu's ctrlr page and the ctrlr files that comes with mame binary (in the ctrlr folder), and then asked specific questions if you have any.
You can also unplug the unused controller before you start mame instead of any remapping, but you have to remember to do so everytime you switch.
It's a little easier to do the ctrlr files IMO, but it is a little more learning up front. [shrug]