def position(self, val): x, y = val lx, ly = self._position winx = render.getWindowWidth() winy = render.getWindowHeight() if self.clipping or render.getFullScreen(): #Emulate new position _position = (lx - winx / 2) + x * winx, (-y * winy + winy) + (ly - winy / 2) logic.mouse.position = 0.5, 0.5 x, y = _position #Apply filter tx, ty = self._last_position if abs(tx - x) < 1 and abs(ty - y) < 1: return #Do the actual clipping if self.clipping: mx, my = self.clipping else: mx, my = 0, 0 winx = render.getWindowWidth() winy = render.getWindowHeight() if mx > 1 or my > 1: raise ValueError( "clipping x and y values must be lower or equal than 1") mx, my = mx * winx / 2, my * winy / 2 if x < mx: x = mx if x > winx - mx: x = winx - mx if y < my: y = my if y > winy - my: y = winy - my self._position = x, y self._last_position = self._position else: self._position = x * winx, -y * winy + winy
def fullscreen_on_keypress(fs_key=events.F4KEY, *modifier_keys): """ Causes full-screen on keypress of fs_key. Also checks to see if modifier keys are being held down. :param fs_key:Int - Keyboard key constant (e.g. events.F4KEY). :param modifier_keys:Int - Other keys that might need to be held down while the fs_key is pushed. :return: Bool or None - The new fullscreen state if triggered (i.e. True or False). Otherwise, None. """ if logic.keyboard.events[fs_key] == logic.KX_INPUT_JUST_ACTIVATED: all_held = True for m in modifier_keys: if not logic.keyboard.events[m] == logic.KX_INPUT_ACTIVE: all_held = False if all_held: new_fs = not render.getFullScreen() render.setFullScreen(new_fs) return new_fs return None
def position(self, val): x, y = val lx, ly = self._position winx = render.getWindowWidth() winy = render.getWindowHeight() if self.clipping or render.getFullScreen(): #Emulate new position _position = (lx-winx/2)+x*winx, (-y*winy + winy)+(ly-winy/2) logic.mouse.position = 0.5, 0.5 x, y = _position #Apply filter tx, ty = self._last_position if abs(tx-x) < 1 and abs(ty-y) < 1: return #Do the actual clipping if self.clipping: mx, my = self.clipping else: mx, my = 0, 0 winx = render.getWindowWidth() winy = render.getWindowHeight() if mx > 1 or my > 1: raise ValueError("clipping x and y values must be lower or equal than 1") mx, my = mx*winx/2, my*winy/2 if x < mx: x = mx if x > winx-mx: x = winx-mx if y < my: y = my if y > winy-my: y = winy-my self._position = x, y self._last_position = self._position else: self._position = x*winx, -y*winy + winy
def main(): cont = bge.logic.getCurrentController() own = cont.owner f12key = cont.sensors['F12K'] moaFullscreen = cont.sensors['MOAFullscreen'] mouseL = cont.sensors['MouseL'] if f12key.positive: if render.getFullScreen() == False: render.setFullScreen(True) else: render.setFullScreen(False) if moaFullscreen.positive: if mouseL.positive: if render.getFullScreen() == False: render.setFullScreen(True) else: render.setFullScreen(False)
def main(): cont = bge.logic.getCurrentController() own = cont.owner f12key = cont.sensors['F12K'] if f12key.positive: if render.getFullScreen() == False: render.setFullScreen(True) else: render.setFullScreen(False)
def fullScreen(self): return render.getFullScreen()