Browse Source

入りのときに日や月が出ないやぅに(XP草原は東と想定)

sicawke
みてるぞ 6 months ago
parent
commit
a00eaf7ff2
2 changed files with 12 additions and 12 deletions
  1. +0
    -6
      common_module.py
  2. +12
    -6
      main.py

+ 0
- 6
common_module.py View File

@@ -45,9 +45,3 @@ class CommonModule:

return trimmed_left[:cls.index_by_f2c (trimmed_left, length)]

@staticmethod
def rad_to_deg (
rad: float) \
-> float:
return rad * 180 / CMath.PI


+ 12
- 6
main.py View File

@@ -1,6 +1,7 @@
# vim: nosmartindent autoindent

import json
import math
import random
import subprocess
import sys
@@ -149,11 +150,13 @@ class Main:

# 日の角度
sun.compute (observer_with_time)
sun_alt: float = CommonModule.rad_to_deg (sun.alt)
sun_alt: float = math.degrees (sun.alt)
sun_az: float = math.degrees (sun.az)

# 月の角度
moon.compute (observer_with_time)
moon_alt: float = CommonModule.rad_to_deg (moon.alt)
moon_alt: float = math.degrees (moon.alt)
moon_az: float = math.degrees (moon.az)

# 月齢
new_moon_dt: datetime = ephem.localtime (
@@ -166,7 +169,7 @@ class Main:
cls.draw_bg (screen, bg_day, bg_evening, bg_night, bg_grass,
kita, jojoko,
sunrise_start, sunrise_end, sunset_start, sunset_end,
sun_alt, moon_alt, moon_days_old)
sun_alt, sun_az, moon_alt, moon_az, moon_days_old)

# 左上に時刻表示
for i in range (4):
@@ -296,7 +299,8 @@ class Main:
bg_grass, kita, jojoko,
sunrise_start, sunrise_end,
sunset_start, sunset_end,
sun_alt, moon_alt, moon_days_old)
sun_alt, sun_az, moon_alt, moon_az,
moon_days_old)

chat_item.author = {'name': 'ゴートうひとり' if goatoh_talking else '伊地知ニジカ',
'id': '',
@@ -334,7 +338,9 @@ class Main:
sunset_start: datetime,
sunset_end: datetime,
sun_alt: float,
sun_az: float,
moon_alt: float,
moon_az: float,
moon_days_old: float) \
-> None:
sunrise_centre: datetime = (
@@ -368,14 +374,14 @@ class Main:

screen.blit (bg_evening, (0, 0))

if -10 <= moon_alt < 40:
if (moon_az < 180) and (-10 <= moon_alt < 40):
y = ((CWindow.HEIGHT / 2 + 100)
- (CWindow.HEIGHT / 2 + 200) / 30 * moon_alt)
screen.blit (jojoko, jojoko.get_rect (center = (400, y)))

screen.blit (bg_grass, (0, 0))

if -10 <= sun_alt < 40:
if (sun_az < 180) and (-10 <= sun_alt < 40):
y = ((CWindow.HEIGHT / 2 + 100)
- (CWindow.HEIGHT / 2 + 200) / 30 * sun_alt)
screen.blit (kita, kita.get_rect (center = (400, y)))


Loading…
Cancel
Save