Example #1
0
 def test_mouse_drag_event_func(self, x, y, dx, dy):
     scaling = settings.getValue(DYNAMIC_SETTINGS_GLOBAL_SCALING)
     x = int(x / scaling)
     y = int(y / scaling)
     dx = int(dx / scaling)
     dy = int(dy / scaling)
     event.mouseMoveEvent(x, y, dx, dy)
Example #2
0
 def updateDistance(self):
     if not self.player.checkDead():
         self.distance += 0.1
     self.distance_counter.setText("Distance: " + str(round(self.distance, 1)))
     self.distance_counter.setPos(x = getWindowDimensionsScaled()[0] - self.distance_counter.width - 16)
     self.max_distance_counter.setText("Max Distance: " + str(round(max(settings.getValue(HIGH_SCORE, 0.0), self.distance), 1)))
     self.max_distance_counter.setPos(x = getWindowDimensionsScaled()[0] - self.max_distance_counter.width - 16)
Example #3
0
 def playerHit(self):
     self.player_health -= 1
     self.updateHearts()
     self.player.gotHit()
     playSound(toStringPath(*HIT_SE_PATH))
     if self.player_health <= 0:
         self.player.setKilled()
         settings.setValue(HIGH_SCORE, max(settings.getValue(HIGH_SCORE, 0.0), self.distance))
         self.Schedule(self.resetGame, GAME_RESTART_TIME)
Example #4
0
 def __init__(self,
              width=800,
              height=600,
              fullscreen=None,
              fake_fullscreen=None):
     super(main_window, self).__init__(
         width=width,
         height=height,
         vsync=settings.getValue(DYNAMIC_SETTINGS_VSYNC),
         fullscreen=fullscreen
         or settings.getValue(DYNAMIC_SETTINGS_FULLSCREEN),
         fake_fullscreen=fake_fullscreen
         or settings.getValue(DYNAMIC_SETTINGS_FAKE_FULLSCREEN))
     self._fake_fullscreen = fake_fullscreen
     #self.set_caption(settings.getValue(DYNAMIC_SETTINGS_GAME_CAPTION))
     self.resize_func = self.test_resize_func
     self.iconify_func = self.test_iconify_func
     self.key_event_func = self.test_key_event_func
     self.mouse_position_event_func = self.test_mouse_position_event_func
     self.mouse_drag_event_func = self.test_mouse_drag_event_func
     self.mouse_scroll_event_func = self.test_mouse_scroll_event_func
     self.mouse_press_event_func = self.test_mouse_press_event_func
     self.mouse_release_event_func = self.test_mouse_release_event_func
     self.unicode_char_entered_func = self.test_unicode_char_entered_func
Example #5
0
 def getSplineTimeRemainingFrames(self):
     """not super accurate; will be AT LEAST this many frames, though maybe one less"""
     return int(
         math.ceil(self.getCountdownRemaining() *
                   settings.getValue(DYNAMIC_SETTINGS_FRAMES_PER_SECOND)))
Example #6
0
 def _startSplineTimer(self, time):
     self._spline_countdown_timer.countdownStart(
         int(time * settings.getValue(DYNAMIC_SETTINGS_FRAMES_PER_SECOND)))
Example #7
0
 def getSplineTimeRemaining(self):
     return float(self.getTimeRemainingFrames()) / settings.getValue(
         DYNAMIC_SETTINGS_FRAMES_PER_SECOND)
Example #8
0
 def _MovementGetTimeMod(self, time):
     return float(time) / settings.getValue(DYNAMIC_SETTINGS_FRAMES_PER_SECOND)
Example #9
0
 def _MovementGetWaitTime(self, time):
     return int(time * settings.getValue(DYNAMIC_SETTINGS_FRAMES_PER_SECOND))
Example #10
0
 def _MovementGetTimePassed(self):
     return 1.0/settings.getValue(DYNAMIC_SETTINGS_FRAMES_PER_SECOND)
Example #11
0
 def test_mouse_press_event_func(self, x, y, button):
     scaling = settings.getValue(DYNAMIC_SETTINGS_GLOBAL_SCALING)
     x = int(x / scaling)
     y = int(y / scaling)
     print("Mouse press: ", x, y, button)
     event.mousePressEvent(x, y, button)
Example #12
0
 def test_mouse_release_event_func(self, x, y, button):
     scaling = settings.getValue(DYNAMIC_SETTINGS_GLOBAL_SCALING)
     x = int(x / scaling)
     y = int(y / scaling)
     event.mouseReleaseEvent(x, y, button)