Added keybinding for fullscreen mode
This commit is contained in:
12
log.txt
12
log.txt
@@ -1,6 +1,6 @@
|
|||||||
13:24:17: Loading game...
|
13:35:44: Loading game...
|
||||||
13:24:17: Loading images...
|
13:35:44: Loading images...
|
||||||
13:24:17: Setup fonts...
|
13:35:44: Setup fonts...
|
||||||
13:24:17: Get git revision hash...
|
13:35:44: Get git revision hash...
|
||||||
13:24:17: Git-Hash: fb55785
|
13:35:44: Git-Hash: 7598878
|
||||||
13:24:32: Log closed!
|
13:36:10: Log closed!
|
||||||
|
|||||||
9
test.py
9
test.py
@@ -17,7 +17,7 @@ pygame.mouse.set_visible(True)
|
|||||||
RENDERING_SIZE = (1024,768)
|
RENDERING_SIZE = (1024,768)
|
||||||
WINDOWED_DEF_SIZE = (1024,768)
|
WINDOWED_DEF_SIZE = (1024,768)
|
||||||
#pygame.key.set_repeat(1, 30)
|
#pygame.key.set_repeat(1, 30)
|
||||||
window = pygame.display.set_mode((2440,1200), pygame.FULLSCREEN)
|
window = pygame.display.set_mode((RENDERING_SIZE))
|
||||||
screen = pygame.Surface(RENDERING_SIZE)
|
screen = pygame.Surface(RENDERING_SIZE)
|
||||||
|
|
||||||
#screen = pygame.display.set_mode((1024,768)) #TODO Add fullscreen mode
|
#screen = pygame.display.set_mode((1024,768)) #TODO Add fullscreen mode
|
||||||
@@ -87,6 +87,9 @@ while(gamestate):
|
|||||||
gamestate = False
|
gamestate = False
|
||||||
if(event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
|
if(event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
|
||||||
gamestate = False
|
gamestate = False
|
||||||
|
#Push F10 for fullscreen-mode
|
||||||
|
if(event.type == pygame.KEYDOWN and event.key == pygame.K_F10):
|
||||||
|
pygame.display.set_mode(RENDERING_SIZE, pygame.FULLSCREEN)
|
||||||
player1.handle_input(event)
|
player1.handle_input(event)
|
||||||
player2.handle_input(event)
|
player2.handle_input(event)
|
||||||
|
|
||||||
@@ -96,7 +99,6 @@ while(gamestate):
|
|||||||
if(player1.keymap["right"] == True and player1.pos_x <= (screen.get_size()[0]-player1.width)):
|
if(player1.keymap["right"] == True and player1.pos_x <= (screen.get_size()[0]-player1.width)):
|
||||||
player1.move("right")
|
player1.move("right")
|
||||||
#print("rechts")
|
#print("rechts")
|
||||||
|
|
||||||
if(player2.keymap["left"] == True and player2.pos_x > 0):
|
if(player2.keymap["left"] == True and player2.pos_x > 0):
|
||||||
player2.move("left")
|
player2.move("left")
|
||||||
#print("links")
|
#print("links")
|
||||||
@@ -220,8 +222,11 @@ while(gamestate):
|
|||||||
screen.blit(hash_label, (25, screen.get_size()[1] -25))
|
screen.blit(hash_label, (25, screen.get_size()[1] -25))
|
||||||
|
|
||||||
frametime = clock.get_time()
|
frametime = clock.get_time()
|
||||||
|
#Scales the mainsurface
|
||||||
scaled_win = pygame.transform.smoothscale(screen, window.get_size())
|
scaled_win = pygame.transform.smoothscale(screen, window.get_size())
|
||||||
|
#Blits the mainsurface to the mainwindow
|
||||||
window.blit(scaled_win, (0, 0))
|
window.blit(scaled_win, (0, 0))
|
||||||
|
|
||||||
#if(mouse_pos <= (image.topleft+image.size) and mouse_pos >= image.topleft):
|
#if(mouse_pos <= (image.topleft+image.size) and mouse_pos >= image.topleft):
|
||||||
# print("HIIIIITTT!!!!")
|
# print("HIIIIITTT!!!!")
|
||||||
frametime = 0
|
frametime = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user