def addedToWorld(self, world): """The screen was added to the world""" super(HelpScreen, self).addedToWorld(world) # # Logo L = theme.getTheme('help-screen').getProperty logo = serge.blocks.utils.addSpriteActorToWorld(world, 'logo', 'logo', 'icon', 'ui', center_position=L('logo-position')) # # Background bh = serge.blocks.utils.addSpriteActorToWorld(world, 'bg', 'bg', L('screen-background-sprite'), 'background', center_position=L('screen-background-position')) # # Help text text = serge.blocks.utils.addSpriteActorToWorld(world, 'text', 'text', 'help-text', 'ui', center_position=L('text-position')) # # Back link back = serge.blocks.utils.addVisualActorToWorld(world, 'button', 'back', serge.visual.Text('Back', L('back-colour'), font_size=L('back-font-size')), 'ui', center_position=L('help-position')) back.linkEvent(serge.events.E_LEFT_CLICK, serge.blocks.utils.backToPreviousWorld('click')) # # Trees tree.addTrees(L, world)
def addedToWorld(self, world): """The screen was added to the world""" super(CreditsScreen, self).addedToWorld(world) # # Logo the_theme = theme.getTheme('credits-screen') L = the_theme.getProperty logo = serge.blocks.utils.addSpriteActorToWorld(world, 'logo', 'logo', 'icon', 'ui', center_position=L('logo-position')) # # Background bh = serge.blocks.utils.addSpriteActorToWorld(world, 'bg', 'bg', L('screen-background-sprite'), 'background', center_position=L('screen-background-position')) # # Text on the page serge.blocks.utils.addTextItemsToWorld(world, [ ('Game concept, design and coding', 'author-title'), (AUTHOR, 'author'), (URL, 'url', self.launchURL), ('Music', 'music-title1'), ('from the FreeMusicArchive.org', 'music-title2'), ('Sound', 'sound-title1'), ('From FreeSound.org', 'sound-title2'), ('Built using', 'built-title'), (BUILT_USING, 'built'), ('Game engine', 'engine-title'), (GAME_ENGINE, 'engine'), ('Fonts', 'font-title1'), ('from the cooltext.com', 'font-title2'), ('Back', 'back', serge.blocks.utils.backToPreviousWorld('click')), ], the_theme, 'ui') # x, y = L('music-position') for idx, track in enumerate(MUSIC): serge.blocks.utils.addVisualActorToWorld(world, 'title', 'music-item', serge.visual.Text(track, L('music-colour'), font_size=L('music-font-size')), 'ui', center_position=(x, y+idx*20)) # x, y = L('font-position') for idx, font in enumerate(FONTS): serge.blocks.utils.addVisualActorToWorld(world, 'title', 'font-item', serge.visual.Text(font, L('font-colour'), font_size=L('font-font-size')), 'ui', center_position=(x, y+idx*20)) # # Trees tree.addTrees(L, world)
def addedToWorld(self, world): """The start screen was added to the world""" super(CollectionScreen, self).addedToWorld(world) # self.manager = world.findActorByName('behaviours') self.history = self.globals.history # # Logo the_theme = theme.getTheme('collection-screen') self.L = L = the_theme.getProperty logo = serge.blocks.utils.addSpriteActorToWorld(world, 'logo', 'logo', 'icon', 'ui', center_position=L('logo-position')) # # Background bh = serge.blocks.utils.addSpriteActorToWorld(world, 'bg', 'bg', L('screen-background-sprite'), 'background', center_position=L('screen-background-position')) # serge.blocks.utils.addTextItemsToWorld(world, [ ('Your collection of named crystals', 'title'), ('Next Page', 'next', self.nextPage), ('Previous Page', 'previous', self.previousPage), ('Page ...', 'page'), ('Back', 'back', serge.blocks.utils.backToPreviousWorld('click')), ], the_theme, 'ui') # self.page = world.findActorByName('page') # # The grid self.grid = grid = serge.blocks.utils.addActorToWorld(world, serge.blocks.layout.Grid('grid', 'grid', size=L('grid-size'), width=L('grid-width'), height=L('grid-height'), background_colour=L('background-colour')), center_position=L('grid-position'), layer_name='ui-back') # # Populate with slots w, h = L('grid-size') for x in range(w): for y in range(h): # # Layout of the labels slot = serge.blocks.layout.VerticalBar('slot', 'vbar', width=L('slot-width'), height=L('slot-height'), background_colour=L('slot-background-colour'), background_layer='ui-back') grid.addActor((x, y), slot, 'ui') # # Text labels t1 = serge.blocks.actors.StringText( 'label', 'text', 'Title', colour=L('t1-colour'), font_size=L('t1-font-size')) t2 = serge.blocks.actors.StringText( 'label', 'text', 'Details', colour=L('t2-colour'), font_size=L('t2-font-size')) slot.addActor(t1) slot.addActor(t2) t1.setLayerName('ui') t2.setLayerName('ui') slot.long_description = '' # self.selected_slot = None # # Extra detail window self.detail = serge.blocks.utils.addVisualActorToWorld(world, 'text', 'detail', serge.blocks.visualblocks.RectangleText('Details', L('detail-colour'), (L('detail-width'), L('detail-height')), L('detail-backcolour'), L('detail-font-size')), layer_name='overlay') self.detail.visible = False # # Trees tree.addTrees(L, world) # self.current_page = 0 self.page_size = w*h self.page_width = w self.page_height = h self.populateCurrentPage() # self.world.linkEvent(serge.events.E_ACTIVATE_WORLD, self.resetCamera)