Here's my entire sound menu, just as a taster of what the new menu framework can do.
CMenu menu_sound ("gfx/p_option.lmp", "Sound Options", M_Menu_Options_f);Nice, isn't it?
void M_Sound_f (void)
{
key_dest = key_menu;
m_state = m_sound;
m_entersound = true;
}
void M_Sound_Init (void)
{
menu_sound.AddOption (&nosound, "Sound Effects");
menu_sound.AddOption (&nomusic, "Music");
menu_sound.AddSpacer ();
menu_sound.AddOption (&volume, "Effects Volume");
menu_sound.AddOption (&bgmvolume, "Music Volume");
menu_sound.AddSpacer ();
menu_sound.AddOption (&ambient_level, "Ambient Volume");
menu_sound.AddOption (&ambient_fade, "Ambient Fade");
}
void M_Sound_Draw (void)
{
menu_sound.Draw ();
}
void M_Sound_Key (int k)
{
menu_sound.Key (k);
}
I've decided to keep the _f, _Draw and _Key functions separate rather than adding them into the class, as for some menus there's a little bit of pre and post setup required. Of course, I could just put them in as callbacks, but that would complicate the _Init function a bit more. Plus, it makes for better code legibility this way, as it's easier to follow the execution path.
I've done a total reworking of video startup and video mode handling. The registry is now no longer used for storing the initial video mode; instead it's good ol' config.cfg. That's the least of the changes - gl_vidnt.c is totally unrecognisable, and the copy-and-paste folks won't be happy with what I've done here... (evil grin)
0 comments:
Post a Comment