Well it's been a while since I posted anything and that is for the most part, because I've been knee-deep in my own projects. The major project is the D3DMenu Base. Here's where I've come so far.
- Completed Designing Menu
- Finishing RoughDraft of Menu classes
- Beginning work on D3DFonts
What's left to do? a lot.
Detouring the D3D functions.
incorporating D3D into the menu.
Here is a rough outline:
Im borrowing from a lot of people on this menu. Trying to strike a balance between a menu that is extremely specific and built for one game, and a more something extremely general. I want to make the code extremely easy to use and more importantly understand with few dependencies for compilations, for this reason I will try to use MS Detours class instead of Azorbix's. Im creating the menu with the e***asis on the menuitems instead of the menu itself. This way the menu only has to worry about working with menuitems and categories, but the menuitems will render and navigate themselves. Still a very rough sketch at the moment, but here are a few sneak peeks I guess. =/
I'm most proud of my option structure so I will show you that:
Code:
struct Option
{
int optmax;
int optmin;
char type;
static int optcount;
char str = new char[50];
char* strArray = new char*[20];
int i = 0;
float f = 0.0;
Option(char t, int initval = 0, int min = 0, int max = 1)
{
optmax = max;
optmin = min;
i = inintval;
f = initval;
optcount = initval;
type = t;
}
void operator++() //opt++;
{
switch(type)
{
case 'i': //is int?
if(i == optmax)break; //will not increment if option is at lowest value
i++;
break;
case 'f': //is float?
if(f == optmax)break; //will not increment if option is at lowest value
f++;
break;
case 's': //is string?
if(optcount == optmax)break; //will not increment if option is at lowest value
strcpy(str, strArray[++optcount]);
break;
default:
break;
}
}
void operator--() //opt--;
{
switch(type)
{
case 'i': //is int?
if(i == optmin)break; //will not decrement if option is at lowest value.
i--;
break;
case 'f': //is float?
if(f == optmin)break; //will not decrement if option is at lowest value.
f--;
break;
case 's': //is string?
if(optcount == optmin)break; //will not decrement if option is at lowest value.
strcpy(str, strArray[--optcount]);
break;
default:
}
}
}
/*EXAMPLE OF INITIALISING: Option
//integer
Option opt('i',0,0,1);
//string
Option opt('s',0,0,4);
opt.strArray[0] = const "off";
opt.strArray[1] = const "bunny";
opt.strArray[2] = const "Micheal Jordan";
opt.strArray[3] = const "superman";
*/
See the options can be incremented like they are variables regardless of rather your storing floats, integers, or even strings. There is no need for special exceptions in the menu design, everything fits, and if you which to add a different variable then room can be made.
Well a lot more to do. I thought I would be able to design the menu without thinking about the DirectX stuff, and while for the most part that's true I think it would help to sort of meet halfway. Most of my code I've written so far is on paper, so I don't have much to show for it, but hopefully I'll have a lot more typed out soon enough.
Thanks for reading, or not reading =/