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'),
+ _('Special thanks to:\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._common_btn)]
def on_play(self):
- scene_classes = []
+ scenes = []
for _file in glob('pmachines/scenes/*.py'):
_fn = _file.replace('.py', '').replace('/', '.')
for member in import_module(_fn).__dict__.values():
if isclass(member) and issubclass(member, Scene) and \
member != Scene:
- scene_classes += [member]
+ scenes += [member]
+ scenes = sorted(scenes, key=lambda elm: elm.sorting)
self.destroy()
+ self._cursor = MouseCursor(
+ 'assets/buttons/arrowUpLeft.png', (.04, 1, .04), (.5, .5, .5, 1),
+ (.01, .01))
self._widgets = []
cmn = self._common_btn.copy() | {
'frameSize': (-2.4, 2.4, -2.4, 2.4),
'frameColor': (1, 1, 1, .8)}
- self._widgets += [DirectButton(
- text=scene_classes[0].name(), pos=(-.4, 1, .1), command=self.start,
- extraArgs=[scene_classes[0]], **cmn)]
- self._widgets += [DirectButton(
- text=scene_classes[1].name(), pos=(.4, 1, .1), command=self.start,
- extraArgs=[scene_classes[1]], **cmn)]
- #s = Scene(BulletWorld(), None, True, None)
- #self._widgets[-1]['frameTexture'] = s.screenshot().make_copy()
- #base.graphicsEngine.renderFrame()
- #base.graphicsEngine.renderFrame()
- #s.destroy()
+ left = - (dx := .8) * (min(3, len(scenes)) - 1) / 2
+ for i, cls in enumerate(scenes):
+ top = .1 if len(scenes) < 4 else .6
+ row = 0 if i < 3 else 1
+ self._widgets += [DirectButton(
+ text=cls.name(), pos=(left + dx * (i % 3), 1, top - dx * row),
+ command=self.start, extraArgs=[cls], text_wordwrap=4,
+ frameTexture='assets/images/scenes/%s.png' % cls.__name__,
+ **cmn)]
self._widgets += [DirectButton(
text=_('Back'), pos=(0, 1, -.8), command=self.on_back,
**self._common_btn)]
def on_options(self):
self.destroy()
+ self._cursor = MouseCursor(
+ 'assets/buttons/arrowUpLeft.png', (.04, 1, .04), (.5, .5, .5, 1),
+ (.01, .01))
self._set_options()
def on_credits(self):
self.destroy()
+ self._cursor = MouseCursor(
+ 'assets/buttons/arrowUpLeft.png', (.04, 1, .04), (.5, .5, .5, 1),
+ (.01, .01))
self._set_credits()
def _rearrange_width(self):
def on_back(self):
self._opt_file.store()
self.destroy()
+ self._cursor = MouseCursor(
+ 'assets/buttons/arrowUpLeft.png', (.04, 1, .04), (.5, .5, .5, 1),
+ (.01, .01))
self._set_main()
def destroy(self):