MaxGUI pre-game graphics chooser to test

BlitzMax Forums/MaxGUI Module/MaxGUI pre-game graphics chooser to test

WendellM(Posted 2006) [#1]
Here's the current module that I use for letting the user/player choose the graphics settings for a game before it starts.

[UPDATE]
The updated version of this is now in the code archives:
MaxGUI graphics mode chooser




Jesse(Posted 2006) [#2]
compile Error : Identifer GadgetText not found
this is the line:
mode = GadgetText(pgMode)  'SelectedGadgetItem(pgMode)



WendellM(Posted 2006) [#3]
Thanks for your reply, Jesse. It looks like you do have MaxGUI (or else you'd have gotten an earlier error), but I'm at a loss as to why GadgetText is an unfound identifier. It's a standard part of MaxGUI, accessing a standard ComboBox gadget.

To test/isolate it, please try the following:
Strict

Local win:TGadget = CreateWindow( "", 10,10, 320,240 )
Local txt:TGadget = CreateComboBox( 10,10, 100,19, win )
AddGadgetItem txt, "Item 1"
AddGadgetItem txt, "Item 2"

Repeat
	WaitEvent
Until EventID() = EVENT_GADGETACTION

Notify GadgetText(txt)

This should put up a message box showing 'Item 1' or Item 2' when you choose one of them from the combobox. Please let me know if it works for you or gives an error.


Dreamora(Posted 2006) [#4]
If GadgetText is not found, then you need to sync mod as you are working with a quite outdated version.


WendellM(Posted 2006) [#5]
Thank you, Dreamora - I didn't know that GadgetText was one of MaxGUI's later additions (it's not indicated in Versions.doc). So that would seem to explain the error.


kfprimm(Posted 2006) [#6]
actually, it's at the bottom of the module help file,
History Added GadgetText function for accessing Gadget.GetText



WendellM(Posted 2006) [#7]
So many places to look to see what our beloved BlitzMax has been up to recently :) (But I like the "embarrassment of riches" - shows lots of healthy development!) Thanks, Khomy.

(And as it happens, Mark just posted the 1.22 update. I love progress! :) )


Booticus(Posted 2006) [#8]
Hey Wendell! Thanks a ton! This is EXACTLY what I was looking for, and couldnt find it by searching for "resolution switcher" or "choose resolution" etc. I stumbled upon it by accident! Props!


xlsior(Posted 2006) [#9]
Nice...

Booticus: You didn't need to look far, there's actually a fairly similar program included among the standard BlitzMax samples: Help -> Samples -> GUILauncher

Wendell's sample is more polished than the default one (also allowing you to pick your rendering engine and such) but the other one also shows how to mix graphical effects into the GUI.


WendellM(Posted 2006) [#10]
Glad it helped, Mario. I put a somewhat-improved version (fixed a button exclusivity issue) in the code archives a few days ago but should have updated this thread with a link as well. The link: MaxGUI graphics mode chooser


Diordna(Posted 2006) [#11]
I would appreciate it if you would make it possible for it not to be called on startup, but instead at the will of the programmer. I would like to put a "Set resolution" button in somewhere instead of forcing the user to choose it again every time he runs the game.

Oh, and defaulting to DirectX only on Windows would be great too. OpenGL should be the default for Linux and OS X.


WendellM(Posted 2006) [#12]
Thanks for posting, Diordna.

I've commented out the "Test" function call near the top so that it won't self-test by default (just uncomment if desired for stand-alone testing). The example of how to use it in the comments has been updated to better show how it can be called to set graphics whenever desired (though the calling program will need to save/load the graphics settings on its own if it doesn't want to call the module on future runs).

Good point about defaulting to OpenGL on Linux and OS X, but since they don't have DirectX at all, I hid the driver panel on those platforms in addition to defaulting to OpenGL. In trying it out on those, I also found that they needed a bit more room for the combobox (plus more room for its panel in Linux), so I've tweaked the size on those operating systems.

The copy in the code archives has been updated with this new version.