from direct.gui.DirectGuiGlobals import FLAT
from direct.gui.OnscreenText import OnscreenText
from lib.engine.gui.cursor import MouseCursor
+from pmachines.scene import Scene
+from panda3d.bullet import BulletWorld
class Menu:
**self._common_btn)]
def on_play(self):
+ self.destroy()
+ self._widgets = []
+ self._widgets += [DirectButton(
+ text=_('Play'), pos=(0, 1, .1), command=self.start,
+ **self._common_btn | {'frameSize': (-2.4, 2.4, -2.4, 2.4),
+ 'frameColor': (1, 1, 1, .8)})]
+ s = Scene(BulletWorld(), None, True, None)
+ self._widgets[-1]['frameTexture'] = s.screenshot().make_copy()
+ base.graphicsEngine.renderFrame()
+ base.graphicsEngine.renderFrame()
+ s.destroy()
+ self._widgets += [DirectButton(
+ text=_('Back'), pos=(0, 1, -.8), command=self.on_back,
+ **self._common_btn)]
+
+ def start(self):
self._fsm.demand('Scene')
def on_options(self):
self._side_panel = SidePanel(world, self._mouse_plane_node, (-5, 4), (-3, 1), 1, self.items)
self._scene_tsk = taskMgr.add(self.on_frame, 'on_frame')
- def _screenshot(self, task=None):
+ def screenshot(self, task=None):
tex = Texture('screenshot')
buffer = base.win.make_texture_buffer('screenshot', 512, 512, tex, True )
cam = base.make_camera(buffer)
# img = DirectButton(
# frameTexture=buffer.get_texture(), relief=FLAT,
# frameSize=(-.2, .2, -.2, .2))
+ return buffer.get_texture()
def current_bottom(self):
curr_bottom = 1
* issues
* todo
-** menu page for selecting the level
** second level (box + shelf)
** frame for the end of the level (back, replay, next level)
** create one level per item, then levels with more items
*** e.g. item1, item2, item1+2, item3, item1+2+3, ...
** intro animation (from target item to start position)
+** save screenshots of the levels in files (and use them in the menu)
+** use dds files in place of png/jpg
** refactoring
** build pipeline
** version 0.0.yymmdd