logame team mailing list archive
-
logame team
-
Mailing list archive
-
Message #00015
Re: main menu
Hi,
I introduced a new class/module to create a hook for the menus, it's called
Scene (you find it in the game package).
To create a menu you can just derive from this class. By implementing the
tick method you can define the menus logic (It gets called depending on the
framerate).
You'll also need a renderer for the menu, which takes care of rendering the
menu depending on its internal state. Just place the renderer class amongst
the others in graphics.Renderers.
If you want to try you new classes you can alter the main method file in
logame.py like this:
if __name__ == '__main__':
config = MainConfiguration()
config['Weapons'] =
MainConfiguration.load_configuration_file('../config/weapons.yaml')
game = Game(config)
game.is_visible = True
game.renderer = GameRenderer(game)
game.animation_store = AnimationStore(config['Animations'])
game.player_1 = setup_player1(config, game)
game.level = load_test_level(game)
# Your code here:
menu = YourMenuClass()
menu.is_visible = True
menu.renderer = YourMenuRenderer()
window = setup_window(config, game)
# window.render_scene(game)
window.render_scene(menu)
So your menu should be rendered, when starting the program.
If you have questions or stumble upon errors, code smells or design mistakes
just shout. :-)
I'll provide you a method so that you can receive key presses as soon as
possible.
2009/9/15 Christian Smith <csmith@xxxxxxxxxxxxxx>
>
> Is anyone working on a main menu and/or in-game menu? If not, I can take
> over that.
>
> Linux - The better Alternative
>
> _______________________________________________
> Mailing list: https://launchpad.net/~logame<https://launchpad.net/%7Elogame>
> Post to : logame@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~logame<https://launchpad.net/%7Elogame>
> More help : https://help.launchpad.net/ListHelp
>
>
References