class HelpScreen(GuiElement):
    control_keys = [H]
    help_file = 'data/help.html'
    text = '<font color="white">Press "H" for help</font>'
    def __init__(self, surface,):
        GuiElement.__init__(self, surface)
        x,y = 50, self.surface.height-50
        
        with open(self.help_file, 'r') as hfile:
            self.help_text = hfile.read()

        self.label = TextLabel(self.surface, self.text, x,y, self.surface.width)


    def on_key_press(self, symbol, modifiers):
        "движение с помощью клавиатуры"
        if symbol in self.control_keys:
            print 'pressed'
            if symbol in self.pressed:
                del self.pressed[symbol]
                self.label.text = self.text

            else:
                self.label.text = self.help_text
                self.pressed[symbol] = True
            return True
        return False

    def draw(self):
        self.label.draw()
class WorldDisplay(GuiElement):
    x = 30
    template = """<font color=white>
                <br>World: %s
                <br>Size: %s 
                <br>Position: %s
                </font>"""
    def __init__(self, surface):
        GuiElement.__init__(self, surface)

        self.y = 500
        self.label = TextLabel(self.surface, self.template, self.x, self.y, 100)
        self.name, self.size = '', 0
        
    
    def change(self, name, size, position):
        self.label.text = self.template % (name, size, position)
        self.name = name
        self.size = size
    
    def update(self, position):
        self.label.text = self.template % (self.name, self.size, position)
    
    def draw(self):
        self.label.draw()
Beispiel #3
0
    def __init__(self, surface):
        GuiElement.__init__(self, surface)

        self.y = 500
        self.label = TextLabel(self.surface, self.template, self.x, self.y,
                               100)
        self.name, self.size = '', 0
Beispiel #4
0
class WorldDisplay(GuiElement):
    x = 30
    template = """<font color=white>
                <br>World: %s
                <br>Size: %s 
                <br>Position: %s
                </font>"""

    def __init__(self, surface):
        GuiElement.__init__(self, surface)

        self.y = 500
        self.label = TextLabel(self.surface, self.template, self.x, self.y,
                               100)
        self.name, self.size = '', 0

    def change(self, name, size, position):
        self.label.text = self.template % (name, size, position)
        self.name = name
        self.size = size

    def update(self, position):
        self.label.text = self.template % (self.name, self.size, position)

    def draw(self):
        self.label.draw()
Beispiel #5
0
class HelpScreen(GuiElement):
    control_keys = [H]
    help_file = 'data/help.html'
    text = '<font color="white">Press "H" for help</font>'

    def __init__(
        self,
        surface,
    ):
        GuiElement.__init__(self, surface)
        x, y = 50, self.surface.height - 50

        with open(self.help_file, 'r') as hfile:
            self.help_text = hfile.read()

        self.label = TextLabel(self.surface, self.text, x, y,
                               self.surface.width)

    def on_key_press(self, symbol, modifiers):
        "движение с помощью клавиатуры"
        if symbol in self.control_keys:
            print 'pressed'
            if symbol in self.pressed:
                del self.pressed[symbol]
                self.label.text = self.text

            else:
                self.label.text = self.help_text
                self.pressed[symbol] = True
            return True
        return False

    def draw(self):
        self.label.draw()
Beispiel #6
0
    def __init__(
        self,
        surface,
    ):
        GuiElement.__init__(self, surface)
        x, y = 50, self.surface.height - 50

        with open(self.help_file, 'r') as hfile:
            self.help_text = hfile.read()

        self.label = TextLabel(self.surface, self.text, x, y,
                               self.surface.width)
    def __init__(self, surface,):
        GuiElement.__init__(self, surface)
        x,y = 50, self.surface.height-50
        
        with open(self.help_file, 'r') as hfile:
            self.help_text = hfile.read()

        self.label = TextLabel(self.surface, self.text, x,y, self.surface.width)
    def __init__(self, surface):
        GuiElement.__init__(self, surface)

        self.y = 500
        self.label = TextLabel(self.surface, self.template, self.x, self.y, 100)
        self.name, self.size = '', 0