本文整理汇总了Python中background.Background.populate方法的典型用法代码示例。如果您正苦于以下问题:Python Background.populate方法的具体用法?Python Background.populate怎么用?Python Background.populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类background.Background
的用法示例。
在下文中一共展示了Background.populate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GameWindow
# 需要导入模块: from background import Background [as 别名]
# 或者: from background.Background import populate [as 别名]
class GameWindow(pyglet.window.Window):
def __init__(self):
global Name
super(GameWindow, self).__init__()
self.textevents = 1
self.set_size(800, 600)
self.gamestate = 1 # 0 playing 1 main menu
rabbyt.set_default_attribs()
pyglet.clock.schedule(rabbyt.add_time)
pyglet.clock.set_fps_limit(100)
self.fps_display = pyglet.clock.ClockDisplay()
self.mainmenu = MainMenu((self.width, self.height))
self.mainmenu.open = 1
self.creditsmenu = CreditsMenu((self.width, self.height))
self.optionsmenu = OptionsMenu((self.width, self.height))
self.keymenu = KeyMenu((self.width, self.height))
self.sounds = Sounds()
self.text_cursor = self.get_system_mouse_cursor('text')
self.focus = None
self.configuration = player.Configuration()
self.controls = self.configuration.getControls()
self.keys = self.configuration.pykeys
self.idnum = 0
#self.image = pyglet.image.load('ship2.png')
#music = pyglet.resource.media('sample.wav',streaming=False)
#music.play()
#self.push_handlers(pyglet.window.event.WindowEventLogger())
def playerLogin(self):
self.name = self.mainmenu.textentry.get("Name").document.text
password = self.mainmenu.textentry.get("Password").document.text
print "NAME: ",self.name
print "password: ", password
self.net_client = netclient.NetData(self.name)
data = self.net_client.Connect("localhost",6317,password) #doyle.is-a-geek.net
print "connection", data
self.idnum = data[4]
self.startsystem = pickle.loads(data[1])
print "self.startsystem",self.startsystem
return data
def startPlaying(self,data):
self.mainmenu.open = 0
self.textevents = 0
self.otherlist = {}
self.playercount = 1
safejump = 500
self.mapsize = (13000 * 4, 13000 * 4)
self.center = (13000 * 2, 13000 * 2)
self.safejump = range(self.center[0] - safejump, self.center[0] + safejump)
def entities(self):
self.label = pyglet.text.Label('Hello, world',
font_name = 'Times New Roman',
font_size = 36,
x = self.width/2, y = self.height/2,
anchor_x = 'center', anchor_y = 'center')
self.panel = Panel((self.width,self.height))
self.background = Background((self.width,self.height),self.panel.size)
self.background.pos = [self.mapsize[0] / 2, self.mapsize[1] / 2]
self.background.populate()
self.bgcheck = 1
self.player = player.Player((self.width,self.height),self.panel.size)
self.player.name = self.name
self.player.idnum = self.idnum
self.player.location[0] = self.startsystem
self.spritelist = [self.player.sprite]
self.visible_size = (self.background.x,self.background.y)
self.systemdict = MakeSystemDict("data/systems/systems.list",self.player.pos,self.center,self.visible_size)
self.systemdict.get(self.startsystem.name).update(self.startsystem)
self.systemdict.get(self.startsystem.name).active = 1
self.system = self.systemdict.get(self.startsystem.name)
self.selectedsystem = None
self.activesystem = self.system.name
self.linkdict = MakeLinks(self.systemdict)
print "LINKDICT: " + str(self.linkdict)
self.menudialogue = MenuDialogue((self.width,self.height))
self.optionsdialogue = OptionsDialogue((self.width,self.height))
self.controlsdialogue = ControlsDialogue((self.width,self.height))
self.dockdialogue = DockDialogue((self.width,self.height))
self.mapdialogue = MapDialogue((self.width, self.height))
self.mapdialogue.active = self.activesystem
entities(self)
self.playerdict = {}
otherdata = pickle.loads(data[2])
print "OTHERDATA"
for each in otherdata:
print each, otherdata.get(each)
self.playerdict[each] = others.Other((self.width,self.height),self.panel.size)
self.playerdict.get(each).setNonCrucial(otherdata.get(each))
otherdata = pickle.loads(data[3])
for each in otherdata:
self.playerdict.get(each).setCrucial(otherdata.get(each))
def init_player(self):
self.player_rot=(0,"CW")
self.player_accel=(0,0,0)
self.player_about=(0,0,0)
#.........这里部分代码省略.........