添加自动获取屏幕大小
This commit is contained in:
1 parent
b72cf37400
commit
88104f6703
2 files changed
+12
-2
No files matched your search
@@ -14,6 +14,13 @@ class Game:
|
||||
# 显示输入法候选框
|
||||
os.environ["SDL_IME_SHOW_UI"] = "1"
|
||||
|
||||
# 如果设置中屏幕为0,0则获取屏幕大小
|
||||
display_info = pygame.display.Info()
|
||||
if not GameConfig.window_x:
|
||||
GameConfig.window_x = display_info.current_w
|
||||
if not GameConfig.window_y:
|
||||
GameConfig.window_y = display_info.current_h
|
||||
|
||||
# 设置窗口大小
|
||||
size = (GameConfig.window_x, GameConfig.window_y)
|
||||
self.screen = pygame.display.set_mode(size, pygame.NOFRAME)
|
||||
@@ -61,5 +68,6 @@ class Game:
|
||||
# 更新显示
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Game()
|
||||
Reference in new issue
Block a user