本文整理汇总了Python中pygame.FULLSCREEN属性的典型用法代码示例。如果您正苦于以下问题:Python pygame.FULLSCREEN属性的具体用法?Python pygame.FULLSCREEN怎么用?Python pygame.FULLSCREEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pygame
的用法示例。
在下文中一共展示了pygame.FULLSCREEN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def __init__(self, width, height):
self.width = width
self.height = height
self.res_width = 0
if SETTINGS.mode == 1:
self.width = int(SETTINGS.canvas_target_width / SETTINGS.resolution) * SETTINGS.resolution
self.height = SETTINGS.canvas_target_height
self.res_width = SETTINGS.canvas_actual_width
if SETTINGS.fullscreen:
self.window = pygame.display.set_mode((self.width, int(self.height+(self.height*0.15))) ,pygame.FULLSCREEN)
else:
self.window = pygame.display.set_mode((self.width, int(self.height+(self.height*0.15))))
self.canvas = pygame.Surface((self.width, self.height))
pygame.display.set_caption("DUGA")
self.shade = [pygame.Surface((self.width, self.height)).convert_alpha(),
pygame.Surface((self.width, self.height/1.2)).convert_alpha(),
pygame.Surface((self.width, self.height/2)).convert_alpha(),
pygame.Surface((self.width, self.height/4)).convert_alpha(),
pygame.Surface((self.width, self.height/8)).convert_alpha(),
pygame.Surface((self.width, self.height/18)).convert_alpha()]
self.rgba = [SETTINGS.shade_rgba[0], SETTINGS.shade_rgba[1], SETTINGS.shade_rgba[2], int(min(255, SETTINGS.shade_rgba[3]*(50/SETTINGS.shade_visibility)))]
示例2: _init_screen
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def _init_screen(self):
pygame.display.init()
pygame.font.init()
pygame.mouse.set_visible(0)
# gfx
self.m_oFontText = pygame.font.Font(os.path.join(self.m_sSkinPath,
self.dCFG['font']),
self.dCFG['font_size'])
self.dCFG['font_line'] = self.m_oFontText.get_linesize()
self.be = pygame.image.load(os.path.join(self.m_sSkinPath, self.dCFG['border_corner']))
self.b = pygame.image.load(os.path.join(self.m_sSkinPath, self.dCFG['border']))
self.c = pygame.image.load(os.path.join(self.m_sSkinPath, self.dCFG['cursor']))
self.c = pygame.transform.rotate(self.c, self.m_iRotate)
# screen
self.m_lResolutionXY = CRT.get_screen_resolution()
self.m_lScreenCenter = map(lambda x: x/2, self.m_lResolutionXY)
self.m_oScreen = pygame.display.set_mode(self.m_lResolutionXY, pygame.FULLSCREEN)
示例3: fullscreen_toggle
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def fullscreen_toggle(self, info):
"""toggle between fullscreen and windowed version with CTRL + F
current activity will be reset"""
self.redraw_needed = [True, True, True]
if self.config.fullscreen is True:
self.config.fullscreen = False
self.size = self.wn_size[:]
self.screen = pygame.display.set_mode(self.size, pygame.RESIZABLE)
self.fs_rescale(info)
else:
self.config.fullscreen = True
self.size = self.fs_size[:]
self.screen = pygame.display.set_mode(self.size, pygame.FULLSCREEN)
self.fs_rescale(info)
pygame.display.flip()
示例4: sizing
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def sizing(self, size):
"""
Set various asplect of the app related to the screen size of
the display and/or window.
"""
self.log.debug(f"Framebuffer Size: {size[0]} x {size[1]}")
if self.config["fullscreen"]:
self.screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
self.xmax = pygame.display.Info().current_w # - 35 Why not use full screen in "fullescreen"?
self.ymax = pygame.display.Info().current_h # - 5 Why not use full screen in "fullescreen"?
else:
self.screen = pygame.display.set_mode(size, pygame.RESIZABLE)
pygame.display.set_caption('PiWeatherRock')
self.xmax = pygame.display.get_surface().get_width() - 35
self.ymax = pygame.display.get_surface().get_height() - 5
if self.xmax <= 1024:
self.icon_size = '64'
else:
self.icon_size = '256'
示例5: __init__
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def __init__(self, screen, resolution=(800,480),
ui_placement_mode=False, fps=60, dev_mode=False,
audio=(22050, -8, 1, 1024)):
# init system
try:
if (audio): pygame.mixer.init(audio[0], audio[1], audio[2], audio[3])
except:
pass
pygame.font.init()
pygame.init()
self.screenSurface = pygame.display.set_mode(resolution) #, pygame.FULLSCREEN)
self.fpsClock = pygame.time.Clock()
self.fps = fps
pygame.display.set_caption("LCARS")
if not dev_mode: pygame.mouse.set_visible(False)
# set up screen elements
self.all_sprites = pygame.sprite.LayeredDirty()
self.all_sprites.UI_PLACEMENT_MODE = ui_placement_mode
self.screen = screen
self.screen.setup(self.all_sprites)
self.running = True
示例6: __init__
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def __init__(self, screen, resolution=(800,480),
ui_placement_mode=False, fps=60, dev_mode=False, audio=True,
audio_params=(22050, -8, 1, 1024)):
# init system
pygame.display.init()
pygame.font.init()
sound.init(audio_params)
self.screenSurface = pygame.display.set_mode(resolution) #, pygame.FULLSCREEN)
self.fpsClock = pygame.time.Clock()
self.fps = fps
pygame.display.set_caption("LCARS")
if not dev_mode:
# see https://github.com/tobykurien/rpi_lcars/issues/9
#pygame.mouse.set_visible(False)
pygame.mouse.set_cursor((8,8),(0,0),(0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0))
# set up screen elements
self.all_sprites = pygame.sprite.LayeredDirty()
self.all_sprites.UI_PLACEMENT_MODE = ui_placement_mode
self.screen = screen
self.screen.setup(self.all_sprites)
self.running = True
示例7: screenSize
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def screenSize(sizex, sizey, xpos=None, ypos=None, fullscreen=False):
global screen
global background
if xpos != None and ypos != None:
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" % (xpos, ypos + 50)
else:
windowInfo = pygame.display.Info()
monitorWidth = windowInfo.current_w
monitorHeight = windowInfo.current_h
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" % ((monitorWidth - sizex) / 2, (monitorHeight - sizey) / 2)
if fullscreen:
screen = pygame.display.set_mode([sizex, sizey], pygame.FULLSCREEN)
else:
screen = pygame.display.set_mode([sizex, sizey])
background = Background()
screen.fill(background.colour)
pygame.display.set_caption("Graphics Window")
background.surface = screen.copy()
pygame.display.update()
return screen
示例8: setup
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def setup():
global screen
# Init pygame
pygame.init()
# Init screen
screen = pygame.display.set_mode((640, 480), pygame.FULLSCREEN)
# Disable mouse
pygame.mouse.set_visible(False)
# Display welcome message
displayText("DIY-Thermocam Video Module", True)
# Main Program
示例9: test_list_modes
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def test_list_modes(self):
modes = pygame.display.list_modes(
depth=0, flags=pygame.FULLSCREEN, display=0
)
# modes == -1 means any mode is supported.
if modes != -1:
self.assertEqual(len(modes[0]), 2)
self.assertEqual(type(modes[0][0]), int)
modes = pygame.display.list_modes()
if modes != -1:
self.assertEqual(len(modes[0]), 2)
self.assertEqual(type(modes[0][0]), int)
modes = pygame.display.list_modes(
depth=0, flags=0, display=0
)
if modes != -1:
self.assertEqual(len(modes[0]), 2)
self.assertEqual(type(modes[0][0]), int)
示例10: main
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def main():
# Start program
debug("Starting pygame...")
pygame.init()
debug("Defining screen object...")
if not(args.nodrawing):
if not(args.save_images):
infoObject = pygame.display.Info()
image_icon = pygame.image.load("resources/various/pyrat.ico")
pygame.display.set_icon(image_icon)
pygame.display.set_caption("PyRat")
if args.fullscreen:
screen = pygame.display.set_mode((infoObject.current_w, infoObject.current_h), pygame.FULLSCREEN)
args.window_width = infoObject.current_w
args.window_height = infoObject.current_h
else:
screen = pygame.display.set_mode((args.window_width, args.window_height), pygame.RESIZABLE)
else:
screen = pygame.surface.Surface((args.window_width, args.window_height))
infoObject = ""
else:
screen = ""
infoObject = ""
# Run first game
debug("Starting first game")
result = run_game(screen, infoObject)
# Run other games (if any)
for i in range(args.tests - 1):
debug("Starting match number " + str(i))
print("match " + str(i+2) + "/" + str(args.tests))
new = run_game(screen, infoObject)
debug("Aggregating stats")
result = {x: result.get(x, 0) + new.get(x, 0) for x in set(result).union(new)}
debug("Writing stats and exiting")
result = {k: v / args.tests for k, v in result.items()}
# Print stats and exit
print("{")
for key,value in sorted(result.items()):
print("\t\"" + str(key) + "\": " + str(value))
print("}")
pygame.quit()
示例11: _init_screen
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def _init_screen(self):
pygame.display.init()
pygame.font.init()
pygame.mouse.set_visible(0)
self.m_PGoFontText = pygame.font.Font(FONT_FILE,
self.m_PGoFontTextSize)
self.m_PGoScreen = pygame.display.set_mode((self.m_dPatternAdj["ScreenHSize"],
self.m_dPatternAdj["ScreenVSize"]),
pygame.FULLSCREEN)
示例12: _pause
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def _pause(self):
self.m_oJoyHandler.quit()
if self.m_bPause[0]: self._wait()
if self.m_bExit: return
self.m_oJoyHandler.init()
self.m_oScreen = pygame.display.set_mode(self.m_lResolutionXY, pygame.FULLSCREEN)
示例13: _init_screen
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def _init_screen(self):
pygame.display.init()
pygame.font.init()
pygame.mouse.set_visible(0)
# gfx
self.m_oFontText = pygame.font.Font(os.path.join(self.m_sSkinPath,
self.dCFG['font']), self.dCFG['font_size'])
self.dCFG['font_line'] = self.m_oFontText.get_linesize()
# screen
self.m_lResolutionXY = get_screen_resolution()
self._side_and_size()
self.m_oScreen = pygame.display.set_mode(self.m_lResolutionXY, pygame.FULLSCREEN)
示例14: display_init
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def display_init(self):
# try to create a surface and check if it fails
try:
# fullscreen is the default
if self.fullscreen:
# create a hardware accelerated fullscreen surface
self.display_surface = pygame.display.set_mode(
self.display_size, pygame.FULLSCREEN)
# alternatively try a windowed surface
else:
self.display_surface = pygame.display.set_mode(size=self.window_size,
flags=pygame.RESIZABLE, display=1)
except Exception as exc:
print(exc)
print("Display initialization failed. This program needs a running X-Server.")
exit()
self.loadImageCache()
# get absolute size of the surface independend from what was
# requested.
self.display_size = self.display_surface.get_size()
self.current_wallpaper_surface = pygame.image.load(
self.wallpaper_path + "/wallpaper.jpg")
self.current_wallpaper_surface = aspect_scale(
self.current_wallpaper_surface, self.display_size).convert()
示例15: __init__
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import FULLSCREEN [as 别名]
def __init__(self, ai_settings: Settings, stats: GameStats, **kwargs: game_items_types):
"""Initialize with default items unless specified in kwargs."""
# Default initializations for game items.
# Initialize screen.
flags = pygame.HWSURFACE | pygame.DOUBLEBUF # | pygame.FULLSCREEN
self.screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height), flags)
pygame.display.set_caption("Alien Invasion Game")
# Initialize ship.
self.ship = Ship(ai_settings, self.screen)
# Initialize aliens group.
self.aliens = Group()
# Initialize bullets group.
self.bullets = Group()
# Initialize buttons.
self.play_button = Button(self.screen, "Play!")
# TODO implement Restart and Cancel buttons.
# self.restart_button = Button(self.screen, "Restart")
# self.cancel_button = Button(self.screen, "Cancel", (255, 0, 0, 80))
# self.set_button_pos()
# Initialize scorecard.
self.sb = Scorecard(ai_settings, stats, self.screen)
# Set the game items for those default values are given.
for game_item in kwargs:
if game_item in self.acceptable_game_items:
self.__setattr__(game_item, kwargs[game_item])