def defaultRoom(room): roomId = room['id'] visibleName = room['label'] width = room['width'] height = room['height'] r = Room(id=visibleName, width=width, height=height) r.addRunner(run.Scheduler()) camWidth = 320 camHeight = 144 main = entity.Entity(tag='main') main.camera = cam.OrthoCamera(320, 144, 320, 144, [0, 56, 320, 144], tag='maincam') r.add(main) ui = entity.Entity(tag='ui') ui.camera = cam.OrthoCamera(320, 56, 320, 56, [0, 0, 320, 56], tag='uicam') r.add(ui) b = entity.Entity() b.addComponent(compo.Gfx(image='gfx/raftrasf.jpg', height=144)) r.add(b, 'main') return r
def __init__(self, id: str, width, height): super().__init__(id, width, height) # add the main node camWidth = engine.device_size[0] camHeight = engine.device_size[1] main = entity.Entity (tag='main') main.camera = cam.OrthoCamera(width, height, camWidth, camHeight, [0, 0, camWidth, camHeight], tag='maincam') self.ref['main'] = main.children self.scene.append(main)
def __init__(self, id: str, width, height, collide = False): super().__init__(id, width, height) self.collide = collide camWidth = engine.device_size[0] camHeight = engine.device_size[1] main = entity.Entity (tag='main') main.camera = cam.OrthoCamera(width, height, camWidth, camHeight, [0, 0, camWidth, camHeight], tag='maincam') main.addComponent (compo.HotSpotManager(lmbclick=func.walkto)) self.ref['main'] = main.children self.scene.append(main) # create a hotspot manager self.engines.append(runner.Scheduler()) self.init.append(startupRoomFullscreen(id))
def __init__(self, id: str): width = engine.device_size[0] uisize = scumm.Config.ui_height height = engine.device_size[1] - uisize super().__init__(id, width, height) self.collide = False # add the main node main = entity.Entity (tag='main') main.camera = cam.OrthoCamera(width, height, width, height, [0, uisize, width, height], tag='maincam') # add the dialogue node dialogue_node = entity.TextView(factory=makeDialogueButton, size=[320,56], fontSize=8, lines=6, deltax=26, tag='dialogue') dialogue_node.addComponent(compo.HotSpotManager()) self.ref['main'] = main.children self.scene.append(main) self.scene.append(dialogue_node) self.engines.append(runner.Scheduler())
def __init__(self, id: str, width, height, collide = False, addui: bool = True): super().__init__(id, width, height) self.collide = collide scumm.State.collision_enabled = collide uisize = scumm.Config.ui_height print ('uisize is '+str(uisize)) camWidth = engine.device_size[0] camHeight = engine.device_size[1] - uisize # get the verbset used in this room verbset : scumm.VerbSet = scumm.Config.verbSets[0] defv : scumm.Verb = scumm.Config.getVerb (verbset.defaultVerb) scumm.Config.verb = verbset.defaultVerb #verbs = settings.monkey.config['verbs'] default_verb = scumm.Config.getVerb # add the main node main = entity.Entity (tag='main') main.camera = cam.OrthoCamera(width, height, camWidth, camHeight, [0, uisize, camWidth, camHeight], tag='maincam') #main.add (e.Text(font='ui', text='ciao', color = [255, 255, 255, 255], align = e.TextAlignment.bottom, pos = [camWidth/2, 16, 0])) # add the ui node if addui: main.addComponent (compo.HotSpotManager(lmbclick=func.walkto)) ui = entity.Entity (tag='ui') ui.camera = cam.OrthoCamera(camWidth, uisize, camWidth, uisize, [0, 0, camWidth, uisize], tag = 'uicam') ui.add (entity.Text(font='ui', text = defv.text, color = scumm.Config.Colors.current_action, align = entity.TextAlignment.bottom, tag = 'current_verb', pos = [camWidth/2, 48, 0])) ui.addComponent (compo.HotSpotManager()) inventory_node = entity.TextView (factory=makeInventoryButton, pos=(160,0), size=(140,48), fontSize=8, lines=6, deltax=26, tag='inventory') inventory_node.addComponent(compo.HotSpotManager()) row = 2 count = 0 for a in verbset.verbs: col = 1 + count // 4 x = 2 + (col - 1) * 46 verb : scumm.Verb = scumm.Config.getVerb(a) print ('here ' + a + ' ' + verb.text) ui.add (se.VerbButton( font = 'ui', verbId = a, colorInactive = scumm.Config.Colors.verb_unselected, colorActive = scumm.Config.Colors.verb_selected, align = entity.TextAlignment.bottomleft, pos = [x, uisize - row*8, 0] )) count +=1 row += 1 if (row > 5): row = 2 self.scene.append(ui) self.scene.append(inventory_node) scumm.Config.resetVerb() # add the dialogue node dialogue_node = entity.TextView(factory=makeDialogueButton, size=[320,56], fontSize=8, lines=6, deltax=26, tag='dialogue') dialogue_node.addComponent(compo.HotSpotManager()) #ui.add (VerbButton (font='ui', text='Open', colorInactive = ScummConfig.Colors.verb_unselected, colorActive = ScummConfig.Colors.verb_selected, align = e.TextAlignment.bottomleft, pos = [0,0,0])) # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.topleft, pos = [0, 56, 0])) # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.bottomleft, pos = [0, 0, 0])) # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.topright, pos = [320, 56, 0])) # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.bottomright, pos = [320, 0, 0])) self.ref['main'] = main.children self.scene.append(main) self.scene.append(dialogue_node) # create a hotspot manager #self.engines.append(runner.HotSpotManager(lmbclick=func.walkto)) self.engines.append(runner.Scheduler()) if collide: #self.engines.append (runner.CollisionEngine(128, 128)) ce = runner.CollisionEngine(128, 128) ce.addResponse(0, 1, runner.CollisionResponse(onenter=ciao)) self.engines.append (ce) self.init.append(startupRoomUI(id))