Well I have been working on this menu for a while now and so far I have had nothing to show for it, but finally I can present a little proof that I have in fact been doing something. xD
Check it out: Right arrow to increment and left to decrement
It's still really buggy, but Im smoothing out the edges as I post this. hopefully tommorrow I will be able to get out all the bugs. Next I will render an entire Catergory o_O! And finally an entire menu. Once I get all the bugs out I will go about converting it to DirectX once I get my detour down.
It doesn't look like much, but this took well over 200 lines of code and its still very incomplete. Why so much for such a small effect? well the MenuItem is meant to basic building block of the menu. All other classes simply control these items. And this is filled with a lot of extra stuff meant to play a part when menu is in full effect.
EDIT: just fixed bug where it would delete item name.
Last edited by why06; 03-12-2010 at 10:02 PM.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
What do you guys keep packing your stuff with to get these weird Trojan warnings (Virustotal.com).
~
"If the world hates you, keep in mind that it hated me first." John 15:18
Lol. I never pack my stuff. If you don't believe me open it up and view the disassembly in Olly or something. Should see some calls to print statements, GetAsyncKeyState, etc. But I only log left, right, up, and down arrow. So you should only see the hexcodes for those numbers passed to the stack. I don't know why it's saying its a trojan... didnt even Virus scan. Maybe it's because it's so small. idk... =/
EDIT: https://www.virustotal.com/analisis/4...640-1268486166
Lol. I guess your right. Guess my programs got AIDS o_O. Sorry guys now all ur computers got AIDS too.
Last edited by why06; 03-13-2010 at 07:31 AM.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
Doesn't matter to me I was just saying that to get you digress from whatever weird stuff that could ward of newbies from downloading your content.
~
As a rule I run all small forum programs in a sandbox (Sandboxie - Sandbox software for application isolation and secure Web browsing)
"If the world hates you, keep in mind that it hated me first." John 15:18
Nice work Why06 keep doing your great job
Thanks. Actually I could use a bit of help with one little problem. Ill post some of the source.
Compile this and you will see that there are two element is the array named opt, and I have no clue why that is. I'm using Dev-C++ to compile, but I'll try in VS and see if I get the same thing.Code:#include <iostream> #include <sstream> #include <stdio.h> #include <windows.h> using namespace std; const static int MAX_OPTIONS = 10; struct Option { bool selected; // for multi option items int optmax; int optmin; char type; int optcount; string str; string strArray[10]; int i; //0 float f; //0.0 Option(char t, int initval = 0, int min = 0, int max = 1) { optmax = max; optmin = min; i = initval; f = initval; optcount = initval; type = t; } void inc() //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 - 1)break; //will not increment if option is at lowest value str = strArray[++optcount]; break; default: break; } } void dec() //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. str = strArray[--optcount]; break; default: break; } } string print() { string s; stringstream out(stringstream::in | stringstream::out); switch(type) { case 'i': char buf[50]; s = itoa(i, buf, 10); break; case 'f': out << f; s = out.str(); break; case 's': str = strArray[optcount].c_str(); return str; break; default: return s; } return s;//redundant? no. ;) } }; int main() { Option** opt; opt = new Option*[MAX_OPTIONS]; for(int i=0; opt[i]; i++)cout<<"element: " <<i << " exists."<<endl; system("pause"); return 0; }
Result From Visual Studios:
Result From Dev-C++:Code:element: 0 exists. element: 1 exists. element: 2 exists. element: 3 exists. element: 4 exists. element: 5 exists. element: 6 exists. element: 7 exists. element: 8 exists. element: 9 exists. element: 10 exists. element: 11 exists. element: 12 exists. element: 13 exists. Press any key to continue . . .
With the same exact code.... Oh lord. Is it to much to as for consistency between different compilers. those elements should be null... >_>. why does it seem like there is something there?Code:element: 0 exists. element: 1 exists. Press any key to continue . . .
Any ideas? Your guess is as good as mine. =/
Last edited by why06; 03-13-2010 at 07:21 PM.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
What is this suposto be exactly?
Use wxDev-C++ btw. It's an updated project with wxWidgets support (something like that) suppose to allow for GUI code portability across platforms.
~
"If the world hates you, keep in mind that it hated me first." John 15:18
Doesn't really matter. It's just a structure. the main method is all that's important... and the results.
@Arhk: didn't know about. thanks 4 the tip.Code:int main() { Option** opt; opt = new Option*[MAX_OPTIONS]; for(int i=0; opt[i]; i++)cout<<"element: " <<i << " exists."<<endl; system("pause"); return 0; }
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
why06 (03-14-2010)
o___O... goodboy.
Anyway figured out the problem was that under C++ ISO new does not zero the memory region being used for your array... kind of makes me wonder what
's the point of allocating an array of a specific size, but whatever. Anyway my first idea was to use a for loop and zero it all, but I decided to use memset instead. I've been at this for a while now, but more and more I start figuring out how I depended on the compiler in Java to handle bounds checking and garbage collecting. Still not use to specifying so much. Anyway:
that's the fix.Code:int main() { Option** opt; cout<<&opt<<endl; opt =(Option**) new Option*[MAX_OPTIONS]; memset(opt+1, 0, sizeof(Option*)*(MAX_OPTIONS-1)); cout<<strlen((const char*) opt)/4; //NULL all elements. Guess I have to handle this myself. screw u compliler >:| for(int i=0; opt[i]; i++)cout<<"element: " <<opt[i] << " exists."<<endl; system("pause"); return 0; }
Also found out this neat trick to find the size of any array using strlen(). So pretty neat trick I guess.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
I'm pretty sure that you null the array memory in its declaration
int array[n] = 0;
~
but I got that style of instruction from an 80's C book.
Last edited by Arhk; 03-14-2010 at 02:29 PM.
"If the world hates you, keep in mind that it hated me first." John 15:18