fixed non-16to9 formats

small-fixes-for-0.3.3
Max Lange 8 years ago
parent e167ff4360
commit 60013715f6

@ -2,6 +2,7 @@
<[sizes = (Very Small, Small, Medium, Big, Very Big)
<#background = (./assets/sprites/Background1.tif)
*|Settings |30 |$typeface|$color |$half + 0|$qrt + 0|
-|Volume |$volume |$size|$ratio|$typeface|$color|$box2 |$half + 0|%40 + 10|
~-|Button Size|$sizes|$button size|$size|$ratio|$typeface|$color|$box2|BottomLeft|%0 + 0|%0 + 10|
~~-|Fullscreen |$offon|$fullscreen |$size|$ratio|$typeface|$color|$box2|BottomLeft|%0 + 0|%0 + 10|

@ -27,32 +27,31 @@ def init():
if settings.aspect_ratio != 16.0 / 9:
# makes a black stripe if not 16 to 9
no16to9 = True
delta_screeny = settings.screeny - settings.screeny_current
correcture = pygame.Surface((settings.screenx, delta_screeny))
delta_screeny = (settings.screeny_current
- (settings.screenx_current * 9.0 / 16))
correcture = pygame.Surface((settings.screenx_current, delta_screeny)
).convert_alpha()
correcture_pos = correcture.fill((0, 0, 0))
correcture.set_alpha(255)
correcture_pos.bottomleft = (0, settings.screeny)
correcture_pos.topleft = (0, (settings.screenx_current * 9.0 / 16))
def ingame():
"""Draws everything while game runs"""
# nothing to explain here i guess
screen = settings.screen
settings.world.blit()
status()
settings.player.blit(screen)
settings.player.blit(settings.screen)
debug()
drawsongname()
drawtargetsum()
drawworldname()
if no16to9:
pass
#screen.blit(correcture, correcture_pos)
settings.screen.blit(correcture, correcture_pos)
pygame.display.flip()
@ -192,9 +191,11 @@ def status():
border.set_alpha(0)
borderpos = border.get_rect()
borderpos.bottomright = (settings.screenx_current,
settings.screeny_current)
settings.screeny_current - correcture_pos.h)
pos = bar.fill((62, 186, 23, 40))
pos.right = settings.screenx_current
pos.top = settings.screeny_current - (pos.h / 100.0) * specials.energy
pos.top = (settings.screeny_current
- (pos.h / 100.0) * specials.energy
- correcture_pos.h)
settings.screen.blit(bar, pos)
settings.screen.blit(border, borderpos)

@ -34,6 +34,7 @@ def init():
global debugscreen # determines wether to show debug info
global debugmode # Enables debugmode
global isnear # easteregg
global background # background image
global field # image for the inputfield
global bullet_img # image for the bullet
global targeton_img # surf for target whenlight turned on
@ -77,7 +78,7 @@ def init():
pygame.display.set_mode((1, 1))
aspect_ratio = screenx / float(screeny)
screenx_current = screenx
screeny_current = int(screenx_current * 9.0 / 16.0)
screeny_current = screeny
# create empty folders if needed
if not os.path.exists("./assets/sprites/player/"):
@ -187,6 +188,16 @@ def init():
world = localmap["1"]
upd("adjust_screen")
#scales images so they fill screen especially when not 16/9 ar
if aspect_ratio > 16.0 / 9:
ratio = screenx_current / float(background.get_size()[1])
pygame.transform.smoothscale(background,
(screenx_current, screeny_current * ratio))
elif aspect_ratio < 16.0 / 9:
ratio = screeny_current / float(background.get_size()[0])
pygame.transform.smoothscale(background,
(screenx_current * ratio, screeny_current))
def reset():
@ -221,8 +232,10 @@ def upd(level):
if level == "screenvalues":
global screenx_current
global screeny_current
global aspect_ratio
screenx_current = pygame.display.Info().current_w
screeny_current = int(screenx_current * 9.0 / 16.0)
screeny_current = pygame.display.Info().current_h
aspect_ratio = screenx_current / float(screeny_current)
return
if level == "get_saves":
global saves
@ -237,7 +250,6 @@ def upd(level):
global background
global background_pos
global konstspeed
global no16to9
global fullscreenold
global fullscreen
@ -254,6 +266,17 @@ def upd(level):
konstspeed = konstspeed * (screenx_current / 1920.0)
world.adjust_to_screen()
#scales images so they fill screen especially when not 16/9 ar
if aspect_ratio > 16.0 / 9:
ratio = screenx_current / float(background.get_size()[1])
pygame.transform.smoothscale(background,
(screenx_current, int(screeny_current * ratio)))
elif aspect_ratio < 16.0 / 9:
ratio = screeny_current / float(background.get_size()[0])
pygame.transform.smoothscale(background,
(int(screenx_current * ratio), screeny_current))
return
print("Something went wrong here")
raise Exception

@ -115,10 +115,13 @@ class world():
draw.no16to9 = False
if settings.aspect_ratio != 16.0 / 9:
draw.no16to9 = True
delta_screeny = settings.screeny - settings.screeny_current
draw.correcture = pygame.Surface((settings.screenx, delta_screeny))
delta_screeny = (settings.screeny_current
- (settings.screenx_current * 9.0 / 16))
draw.correcture = pygame.Surface((settings.screenx_current, delta_screeny)
).convert_alpha()
draw.correcture_pos = draw.correcture.fill((0, 0, 0))
draw.correcture_pos.bottomleft = (0, settings.screeny)
draw.correcture.set_alpha(255)
draw.correcture_pos.topleft = (0, (settings.screenx_current * 9.0 / 16))
for star in self.stars:
star.update(settings.screenx_current / 1920.0)

Loading…
Cancel
Save