Versatile in-game menus
I''m working on my first real game project, and I''ve completed one of the foundation pieces for the game. To move forward I wanted to create a menu system where I could simply create a class(or something similar) with all the buttons and gfx''s I needed. However after some short mulling over in my head I realize I have no idea how to go about it, and was hoping for some extensive advise/links on the topic.
Thanks
I was talking with a friend of mine about this not too long ago. He didn''t see the point in our discussion, but now that you''ve brought it up, I''ll bring back my idea for scripted menus.
You don''t need a full-blown scripting language to write scripts, as long as you have a fast parser and can execute them quickly. The idea is that you provide data for your menus in the form of a script, and you load the script when you need the menu.
Here''s a really crappy example to demonstrate:
Button[0] {
image_up= "button0a.bmp";
image_dn = "button0b.bmp";
image_hvr = "button0c.bmp";
sizex = 120;
sizey = 20;
action = EXECUTE_ATTACK;
}
Of course, you can organize your scripts anyway you like, and you don''t have to use a class structure like this. You might also want to allow for multiple button actions, in case the purpose of a button changes. You''ll also want to provide support for disabling/enabling buttons at anytime.
If you''re using Visual Basic 6, or you have the option of doing so, I''d suggest creating a wrapper library for your button scripts since VB6 supports the new "Call By Name" method. That way you can give provide a function name in the "action" property, assuming the function belongs to an object.
If you''re not using VB, you might be able to do this with C++, but I couldn''t tell you how. I hope this helps anyway.
You don''t need a full-blown scripting language to write scripts, as long as you have a fast parser and can execute them quickly. The idea is that you provide data for your menus in the form of a script, and you load the script when you need the menu.
Here''s a really crappy example to demonstrate:
Button[0] {
image_up= "button0a.bmp";
image_dn = "button0b.bmp";
image_hvr = "button0c.bmp";
sizex = 120;
sizey = 20;
action = EXECUTE_ATTACK;
}
Of course, you can organize your scripts anyway you like, and you don''t have to use a class structure like this. You might also want to allow for multiple button actions, in case the purpose of a button changes. You''ll also want to provide support for disabling/enabling buttons at anytime.
If you''re using Visual Basic 6, or you have the option of doing so, I''d suggest creating a wrapper library for your button scripts since VB6 supports the new "Call By Name" method. That way you can give provide a function name in the "action" property, assuming the function belongs to an object.
If you''re not using VB, you might be able to do this with C++, but I couldn''t tell you how. I hope this helps anyway.
GDNet+. It's only $5 a month. You know you want it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement