from logging import info
-from panda3d.core import Texture, TextNode, WindowProperties, LVector2i
+from sys import platform, exit
+from os import environ, system
+from webbrowser import open_new_tab
+from panda3d.core import Texture, TextNode, WindowProperties, LVector2i, \
+ TextProperties, TextPropertiesManager
from direct.gui.DirectGui import DirectButton, DirectCheckButton, \
DirectOptionMenu, DirectSlider, DirectCheckButton
from direct.gui.DirectGuiGlobals import FLAT
text=_('Play'), pos=(0, 1, .6), command=self.on_play,
**self._common_btn)]
self._widgets += [DirectButton(
- text=_('Options'), pos=(0, 1, .3), command=self.on_options,
+ text=_('Options'), pos=(0, 1, .2), command=self.on_options,
**self._common_btn)]
self._widgets += [DirectButton(
- text=_('Support us'), pos=(0, 1, 0), command=self.on_play,
+ text=_('Credits'), pos=(0, 1, -.2), command=self.on_credits,
**self._common_btn)]
self._widgets += [DirectButton(
- text=_('Credits'), pos=(0, 1, -.3), command=self.on_play,
- **self._common_btn)]
- self._widgets += [DirectButton(
- text=_('Exit'), pos=(0, 1, -.6), command=self.on_play,
+ text=_('Exit'), pos=(0, 1, -.6), command=lambda: exit(),
**self._common_btn)]
def _set_options(self):
text=_('Back'), pos=(0, 1, -.8), command=self.on_back,
**self._common_btn)]
+ def _set_credits(self):
+ self._widgets = []
+ tp_scale = TextProperties()
+ tp_scale.set_text_scale(.64)
+ TextPropertiesManager.getGlobalPtr().setProperties('scale', tp_scale)
+ self._widgets += [OnscreenText(
+ _('Code and gfx\n \1scale\1Flavio Calva\2\n\n\nMusic\n \1scale\1Stefan Grossmann\2'),
+ pos=(-.9, .55), font=self._common['text_font'],
+ scale=self._common['scale'], fg=self._common['text_fg'],
+ align=TextNode.A_left)]
+ self._widgets += [DirectButton(
+ text=_('Website'), pos=(-.6, 1, .29), command=self.on_website,
+ **self._common_btn | {'scale': .08})]
+ self._widgets += [OnscreenText(
+ _('Supporters\n \1scale\1rdb\2\n \1scale\1Luisa Tenuta\2\n \1scale\1Damiana Ercolani\2'),
+ pos=(.1, .55), font=self._common['text_font'],
+ scale=self._common['scale'], fg=self._common['text_fg'],
+ align=TextNode.A_left)]
+ self._widgets += [DirectButton(
+ text=_('Back'), pos=(0, 1, -.8), command=self.on_back,
+ **self._common_btn)]
+
def on_play(self):
self._fsm.demand('Scene')
self.destroy()
self._set_options()
+ def on_credits(self):
+ self.destroy()
+ self._set_credits()
+
def on_language(self, arg):
lang_code = {
_('English'): 'en_EN',
self._opt_file['settings']['shadows'] = int(arg)
self._opt_file.store()
+ def on_website(self):
+ if platform.startswith('linux'):
+ environ['LD_LIBRARY_PATH'] = ''
+ system('xdg-open https://www.ya2.it')
+ else:
+ open_new_tab('https://www.ya2.it')
+
def on_back(self):
self._opt_file.store()
self.destroy()