joy button pressed; framerate font; clear frames
This commit is contained in:
parent
9a00514637
commit
00b3901fa0
|
@ -74,7 +74,7 @@ class Configuration(RawConfigParser):
|
|||
set_option(section, "windowed-flag", "wi")
|
||||
set_option(section, "show-framerate", "no")
|
||||
set_option(section, "framerate-display-flag", "fr")
|
||||
set_option(section, "framerate-text-size", "12")
|
||||
set_option(section, "framerate-text-size", "16")
|
||||
set_option(section, "framerate-text-color", "0, 0, 0")
|
||||
set_option(section, "framerate-text-background", "255, 255, 255")
|
||||
section = "input"
|
||||
|
|
|
@ -95,9 +95,12 @@ class Input(GameChild):
|
|||
|
||||
def is_command_active(self, command):
|
||||
if not self.suppressed:
|
||||
joystick = self.joystick
|
||||
if self.is_key_pressed(command):
|
||||
return True
|
||||
joystick = self.joystick
|
||||
joy_map = self.joy_button_map
|
||||
if command in joy_map and joystick.js.get_button(joy_map[command]):
|
||||
return True
|
||||
if command == "up":
|
||||
return joystick.is_direction_pressed(Joystick.up)
|
||||
elif command == "right":
|
||||
|
|
|
@ -35,8 +35,7 @@ class Mainloop(GameChild):
|
|||
self.last_framerate_count = 0
|
||||
self.framerate_topright = screen.get_rect().topright
|
||||
self.display_surface = screen
|
||||
self.font = Font(self.get_resource("main-menu", "font-path"),
|
||||
self.framerate_text_size)
|
||||
self.font = Font(None, self.framerate_text_size)
|
||||
self.font.set_bold(True)
|
||||
self.render_framerate()
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@ class Sprite(Animation):
|
|||
|
||||
def __init__(self, parent, framerate=None):
|
||||
Animation.__init__(self, parent, self.shift_frame, framerate)
|
||||
self.frames = []
|
||||
self.clear_frames()
|
||||
self.frame_index = 0
|
||||
self.mirrored = False
|
||||
self.rect = Rect((0, 0, 0, 0))
|
||||
self.motion_overflow = Vector()
|
||||
self.display_surface = self.get_screen()
|
||||
self.display_surface = self.get_display_surface()
|
||||
|
||||
def set_framerate(self, framerate):
|
||||
self.register(self.shift_frame, interval=framerate)
|
||||
|
@ -94,6 +94,9 @@ class Sprite(Animation):
|
|||
frames[ii] = flip(frame, True, False)
|
||||
self.mirrored = not self.mirrored
|
||||
|
||||
def clear_frames(self):
|
||||
self.frames = []
|
||||
|
||||
def update(self):
|
||||
Animation.update(self)
|
||||
self.draw()
|
||||
|
|
Loading…
Reference in New Issue