|
|
@@ -91,6 +91,7 @@ class Main: |
|
|
|
# 大月ヨヨコ |
|
|
|
jojoko: pygame.Surface = pygame.transform.scale ( |
|
|
|
pygame.image.load ('moon.png'), (200, 200)) |
|
|
|
jojoko.set_colorkey (pygame.Color (0, 255, 0)) |
|
|
|
|
|
|
|
# 音声再生器の初期化 |
|
|
|
pygame.mixer.init (frequency = 44100) |
|
|
@@ -119,7 +120,7 @@ class Main: |
|
|
|
# Youtube Chat から取得したコメントたち |
|
|
|
chat_items: list = [] |
|
|
|
|
|
|
|
# 会話の履歴(3 件分保持) |
|
|
|
# 会話の履歴 |
|
|
|
histories: list = [] |
|
|
|
|
|
|
|
while (True): |
|
|
@@ -142,24 +143,25 @@ class Main: |
|
|
|
# 日の入終了 |
|
|
|
sunset_end: datetime = sunset_start + timedelta (hours = 1) |
|
|
|
|
|
|
|
# 月の出開始 |
|
|
|
'todo' |
|
|
|
|
|
|
|
# 月の出終了 |
|
|
|
'todo' |
|
|
|
|
|
|
|
# 月の入開始 |
|
|
|
'todo' |
|
|
|
|
|
|
|
# 月の入終了 |
|
|
|
'todo' |
|
|
|
|
|
|
|
# 日の角度 |
|
|
|
# 時刻つき観測地 |
|
|
|
observer_with_time: ephem.Observer = observer |
|
|
|
observer_with_time.date = datetime.now () - timedelta (hours = 9) |
|
|
|
|
|
|
|
# 日の角度 |
|
|
|
sun.compute (observer_with_time) |
|
|
|
sun_alt: float = CommonModule.rad_to_deg (sun.alt) |
|
|
|
|
|
|
|
# 月の角度 |
|
|
|
moon.compute (observer_with_time) |
|
|
|
moon_alt: float = CommonModule.rad_to_deg (moon.alt) |
|
|
|
|
|
|
|
# 月齢 |
|
|
|
new_moon_dt: datetime = ephem.localtime ( |
|
|
|
ephem.previous_new_moon (observer_with_time.date)) |
|
|
|
moon_days_old: float = ( |
|
|
|
(datetime.now () - new_moon_dt).total_seconds () |
|
|
|
/ 60 / 60 / 24) |
|
|
|
|
|
|
|
# 背景描画 |
|
|
|
cls.draw_bg (screen, bg_day, bg_evening, bg_night, bg_grass, |
|
|
|
kita, jojoko, |
|
|
@@ -320,24 +322,26 @@ class Main: |
|
|
|
@classmethod |
|
|
|
def draw_bg ( |
|
|
|
cls, |
|
|
|
screen: pygame.Surface, |
|
|
|
bg_day: pygame.Surface, |
|
|
|
bg_evening: pygame.Surface, |
|
|
|
bg_night: pygame.Surface, |
|
|
|
bg_grass: pygame.Surface, |
|
|
|
kita: pygame.Surface, |
|
|
|
jojoko: pygame.Surface, |
|
|
|
sunrise_start: datetime, |
|
|
|
sunrise_end: datetime, |
|
|
|
sunset_start: datetime, |
|
|
|
sunset_end: datetime, |
|
|
|
sun_alt: float) \ |
|
|
|
screen: pygame.Surface, |
|
|
|
bg_day: pygame.Surface, |
|
|
|
bg_evening: pygame.Surface, |
|
|
|
bg_night: pygame.Surface, |
|
|
|
bg_grass: pygame.Surface, |
|
|
|
kita: pygame.Surface, |
|
|
|
jojoko_original: pygame.Surface, |
|
|
|
sunrise_start: datetime, |
|
|
|
sunrise_end: datetime, |
|
|
|
sunset_start: datetime, |
|
|
|
sunset_end: datetime, |
|
|
|
sun_alt: float) \ |
|
|
|
-> None: |
|
|
|
sunrise_centre: datetime = ( |
|
|
|
sunrise_start + (sunrise_end - sunrise_start) / 2) |
|
|
|
sunset_centre: datetime = ( |
|
|
|
sunset_start + (sunset_end - sunset_start) / 2) |
|
|
|
|
|
|
|
jojoko: pygame.Surface = jojoko_original.copy () |
|
|
|
|
|
|
|
dt: datetime = datetime.now () |
|
|
|
|
|
|
|
if sunrise_centre <= dt < sunset_centre: |
|
|
@@ -356,6 +360,9 @@ class Main: |
|
|
|
|
|
|
|
screen.blit (bg_evening, (0, 0)) |
|
|
|
|
|
|
|
# TODO: 緑を塗ってヨヨコを缺かす. |
|
|
|
# pygame.draw.arc (jojoko, (0, 255, 0), |
|
|
|
|
|
|
|
if -10 <= sun_alt < 40: |
|
|
|
y = ((CWindow.HEIGHT / 2 + 100) |
|
|
|
- (CWindow.HEIGHT / 2 + 200) / 30 * sun_alt) |
|
|
|