def __init__(self,other_settings = None): self.pos_x = 1 self.pos_y = 1 self.old_pos_x = None self.old_pos_y = None self.con = 0 self.blinks = True self.blink_frequency = 0.5 # seconds for a complete blink cycle (1 blink) self.blink_timer = 0 self.updated = False self.timer = 0 self.visibility_timeout = 1 self.show_cursor = False if not self.show_cursor: ltc.mouse_show_cursor(False) # goes through the dictonary of extra settings and then applies them to self if not other_settings == None: for key,value in other_settings.items(): if key == 'key_map': self.load_keys(value) else: setattr(self,key,value)
def update(self,dt): # checks if the cursor should be visible or not if self.show_cursor: if ltc.mouse_is_cursor_visible(): if self.visibility_timeout <= self.timer: ltc.mouse_show_cursor(False) elif self.updated: self.timer = 0 else: self.timer += dt elif self.updated: self.timer = 0 ltc.mouse_show_cursor(True) # does the update on the blinking if enabled if self.blinks: self.blink_timer += dt self.updated = False